Spend Management Blogs by SAP
Stay current on SAP Ariba for direct and indirect spend, SAP Fieldglass for workforce management, and SAP Concur for travel and expense with blog posts by SAP.
cancel
Showing results for 
Search instead for 
Did you mean: 
josie_n
Product and Topic Expert
Product and Topic Expert
0 Kudos

Part 2 – Calling Upload Connectors Using a Token

In this article we will show you how to call an upload connector using the token that we have obtained previously on Part 1.

 

HINT: Before doing any upload or download REST call you need to get a token first; in our example we use the Get Token request. And don’t forget to check if your environment is selected before calling the request.

To do that, just select any of your collection’s requests and check on the upper right of the screen if your environment is being used. On the example below the environment is not selected.

josie_n_1-1711129459469.png

Click on the dropdown list and select the environment you have created on Part 1 of this article.

josie_n_2-1711129513853.png

We will need the environment variables to get and pass the token, and to do our other connector calls.

 

Pre-Requisites

Before setting up your upload request make sure that you have your upload connector tuned on. Also, for this REST example, we’ll use JSON file format so make sure that you have JsonToCsvPreProcessor enabled. These configurations can be done using the Connector Wizard on Configuration Manager.

 

Creating an Upload Request

Click on the three dots on you collection name and chose New Request.

josie_n_3-1711131220053.png

Next a new window will open to add a Name and the URL. Give a name for your request and for the URL field we will use the base URL variable we have created, add /api/vc/connector/ , and at the end of it the custom connector name. After filling all fields click on Create.

josie_n_0-1711131329788.png

Once more we will fill the request tabs with information needed to perform a request.

  1. Headers - here we will just change the Content-Type to recognize the JSON file format and UTF-8 characters as following.

Click on Add Header and enter the information on the table below and then click on the Save button.

NameValue
Content-typeapplication/json;charset=UTF-8

josie_n_1-1711131955426.png

2. Auth - Here we will set the authentication type and pass the token obtained on Get Token request using the environment variables. Click on the dropdown list and select the authentication type Bearer Token. A field will show to add the token variable. Then click on Save.

josie_n_2-1711132019451.png

 

3. Body – Finally on the Body tab we paste the upload file content. First click on No Body dropdown list and pick the file type. In this example it will be JSON. Then click on Save.

josie_n_3-1711132078432.pngjosie_n_4-1711132105929.png

 

Testing

Now that we are all set let’s test our request.

First, let’s authenticate and get a token. Click on your Get Token request on the left panel or select the Get Token tab and then click on Send Request.

josie_n_5-1711132155570.png

If the request is successful, the token data will appear on the response body and will be transferred to our accessToken variable.

josie_n_6-1711132195816.png

Then select you upload request tab and let’s check if whether the token was transferred correctly. Click on the Auth tab and hover the cursor over the accessToken variable. The token value must be shown.

josie_n_7-1711132227833.png

Then click on Send Request to upload the data.

josie_n_8-1711132255247.png

Usebruno will make the request and show the log on the right side of the screen. On our example the request was successful (200) and the log is shown.

josie_n_9-1711132279849.png

 

Next Up

Part 3 – Calling Download Connectors Using a Token.

And If you missed how to get a token: Part 1 - Getting a Token.