Content Services GraphQL API

Use the API to create, retrieve, update, or delete resources. The API is ideal for web and mobile application development because it supports retrieving exactly the data you need with a single call. By default, this API is provisioned on your subscription.

Overview

The Content Services GraphQL API provides a schema and an easy-to-understand query language system that simplifies application development for your Content Platform Engine. The API schema definition of types and fields matches Content Engine Java API object model closely, with necessary and desirable extensions for natural GraphQL developer consumption.

The API includes the following operations:
  • Metadata discovery
  • Document and Folder operations
  • Search operations
  • Browse operations
Access the API endpoint by using one of the following URLs. Use the URL that applies to your subscription setup.
  • https://hostname.automationcloud.ibm.com.com/dba/environment/content-services-graphql/graphql
  • https://fncm-environment-hostname.automationcloud.ibm.com/content-services-graphql/graphql
Where environment has the value dev for the development environment, test for the test environment, or run for the production environment.
The API has an in-browser integrated development environment (GraphiQL) to help you explore and interact with the API. Depending on how your subscription was set up, access the integrated development environment by using one of the following URLs:
  • https://hostname.automationcloud.ibm.com/dba/environment/content-services-graphql/
  • https://fncm-environment-hostname.automationcloud.ibm.com/content-services-graphql/
Make sure you include "/" at the end of the URL.
Note: The integrated development environment is not available in the production environment.

All applications that use the GraphQL API must pass a ECM-CS-XSRF-Token token in the header and the cookie. It is recommended that the GraphQL client generates the token, sets it as a cookie on the client browser, and saves the same value in the user session. When a client request comes, the GraphQL client validates the ECM-CS-XSRF-Token cookie against the saved value. When the request is passed to Content Services GraphQL, these values are in the header ECM-CS-XSRF-Token and cookie EM-CS-XSRF-Token.

Testing connection to the API

After you access the GraphQL instance for the API, you can test the connection to the Content Platform Engine as shown in the following example.
{
  _apiInfo(repositoryIdentifier: "OS1") {
    buildDate
    buildNumber
    implementationVersion
    implementationTitle
    productVersion
    cpeInfo {
      cpeURL
      cpeUser
      repositoryName
    }
  }
}
The value for the repositoryIdentifier is the Content Platform Engine object store name (symbolic name) or ID (GUID).
A successful connection provides a response similar to the following example.
{
 "data": {
  "_apiInfo": {
  "buildDate": "February 28, 2020 at 09:20",
  "buildNumber": "29",
  "implementationVersion": "20200228-0920-29-pwtest330",
  "implementationTitle": "IBM FileNet Content Services GraphQL API - content-graphql-api",
  "productVersion": "5.5.4",
  "cpeInfo": {
   "cpeURL": "http://cpe_host:port/wsi/FNCEWS40MTOM/",
   "cpeUser": "uid=admin@ibm.com,cn=users,O=IBM,C=US",
   "repositoryName": "OS1"
   }
  }
 }
}

A developer guide is available for the API. For more information, see Content Services GraphQL API Developer Guide in the IBM® FileNet® P8 Platform documentation.

Using webhooks

The Content Services GraphQL API supports webhooks. Webhooks are user-defined HTTP callbacks made with HTTP POST requests. They provide a way for the Content Platform Engine to provide near real-time information to other interested applications or services.

The callbacks can be triggered by events in the Content Platform Engine, such as checking in a document to a repository or updating a property on a Content Platform Engine object. The Content Engine then makes an HTTP POST request to the URL that is configured for the webhook.

For more information about event webhooks, see Content Platform Engine event webhooks and Content event webhook examples.