In this article
Get All Entities By EntityType
This endpoint is used to get all entities of specific entity type on the graph db from Entity Service API. Application user has to provide the ercollectionid as part of header body and entityType or OData style query as part of url to fetch the graph from specific partition.
URL
https://{{HOST}}/apollo/graph/entities/{entityType}?v={version}
https://{{HOST}}/apollo/graph/entities($select=eType:{entityType})?v={version}
Method
Required IMS Scopes
- apollo_read
Versions Supported
1.0 (Default)
1.1
1.2
URL Query Parameter
| Name | Description | Example | |
|---|---|---|---|
| v optional |
Service Version | ?v=1.1 | String |
| includeSystemData optional |
Flag to indicate if result should have system data field (default false) | /entities({entityID},{entityID})?includeSystemData=false |
URL Path Parameters
| Name | Description | Example | Type |
|---|---|---|---|
| {entityType} | Entity Type | BRICK_0_4__Floor | string |
Request Header Parameters
| Type | Value | Description |
|---|---|---|
| Authorization required |
Bearer {access_token} | Authorization token |
| Content-Type required |
application/json | Content Type |
| ercollectionid required |
{ercollectionid} | Partition Key |
| first | 0 to max limit record | Number of entities per page |
| after | {{after}} | Current Index |
Note
{{after}} is the environment variable that is blank at the first time of request.
first and {{after}} parameter is used for the pagination. {{after}} parameter is automatically get set from response object after completing first request. Response object has object with name “paging” which has “continuationToken” attribute. “continuationToken” attribute needs to extract and set it to {{after}} variable.
Example
Request
curl -X GET
'https://{{HOST}}/apollo/graph/entities/BRICK_0_4__Floor?v=1.2'
-H 'Authorization: Bearer {{access_token}}'
-H 'Content-Type: application/json'
-H 'ercollectionid: testcollection'
-H 'first: 100'
-H 'after: 0'
curl -X GET
'https://{{HOST}}/apollo/graph/entities($select=eType:BRICK_0_4__Floor)?v=1.2'
-H 'Authorization: Bearer {{access_token}}'
-H 'Content-Type: application/json'
-H 'ercollectionid: testcollection'
-H 'first: 100'
-H 'after: 0'
Response
{
"status": {
"message": "",
"code": "200"
},
"data": [
{
"id": "JCI-507-B1-F1",
"entityType": "BRICK_0_4__Floor",
"brickEntityType": "BRICK_0_4__Location",
"entityName": "JCI 507 Michigan Street Milwaukee Building B1 Floor F1",
"brickEntitySubType": "BRICK_0_4__Floor"
},
{
"id": "JCI-507-B1-F2",
"entityType": "BRICK_0_4__Floor",
"brickEntityType": "BRICK_0_4__Location",
"entityName": "JCI 507 Michigan Street Milwaukee Building B1 Floor F2",
"brickEntitySubType": "BRICK_0_4__Floor"
}
],
"paging": {
"totalCount": 2,
"continuationToken": null
}
}
Errors
| Error | Code | Description |
|---|---|---|
| Bad Request | 400 | The request could not be understood by the server due to malformed syntax. |
| Unauthorized | 401 | The request can not be processed if token is not valid or expired. |
| Forbidden | 403 | The request can not proceed if ercollectionid is not registered or does not have any logs in ACL library. |