Communications Mining
latest
false
Banner background image
Communications Mining Developer Guide
Last updated Apr 10, 2024

Using the API

Welcome to the Communications Mining API. We strive to make the API predictable, easy to use and painless to integrate. If there is anything you feel we can do to improve it or if you encounter any bugs or unexpected behavior, please contact support and we will get back to you as soon as possible.

You can see all available endpoints in the API Reference. There is also an API Tutorial.

API Endpoint

All API requests are sent to Communications Mining as JSON objects to your tenant endpoint over HTTPS.

Tenants onboarded via UiPath:

https://cloud.uipath.com/<my_uipath_organisation>/<my_uipath_tenant>/reinfer_/api/...https://cloud.uipath.com/<my_uipath_organisation>/<my_uipath_tenant>/reinfer_/api/...

Tenants onboarded via Communications Mining:

https://<mydomain>.reinfer.io/api/...https://<mydomain>.reinfer.io/api/...
Important:

DEVELOPMENT AND PRODUCTION ENVIRONMENTS

In Communications Mining, development and production data and workflows can be separated either by having separate tenants, or by placing them in separate projects in the same tenant. In each case the data access is permissioned separately (so that developers can have admin access to development data while stricter controls can be placed on production). If using separate tenants then the API endpoint is different for each of development and production data; if using separate projects in the same tenant then that single tenant's endpoint is used for both.

Authentication

All API requests require authentication to identify the user making the request. Authentication is provided through an access token. The developer access token can be obtained from your Manage Account page.

Note:

You can have only one API token active at a time. Generating a new token will invalidate the previous one.

You need to include the following HTTP header for every API call you make, where $REINFER_TOKEN is your Communications Mining API token.
Authorization: Bearer $REINFER_TOKENAuthorization: Bearer $REINFER_TOKEN
The bash examples in the API Reference assume that you have saved your token in an environment variable. The Python and Node examples in the API Reference assume that the token has been stored in a local variable REINFER_TOKEN via your chosen config solution.
  • Bash
    curl -X GET 'https://<my_api_endpoint>/api/...' \
        -H "Authorization: Bearer $REINFER_TOKEN"curl -X GET 'https://<my_api_endpoint>/api/...' \
        -H "Authorization: Bearer $REINFER_TOKEN"
  • Node
    const request = require("request");
    
    request.get(
      {
        url: "https://<my_api_endpoint>/api/...",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );const request = require("request");
    
    request.get(
      {
        url: "https://<my_api_endpoint>/api/...",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );
  • Python
    import json
    import os
    
    import requests
    
    response = requests.get(
        "https://<my_api_endpoint>/api/...",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))import json
    import os
    
    import requests
    
    response = requests.get(
        "https://<my_api_endpoint>/api/...",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))
    
  • Response
    {
      "status": "ok"
    }{
      "status": "ok"
    }

Permissions

Each API endpoint in the API Reference lists its required permissions. You can view the permissions you have by going to your Manage Account page. The page shows the Projects you have access to and the Permissions you have in each project.

Errors

We use conventional HTTP response codes to indicate success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that resulted from the provided request and codes in the 5xx range indicate a problem with the Communications Mining platform.
Requests that error will also return a body with a status value of error instead of ok, and an error message describing the error.
  • Bash
    curl -X GET 'https://<my_api_endpoint>/api/v1/nonexistent_page' \
        -H "Authorization: Bearer $REINFER_TOKEN"curl -X GET 'https://<my_api_endpoint>/api/v1/nonexistent_page' \
        -H "Authorization: Bearer $REINFER_TOKEN"
    
  • Node
    const request = require("request");
    
    request.get(
      {
        url: "https://<my_api_endpoint>/api/v1/nonexistent_page",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );const request = require("request");
    
    request.get(
      {
        url: "https://<my_api_endpoint>/api/v1/nonexistent_page",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );
  • Python
    import json
    import os
    
    import requests
    
    response = requests.get(
        "https://<my_api_endpoint>/api/v1/nonexistent_page",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))import json
    import os
    
    import requests
    
    response = requests.get(
        "https://<my_api_endpoint>/api/v1/nonexistent_page",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))
    
  • Response
    {
      "message": "404 Not Found",
      "status": "error"
    }{
      "message": "404 Not Found",
      "status": "error"
    }

Note that your request can fail due to issues in your network before it reaches Communications Mining. In such cases the response you receive will look different from the Communications Mining error response described above.

Performance Timing

We use the Server-Timing HTTP header to communicate the time taken for requests to our API to be processed. We include a single metric, total, which you can use to measure how long our platform took to process your request free from latency of the network request.

An example of the header as it will be seen in a response:

Server-Timing: total;dur=37.7Server-Timing: total;dur=37.7
Server-Timing values are always in milliseconds, so in this case the API request with this header value took 37.7 milliseconds to process on our platform.
  • API Endpoint
  • Authentication
  • Permissions
  • Errors
  • Performance Timing

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.