cancel
Showing results for 
Search instead for 
Did you mean: 

SAP FSM 401 UNAUTHORIZED when calling cloud-org-level-service-api

samot
Participant
0 Kudos

Hi guys,

we are trying to update the OrganizationalStructure as per documentation - https://help.sap.com/docs/SAP_FIELD_SERVICE_MANAGEMENT/fsm_admin/org-structure.html?locale=en-US.

However, when we tried to test the following API call:

curl --location --request POST '[Base URL]/api/v1/levels/{level-id}/allocations' \
--header 'X-Client-ID: [client_id]' \
--header 'X-Client-Version: 1.0' \
--header 'Content-Type: application/json' \
--header 'X-Account-ID: [account_id]' \
--header 'X-Company-ID: [company_id]' \
--header 'Authorization: Bearer [bearer token]'--data-raw '{
"role": "MANAGER",
"unifiedPersonId": "ec990550-52f3-4aa3-b0b2-b952a886c302"
}'

We get the following response:

{
    "timestamp": "2022-06-29T14:09:53.650930Z",
    "status": "401 UNAUTHORIZED",
    "error": "ERROR_010: Access Denied",
    "message": "The authentication credentials are missing or invalid"
}

Could somebody show us how we should retrieve the authorization token for this API call? (currently we are using ClientId and ClientSecret)

View Entire Topic
nsax
Explorer
0 Kudos

Hi Tomas,

Thank you for your question.
The authorization token must be retrieved using the password grant type and providing a user which has the SUPERUSER role assigned.

You can find this in the Access section in the docs: https://help.sap.com/docs/SAP_FIELD_SERVICE_MANAGEMENT/fsm_admin/org-structure.html?locale=en-US

If something should not be clear feel free to get back to me.

Best
Nicolas

Nischitha03
Explorer
0 Kudos

Hi Nicolas,

I'm trying to update Organization structure in FSM using API call.

url : https://us.coresuite.com/cloud-org-level-service/api/v1/levels

Headers included: X-Client-ID, X-Client-Version, X-Account-ID and X-Company-ID.

However, I'm stuck with below error message.

{ "timestamp": "2023-05-22T11:10:02.181197878Z", "status": "405 METHOD_NOT_ALLOWED", "error": "ERROR_018: Request method not supported (method=POST)", "message": "The request method is not supported for the given uri (method=POST)"}

Is there any way to update the FSM organization structure using API call?

Thanks,

Nischitha