Part 1 - Getting a Token
Creating a Collection
Before start to setting up the REST calls we are goint to create a Collection. You can create a Collection clicking on the tree dots on the left panel and choosing Create Collection or click on Create Collection link on Usebruno start page.
Then a window will open to add a Name for the Collection. Then click on Browse to chose a folder to save you collection data and click on Create.
Now that a collection is created, we can set up an environment so we can pass the token to our connector call.
Setting Up Environment
Environment can be used to create variables that can be used to set constants or to pass data from a request to another. To do that click on the three dots on you collection name and chose Settings.
Usebruno will open a window with the collection data. Click on the dropdown list that shows No environment top right. Then click on Configure. This same dropdown list will be used later to use your environment data.
You can chose between creating a new environment manually or import environment data. For this example we will Create Environment manually.
The app will ask a name for your environment. For this example I will use the name of the collection. Then click on Create.
On the next screen we will create the variables that will be used. Click on Add Variable.
We will create the following variables:
After adding all variables, click on Save.
The next step is to create a call to obtain the token. Click on the three dots on you collection name and chose New Request.
Next a new window will open to add a Name and the URL. For the URL field we will use the base URL variable we have created and add /api/oauth2/v2.0/token at the end of it. After filling all fields click on Create.
Note: To get a token the method is POST.
Now we will fill the request tabs with information needed to get a token.
Name | Value |
grant_type | client_credentials |
response_type | token |
2. Headers - here we will add the data below. For the APIKey we will use our environment variable. And for the Content-Type just type value below. Click on Add Header to add the values and when you finish click on Save.
Name | Value |
x-api-key | {{apiKey}} |
Content-type | application/json |
3. Vars - on this tab we will add the credentials to get the token and read the response from the body. Fill this tab as following:
Pre Request:
Name | Value |
username | your integration user |
password | password for your user |
Post Request:
Name | Expr |
accessToken | res.body.access_token |
4. Auth - this is the last tab. Here we will set the authentication type and reference the creadentials variables created on Vars tab. Click on the dropdown list and select Basic Auth. The Username and Password fields will show. Fill them referecing the variables created. Then click on Save.
After filling all needed tabs it's time to test the request clicking on the arrow beside the Save button.
Then Fieldglass will answer the resquest with the Bearer Token. This token will be saved on the variable we have created on our environment and defined on Vars tab.
Next Up
Part 2 – Calling Upload Connectors Using a Token.
Part 3 – Calling Download Connectors Using a Token.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
15 | |
12 | |
12 | |
11 | |
11 | |
9 | |
9 | |
9 | |
7 | |
6 |