The SAP Service Manager API can be accessed using OAuth 2.0 access tokens issued for named users, which have the proper roles assigned to them.
-
Obtain the credentials for SAP BTP cockpit to access services from SAP Business Technology Platform in your subaccount. See Subscribing to SAP Service Manager [Feature Set A].
-
Assign the SAP Service Manager roles to the user. See Assign the Subaccount Service Administrator Collection.
For more information about the scopes included in each role, see SAP Service Manager Roles.
-
Get an access token:
curl 'https://service-manager.cfapps.<region domain>/v1/oauth/<subdomain>/token' -i -X POST -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: application/json' --data 'grant_type=password&username=<username>&password=< password>'If in Swagger, use your username and password. The subdomain is the subaccount subdomain, in which you would like to try the API. You can find it in the SAP BTP cockpit Overview tab of your subaccount.
See Enable API Access to an XSUAA Configuration.
The access token received also contains the scopes that are granted for this access token. Therefore, only APIs which require one of these scopes can be used with this access token.
{ "access_token": "<access_token>", "token_type": "bearer", "expires_in": 43199, "scope": "<xsappname>.job.read <xsappname>.event.read" } -
Add the Authorization header to your request: “Authorization: Bearer <access token>”.