BigID API/API Tutorial: Difference between revisions

From BigID Developer Portal
No edit summary
No edit summary
Line 5: Line 5:
* How to use a BigID token to receive data from BigID
* How to use a BigID token to receive data from BigID
{{Box/end}}
{{Box/end}}
The BigID API allows you to perform all the actions you're used to performing via the BigID user interface programmatically. In order to communicate with BigID over its API, we first need to authenticate ourselves.


== Authenticating with BigID ==
== Authenticating with BigID ==
The BigID API allows you to perform all the actions you're used to performing via the BigID user interface programmatically. In order to communicate with BigID over its API, we first need to authenticate ourselves.


There are two ways to authenticate ourselves to BigID:
There are two ways to authenticate ourselves to BigID:
Line 22: Line 22:
<iframe style="border:0px; width:100%; height:300px; border-radius:10px;" src="https://apibrowser.mybigid.com/?url=sessions&method=POST&body=%7B%22username%22%3A%22bigid%22%2C%22password%22%3A%22bigid111%22%7D&selectedSetting=body"></iframe>
<iframe style="border:0px; width:100%; height:300px; border-radius:10px;" src="https://apibrowser.mybigid.com/?url=sessions&method=POST&body=%7B%22username%22%3A%22bigid%22%2C%22password%22%3A%22bigid111%22%7D&selectedSetting=body"></iframe>
</html>
</html>
In the response, there's a bunch of information about the logged in user. For our purposes, we just care about line 4, the auth_token. This token is what we'll use the authenticate with the other BigID APIs.


<syntaxhighlight lang="JSON" line highlight="4">
<syntaxhighlight lang="JSON" line highlight="4">
Line 27: Line 29:
     "success": true,
     "success": true,
     "message": "Enjoy your token!",
     "message": "Enjoy your token!",
     "auth_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX25hbWUiOiJiaWdpZCIsInR5cGUiOiJhY2Nlc3MtdG9rZW4iLCJyb2xlSWRzIjpbIjVkOTNlODYwNWJjODhlMDAxYWY4MjhjMyJdLCJpc0FkbWluIjp0cnVlLCJpYXQiOjE2MzQxNjYyNzQsImV4cCI6MTYzNDI1MjY3NH0.26w4heuqd2D48E3AggFUKdfGbG2rIYsFlhOqzOZiOec",
     "auth_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX25hbWUiOiJiaWdpZCIsInR5cGUiOiJhY2Nlc3MtdG9rZW4iLCJyb2xlSWRzIjpbIjVkOTNlODYwNWJjODhlMDAxYWY4MjhjMyJdLCJpc0FkbWluIjp0cnVlLCJpYXQiOjE2MzQxNjYyNzQsImV4cCI6MTYzNDI1MjY3NH0...",
     "username": "bigid",
     "username": "bigid",
     "firstName": "BigID Admin",
     "firstName": "BigID Admin",

Revision as of 02:09, 14 October 2021

In this article, you'll learn:

  • How to get a BigID token using a REST API call
  • Where to find the BigID API documentation
  • How to use a BigID token to receive data from BigID

The BigID API allows you to perform all the actions you're used to performing via the BigID user interface programmatically. In order to communicate with BigID over its API, we first need to authenticate ourselves.

Authenticating with BigID

There are two ways to authenticate ourselves to BigID:

  • Username and Password - This is the easiest way to authenticate to BigID. You provide a username and password to the /sessions endpoint and BigID will return a session token that is valid for any other API endpoints (given that user has permissions to access them) for 24 hours.
  • User Token - A user token (generated from Administration -> Access Management by a System Administrator) allows you to access BigID by exchanging a user token for a session token at the /refresh endpoint. This means you don't have to store your username and password within an application, but user tokens are only valid for a maximum of 999 days.

In this tutorial, we're going to authenticate with BigID using Username/Password auth and retrieve a list of data sources.

Below you'll see the POST request we'll use to authenticate. The body of the request contains our username and password and we're directing the request to the sessions endpoint in our BigID Sandbox system. Press Send to get a session token.

In the response, there's a bunch of information about the logged in user. For our purposes, we just care about line 4, the auth_token. This token is what we'll use the authenticate with the other BigID APIs.

{
    "success": true,
    "message": "Enjoy your token!",
    "auth_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX25hbWUiOiJiaWdpZCIsInR5cGUiOiJhY2Nlc3MtdG9rZW4iLCJyb2xlSWRzIjpbIjVkOTNlODYwNWJjODhlMDAxYWY4MjhjMyJdLCJpc0FkbWluIjp0cnVlLCJpYXQiOjE2MzQxNjYyNzQsImV4cCI6MTYzNDI1MjY3NH0...",
    "username": "bigid",
    "firstName": "BigID Admin",
    "permissions": [
        "admin",
        "permission.tasks.edit",
        "permission.tasks.read_task_list",
...