Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

Tutorial Query 102

Paul Konigsberg edited this page May 13, 2022 · 7 revisions

Tutorial Overview

As an application developer you often need to retrieve already persisted object data from the Intelligence Suite, for use in your application. In this exercise you will learn how issue a basic businessObjectEvent query to the GraphQL API and parse the data for consumption.

What you will learn

At the end of this tutorial, you will have learned:

  • How to write a basic business object event GraphQL query.
  • How to call the Intelligence Suite's graphql data event warehouse apis to retrieve an already persisted business object events.
  • How to parse the returned event for use in your application.

Pre-reqs

  1. If you are new to GraphQL, please complete the graphql.com tutorials until you feel comfortable with GraphQL api basics. (Some of these apis will likely have public apis at a later date)
  2. For more information on how to send an Business Object Event to the Intelligence Suite's GraphQL data API refer Tutorial-Ingest-102
  3. Read through how to add JWT-Authentication to your http requests to the Intelligence Suite REST and Graph apis, and be sure pass this auth header in each API in this tutorial. NOTE: If you fail to pass this auth header you will get a 401 from the Intelligence Suite APIs.

Steps

  1. Complete all pre-reqs.
  2. Navigate to the GraphiQL visual editor.
  3. To send the sample canonical business object to the GraphQL data API refer Tutorial-Ingest-102.
{
  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
              }
            }
          }
        }
      }
    }
  }
}

5. Click the run button on the left-top side of the editor. This will run the query and retrieve the business object events already stored for this tenant, id and type.

Query for rule results

The response shows the following result on the right side of 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: this is a live system. The exact response you see may vary from the above screenshot as new events are constantly being fired.

6. You can modify the criteria and/or the attributes to return and re-run the query as many times as you like.


Related topics

  • Onboarding your data Load and manage your IBM Intelligence Suite data by understanding the data model and how to upload your own data into the system.

Parent topic:

Clone this wiki locally