REST sample

Documented REST API samples demonstrate some general use cases to help you get started with developing your own custom applications.

Before you begin

The following steps guide you through the process of authentication, retrieving a list of files, and working with extensions.

Procedure

  1. Create a session by issuing a GET command against the /api/v1/session endpoint. The response includes information that you must send in order to authenticate. If anonymous is allowed, you are authenticated by default. Otherwise, you can authenticate by issuing a PUT /api/v1/session request and pass in a JSON document. For example:
    {
      "parameters": [
        {
          "name": "CAMNamespace",
          "value": "LDAP"
        },
        {
          "name": "CAMUsername",
          "value": "johnsmith"
        },
        {
          "name": "CAMPassword",
          "value": "mypassword"
        }
      ]
    }
  2. List all uploaded files with GET /api/v1/files. The JSON response includes a list of files, including the modificationTime, id, defaultName, and defaultDescription for each file.
  3. List all custom extensions with GET /api/v1/extensions.
    The JSON response includes the following data for each available extension:
          "modificationTime": "2020-05-27T10:42:12.874Z",
          "defaultName": "CoffeeOperations",
          "id": "iBM4F2C3F9566416299FF024494C95FAB",
          "type": "customization",
          "tenantID": "",
          "version": 2,
          "links": [
            {
              "rel": "self",
              "type": "application/json",
              "href": "/api/v1/extensions/CoffeeOperations"
            }
  4. To delete the CoffeeOperations extension, you can submit the following request:
    DELETE /api/v1/extensions/CoffeeOperations
  5. To add a new extension, you can use POST /api/v1/extensions/file and specify your local extension in compressed (.zip) file format. Adding an extension can also be achieved using curl and adhering to the following syntax:
    curl -X POST -H "Content-Type: application/zip" --data-binary @/x/opt/ibm/cognos/c11/samples/extensions/CoffeeOperations.zip http://<cognos_analytics_server>/api/v1/extensions

Results

You learned how to authenticate, list files, and work with extensions using the Cognos Analytics REST API. Now you can explore other API endpoint usage scenarios, such as:
  • Updating capabilities
  • Moving and deleting content
  • Work with custom extensions and themes
  • Delete files
  • Create and update tenants
  • Add a user to a namespace

For a complete list of supported endpoints, refer to the REST API reference section or available API documentation embedded in your Cognos Analytics environment.