Showing results for 
Search instead for 
Did you mean: 

"401 Unauthorized" error when accessing SAP Cloud ALM Pull API for Analytics

0 Kudos

Hi there,

I want to call a "Pull API" in SAP Cloud ALM, f. ex. the REST Data Interface "List of Data Providers". How can I send the OAuth-"access_token" with my HTTPS request to access the SAP Cloud ALM API resource endpoint?

I tried passing the "access_token" in the header of the request with key "authorizations", but that fails with error "401 Unauthorized". I tried again passing the "access_token" value with the key "APIKey" in the header of the request, but it failed with the same error. No matter what I try, I get always the "401 Unauthorized" error.

FYI: I updated the scope in our Service Instance “eh-cloudalm-api-instance” like the Sample Code example.

I also checked these: 

Learn more about the SAP Support user and program here.
View Entire Topic
0 Kudos

There are at several causes for this issue. The causes and their resolutions are fully documented in KBA 3435224

Based on your description, it sounds like there are at least 2 factors impacting the error:

  1. You are not properly passing the "access_token" as an OAuth Bearer token for the request.
  2. You are not using a proper "APIKey" value.

Make sure that your REST API client app (Postman, etc.) has an option to add "Auth"/"Authorization" parameters to the Request. The type must be set to the correct type for the "access_token" value ("OAuth", "Bearer", "Bearer Token" etc.). Please refer to the documentation for your REST API client app (Postman, etc.) for instructions on how to properly pass OAuth Bearer tokens to requests.

The API Key can be taken either from the "Try Out" page on the SAP Business Accelerator Hub. The key "APIKey" must be passed in the header of the request with the value of the API Key.