You often need to retrieve already persisted object data from Supply Chain Intelligence
Suite for use in your application. You can issue a basic
businessObjectEvent query to the GraphQL API and parse the data for
consumption.
Before you begin
- Understand how to use GraphQL. For more information, see GraphQL tutorials.
- Understand how to send a business object event to Supply Chain Intelligence
Suite GraphQL data API.
- Add JSON Web Token authentication to HTTP request headers. For more information, see
Creating authentication tokens.
Note: If you do not pass this auth header, Supply Chain Intelligence
Suite APIs
return a 401 error.
Procedure
-
In the GraphiQL visual editor, send the sample canonical business object to the
GraphQL data API.
{
businessObjectEvents(
simpleFilter: {
businessObject: {
type: Order
# id: "!!!YOUR OBJECT ID HERE!!!"
},
tenantId: "!!!YOUR TENANT ID HERE!!!"
},
cursorParams: {
first: 1 # Maximum number of items to return
}
) {
totalCount
pageInfo {
endCursor
hasNextPage
}
edges {
cursor
object {
eventCode
infoHubObjectId
objectType
tenantId
timestampEventOccurred
timestampEventReceived
eventDetails {
... on BusinessObjectEventDetails {
businessObject {
id
type
}
eventSource {
type
EDI {
transactionType
size
}
}
}
}
}
}
}
}
-
Click the Run icon.
The query runs and retrieves the business object events that are already stored for this
tenant ID and
type.
The following response is shown in the editor:
{
"data": {
"businessObjectEvents": {
"totalCount": 29,
"pageInfo": {
"endCursor": "MGV5UnkyNEJ1U2VUaWFVM2VMRWM=",
"hasNextPage": true
},
"edges": [
{
"cursor": "MGV5UnkyNEJ1U2VUaWFVM2VMRWM=",
"object": {
"eventCode": "objectUpsertEvent",
"infoHubObjectId": "372c9cdb-1077-464e-9132-b29fa25544d2",
"objectType": "com.ibm.infohub.businessEventModel.order",
"tenantId": "e2_aRj_3np92C2Tl9uWIyh0vQP8N8",
"timestampEventOccurred": "2019-12-03T11:42:18.272Z",
"timestampEventReceived": "2019-12-03T11:42:18.272Z",
"eventDetails": {
"businessObject": {
"id": "372c9cdb-1077-464e-9132-b29fa25544d2",
"type": "Order"
},
"eventSource": null
}
}
}
]
}
}
}
Note: The exact response that you see might vary because new events are constantly occuring.
What to do next
You can modify the criteria and the attributes to return and rerun the query as many
times as you want.