Using Postman to interact with CluedIn API
Dall-E

Using Postman to interact with CluedIn API

CluedIn provides a powerful set of REST and GraphQL APIs. You can use them to ingest data to CluedIn, export data from CluedIn, migrate configuration, etc. As CluedIn is a web application with web UI (client) and API (server), you can do API anything you do via UI.

Everything we will do in this article can be done in any programming language, command-line tools like curl and wget, UI apps like Insomnia or Nightingale, and many others. However, we will use Postman, which is probably the most popular tool for working with APIs.

So, let's spinup a CluedIn instance, open Postman, and begin.

Environment setup

First, we need a CluedIn instance, of course. I have mine at: https://foobar.172.167.52.102.sslip.io/.

Article content

If we look at this URL, the subdomain foobar is a so-called "organization name" — you need to know it because technically, you can have multiple "organizations" configured on the same CluedIn instance so users, settings and data from one organization are isolated from another.

The 172.167.52.102.sslip.io part is the main domain of your CluedIn instance that you automatically get when you install CluedIn from Azure Marketplace. (of course, you can configure it to your domain, like mdm.contoso.com)

Now, in Postman, you can create your collection or import the one that I use daily: https://github.com/romaklimenko/cluedin/blob/main/postman/CluedIn.postman_collection.json.

In the next step, let's create a new Environment that will keep the domain and credentials configuration. If you use the template from here: https://github.com/romaklimenko/cluedin/blob/main/postman/CluedIn-%20Home.postman_environment.json, you only need to change a few things:

Article content

  • domain — in my case, it's 172.167.52.102.sslip.io.
  • org_name — organization name, foobar in my case.
  • protocol — must be https if you don't run CluedIn in Docker on your local machine.
  • org_name — foobar in my case.
  • user_email and password — obviously, the email and the password. Some APIs require an access token generated for a user account, but some can work with API tokens you can generate in UI. For the last, you can skip email and password configuration.

Finally, the environment contains some predefined URLs:

  • org_url: {{protocol}}://{{org_name}}.{{domain}} - becomes https://foobar.172.167.52.102.sslip.io - we will reuse this URL to build every CluedIn API URL we need.
  • auth_url: {{org_url}}/auth - transforms to https://foobar.172.167.52.102.sslip.io/auth - used to login with email and password, to create users and so on.
  • api_url: {{org_url}}/api/api - transforms to https://foobar.172.167.52.102.sslip.io/api/api - where the most APIs live.
  • graphql_api_url: {{api_url}}/graphql - https://foobar.172.167.52.102.sslip.io/api/api/graphql the GraphQL endpoint you can use to export data from CluedIn. This endpoint works with an API token you can generate in CluedIn UI.
  • graphql_url: {{org_url}}/graphql - https://foobar.172.167.52.102.sslip.io/graphql - the GraphQL endpoint used for UI operations. This endpoint does not work with API tokens - you must use your user's access token.

Get a token

We have the Postman environment; let's try to "log in" with Postman, i.e., call the API to get the user's access token.

To do so, call the "Get a Token" endpoint:

Article content

Congratulations! The request is successful. And if you check the environment now, you will find a few new variables added automatically:

Article content

  • access_token — the JWT token to access CluedIn API.
  • refresh_token — the token you can use to refresh the access token.
  • org_id — a special identifier of the token's context used in some calls, so you don't have to get it separately.

Call CluedIn APIs

Now you can call CluedIn APIs. For example, try calling "Get Schema" to get the full list of CluedIn Vocabulary keys and their mappings:

Article content

Conclusion

To summarize and give a few recommendations:

  • Everything you can do via CluedIn UI, you can automate by calling APIs.
  • To explore how an API request is sent from UI, use the Network tab in your browser and an extension like GraphQL Network Inspector.
  • CluedIn Documentation Portal is updated regularly — there is a lot of useful information there.

To view or add a comment, sign in

More articles by Roman Klimenko

  • Using Pandas, Polars, and DuckDB for the same task

    As a regular Pandas user, I am usually satisfied with its performance. It can handle millions of records in minutes on…

    2 Comments
  • CluedIn Data Modeling 101

    This article covers the most important concepts you must understand when modeling data in CluedIn. I will use…

  • The magic of CluedIn

    IPython, the command shell behind Jupyter notebooks, provides an awesome feature called magics. In short, you can skip…

    1 Comment
  • Using CluedIn GraphQL API to automate UI actions

    CluedIn, as a Master Data Management system, encourages users to work with data using a UI and low-code approach. You…

  • Search Entities with CluedIn Python SDK

    In the latest release of CluedIn Python SDK, I added an improvement related to the GraphQL Search API; now is a good…

    1 Comment
  • Recording sleep sounds

    Sleep audio recording apps have recently become very popular. I was also curious to hear what I say when I sleep and…

Explore content categories