Skip Headers
Oracle® Healthcare Master Person Index Relationship Management REST APIs Reference Guide
Release 4.0

E71322-01
Go to Table of Contents
Contents
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

4 Entities Resources

The entities resources contain the following APIs:

4.1 GET /resources

This API is used to retrieve entity and relationship resources REST API version information.

Request URI

http(s)://<server>:<port>/ohmpi-rm/1.0.0/resources

Request Type

HTTP GET

Response Content Type

application/json;charset=UTF-8

Response Parameters

Parameter Description
version OHMPI RM version number
description The description of entity and relationship resources
url The URL of this REST API

Response Status Code

Status Code Description
200 Success
404 Incorrect URI

Sample Request URI

http://localhost:7001/ohmpi-rm/1.0.0/resources

Sample Response Body

{
  "items":
  [
    {
      "description": "OHMPI RM Entity Resources",
      "roles": null,
      "url": "http://localhost:7001/ohmpi-rm/1.0.0/resources/entities",
      "userId": null,
      "version": "1.0.0"
    },
    {
      "description": "OHMPI RM Relationship Resources",
      "roles": null,
      "url": "http://localhost:7001/ohmpi-rm/1.0.0/resources/relationships",
      "userId": null,
      "version": "1.0.0"
    }
  ]
}

Sample Response Code

200

4.2 GET /resources/entities/{id}

This API is used to get entity by its ID.

Request URI

http(s)://<server>:<port>/ohmpi-rm/1.0.0/resources/entities/{id}

Request Type

HTTP GET

Response Content Type

application/json;charset=UTF-8

Request Query Parameters

Parameter Value Description
id Matching the regex [a-zA-Z0-9]+ EntityId of the entity to be retrieved

Response Parameters

Parameter Description
entity For information on the entity attributes in response, see Section A.2.6, "Entity Response Structure".

Response Status Code

Status Code Description
200 Success
404 Incorrect URI
400 Invalid argument/Invalid Resource Id
500 Error while processing

Sample Request URI

http://localhost:7001/ohmpi-rm/1.0.0/resources/entities /1

Sample Response Body

{
  "attributes":
  [
    {
      "entity":
      {
        "attributes": null,
        "entityId": 1,
        "id": null,
        "links":
        [
          {
            "href": "/ohmpi-rm/1.0.0/resources/entities/1",
            "mediaType": "application/json",
            "rel": "canonical"
          }
        ],
        "status": null,
        "type": null
      },
      "entityAttributeId": 1,
      "name": "FirstName",
      "value": "Mark"
    }
  ],
  "entityId": 1,
  "id": "0000000003",
  "links":
  [
    {
      "href": "/ohmpi-rm/1.0.0/resources/entities/1",
      "mediaType": "application/json",
      "rel": "canonical"
    }
  ],
  "status": "Active",
  "type":
  {
    "attributes": null,
    "description": null,
    "entityTypeId": 1,
    "id": null,
    "links":
    [
      {
        "href": "/ohmpi-rm/1.0.0/metadata/entities/Patient",
        "mediaType": "application/json",
        "rel": "canonical"
      }
    ],
    "name": "Patient",
    "status": "Active"
  }
}

Sample Response Code

200

4.3 POST /resources/entities

This API is used to search entities by entity type and entity attributes.

Request URI

http(s)://<server>:<port>/ohmpi-rm/1.0.0/resources/entities

Request Content Type

application/json

Request Type

HTTP POST

Response Content Type

application/json;charset=UTF-8

Request Query Parameters

Parameter Value Description
name Matching the regex [a-zA-Z][a-zA-Z_0-9]+ Entity type name of entities to be searched. It is a mandatory parameter.
status active, inactive, or all Status of entities to filter
limit Any positive integer Maximum number of results to return in the REST API response. Default value is 1000.
offset Any positive integer Offset from which the results should be provided in the response. Default value is 1.
totalResults true or false View total records count
expand all View more details of the entities
entityResource - Details of the entities to be searched. For details on the fields for the entity request body, see Section A.1.6, "Entity Resource".

Response Parameters

Parameter Description
items An array containing entities
entity For information on the entity attributes in response, see Section A.2.6, "Entity Response Structure".
totalResults Value is set to the total number of entities based on the filter. This might be greater than the number of results displayed in the REST API response, based on offset and limit values. The value is displayed if totalResults is set to true in the request parameter. Otherwise, the value is null.

Response Status Code

Status Code Description
200 Success
404 Incorrect URI
400 Invalid argument/Invalid Resource Name
500 Error while processing

Sample Request URI

http://localhost:7001/ohmpi-rm/1.0.0/resources/entities?name=Patient&status=active

Sample Request Body

{
  "attributes":
  [
    {
      "name":"FirstName",
      "value":"Mark"
    }
  ]
}

Sample Response Body

{
  "items":
  [
    {
      "attributes": null,
      "entityId": 1,
      "id": "0000000003",
      "links":
      [
        {
          "href": "/ohmpi-rm/1.0.0/resources/entities/1",
          "mediaType": "application/json",
          "rel": "canonical"
        }
      ],
      "status": "Active",
      "type":
      {
        "attributes": null,
        "description": null,
        "entityTypeId": 1,
        "id": null,
        "links":
        [
          {
            "href": "/ohmpi-rm/1.0.0/metadata/entities/Patient",
            "mediaType": "application/json",
            "rel": "canonical"
          }
        ],
        "name": "Patient",
        "status": "Active"
      }
    }
  ],
  "links":
  [
    {
      "href": "/ohmpi-rm/1.0.0/resources/entities",
      "mediaType": "application/json",
      "rel": "canonical"
    }
  ],
  "totalResults": 1
}

Sample Response Code

200

4.4 POST /resources/entities/{name}/{attribute}

This API is used to search entities by entity type and date attribute range.

Request URI

http(s)://<server>:<port>/ohmpi-rm/1.0.0/resources/entities/{name}/{attribute}

Request Content Type

application/json

Request Type

HTTP POST

Response Content Type

application/json;charset=UTF-8

Request Query Parameters

Parameter Value Description
name Matching the regex [a-zA-Z][a-zA-Z_0-9]+ Entity type name of entities to be searched
attribute Matching the regex [a-zA-Z][a-zA-Z_0-9]+ Attribute name of the entity type to be searched using range search. It must be of type Date.
since Should be in the format yyyy-MM-dd Start date from which attribute must be searched. It is a mandatory parameter.
until Should be in the format yyyy-MM-dd End date till which attribute must be searched. Default is today's date.
status active, inactive, or all Status of entities to filter
orderBy Format: fieldname|sortOrder where fieldname can be id, entityId, status; sortOrder can be asc, desc Order by built-in attribute name. Default is order by entityId in ascending order.
limit Any positive integer Maximum number of results to return in the REST API response. Default value is 1000.
offset Any positive integer Offset from which the results should be provided in the response. Default value is 1.
totalResults true or false View total records count
expand all View more details of the entities
entityResource - Details of the entities to be searched. For details on the fields for the entity request body, see Section A.1.6, "Entity Resource".

Response Parameters

Parameter Description
items An array containing entities
entity For information on the entity attributes in response, see Section A.2.6, "Entity Response Structure".
totalResults Value is set to the total number of entities based on the filter. This might be greater than the number of results displayed in the REST API response, based on the offset and limit values.The value is displayed if totalResults is set to true in the request parameter. Otherwise, the value is null.

Response Status Code

Status Code Description
200 Success
404 Incorrect URI
400 Invalid argument/Invalid Resource Name
500 Error while processing

Sample Request URI

http://localhost:7001/ohmpi-rm/1.0.0/resources/entities/IndPatient/DOB?since=2010-01-01

Sample Request Body

{
  "attributes":
  [
    {
      "name":"FirstName",
      "value":"Mark"
    }
  ]
}

Sample Response Body

{
  "items":
  [
    {
      "attributes": null,
      "entityId": 5,
      "id": "IP5",
      "links":
      [
        {
          "href": "/ohmpi-rm/1.0.0/resources/entities/IndPatient/DOB/5",
          "mediaType": "application/json",
          "rel": "canonical"
        },
      ],
      "status": "Active",
      "type":
      {
        "attributes": null,
        "description": null,
        "entityTypeId": 1,
        "id": null,
        "links":
        [
          {
            "href": "/ohmpi-rm/1.0.0/metadata/entities/IndPatient",
            "mediaType": "application/json",
            "rel": "canonical"
          }
        ],
        "name": "IndPatient",
        "status": "Active"
      }
    }
  ],
  "links":
  [
    {
      "href": "/ohmpi-rm/1.0.0/resources/entities/IndPatient/DOB",
      "mediaType": "application/json",
      "rel": "canonical"
    }
  ],
  "totalResults": null
}

Sample Response Code

200

4.5 POST /resources/entities/{name}

This API is used to create an entity of the specific entity type.

Request URI

http(s)://<server>:<port>/ohmpi-rm/1.0.0/resources/entities/{name}

Request Content Type

application/json

Request Type

HTTP POST

Response Content Type

application/json;charset=UTF-8

Request Query Parameters

Parameter Value Description
name Matching the regex [a-zA-Z][a-zA-Z_0-9]+ Entity type name of entity to be created
entityResource - Details of the entities to be created. For details on the fields for the entity request body, see Section A.1.6, "Entity Resource".

Response Parameters

Parameter Description
entity For information on the entity attributes in response, see Section A.2.6, "Entity Response Structure".

Response Status Code

Status Code Description
200 Success
404 Incorrect URI
400 Invalid argument/Invalid Resource Name
500 Error while processing

Sample Request URI

http://localhost:7001/ohmpi-rm/1.0.0/resources/entities/Patient

Sample Request Body

{
  "id": "1000000101",
  "type":
  {
    "name": "Patient"
  },
  "attributes":
  [
    {
      "name": "FirstName",
      "value": "Peter"
    }
  ]
}

Sample Response Body

{
  "attributes":
  [
    {
      "entity": null,
      "entityAttributeId": 1,
      "name": "FirstName",
      "value": "Peter"
    }
  ],
  "entityId": 1,
  "id": "1000000101",
  "links":
  [
    {
      "href": "/ohmpi-rm/1.0.0/resources/entities/Patient",
      "mediaType": "application/json",
      "rel": "canonical"
    }
  ],
  "status": "Active",
  "type":
  {
    "attributes": null,
    "description": null,
    "entityTypeId": 1,
    "id": null,
    "links":
    [
      {
        "href": "/ohmpi-rm/1.0.0/metadata/entities/Patient",
        "mediaType": "application/json",
        "rel": "canonical"
      }
    ],
    "name": "Patient",
    "status": "Active"
  }
}

Sample Response Code

200

4.6 PUT /resources/entities/{id}

This API is used to update an entity by its ID.

Request URI

http(s)://<server>:<port>/ohmpi-rm/1.0.0/resources/entities/{id}

Request Content Type

application/json

Request Type

HTTP PUT

Response Content Type

application/json;charset=UTF-8

Request Query Parameters

Parameter Value Description
id Matching the regex [a-zA-Z0-9]+ EntityId of the entity to be updated
status active or inactive To activate or deactivate the entity. When status is passed, the body (entityResource) details are ignored. However, the body must be passed as {}.
entityResource - Details of the entity to be updated. This is considered for updating the entity if the status parameter is not set to any value. For details on the fields for the relationship type request body, see Section A.1.6, "Entity Resource".

Response Parameters

Parameter Description
entity For information on the entity attributes in response, see Section A.2.6, "Entity Response Structure".

Response Status Code

Status Code Description
200 Success
404 Incorrect URI
400 Invalid argument/Invalid Resource Id
500 Error while processing

4.6.1 To Update Entity Status

Sample Request URI

http://localhost:7001/ohmpi-rm/1.0.0/resources/entities/1?status=active

Sample Request Body

{}

Sample Response Body

{
  "attributes":
  [
    {
      "entity": null,
      "entityAttributeId": 1,
      "name": "FirstName",
      "value": "Peter"
    }
  ],
  "entityId": 1,
  "id": "1000000101",
  "links":
  [
    {
      "href": "/ohmpi-rm/1.0.0/resources/entities/1",
      "mediaType": "application/json",
      "rel": "canonical"
    }
  ],
  "status": "Active",
  "type":
  {
    "attributes": null,
    "description": null,
    "entityTypeId": 1,
    "id": null,
    "links":
    [
      {
        "href": "/ohmpi-rm/1.0.0/metadata/entities/Patient",
        "mediaType": "application/json",
        "rel": "canonical"
      }
    ],
    "name": "Patient",
    "status": "Active"
  }
}

Sample Response Code

200

4.6.2 To Update Entity Attributes and Other Details

Sample Request URI

http://localhost:7001/ohmpi-rm/1.0.0/resources/entities/1

Sample Request Body

{
  "attributes":
  [
    {
      "name": "FirstName",
      "value": "Harry"
    }
  ]
}

Sample Response Body

{
  "attributes":
  [
    {
      "entity": null,
      "entityAttributeId": 1,
      "name": "FirstName",
      "value": "Harry"
    }
  ],
  "entityId": 1,
  "id": "1000000101",
  "links":
  [
    {
      "href": "/ohmpi-rm/1.0.0/resources/entities/1",
      "mediaType": "application/json",
      "rel": "canonical"
    }
  ],
  "status": "Active",
  "type":
  {
    "attributes": null,
    "description": null,
    "entityTypeId": 1,
    "id": null,
    "links":
    [
      {
        "href": "/ohmpi-rm/1.0.0/metadata/entities/Patient",
        "mediaType": "application/json",
        "rel": "canonical"
      }
    ],
    "name": "Patient",
    "status": "Active"
  }
}

Sample Response Code

200