SAP Knowledge Base Article - Public

2936295 - How to create user by SAP Analytics Cloud User and Team Provisioning API

Symptom

 How to create user by SAP Analytics Cloud User and Team Provisioning API

Environment

  •  SAP Analytics Cloud 2020

Resolution

Using SAP Analytics Cloud User and Team Provisioning API, please refer to online document: 

https://help.sap.com/viewer/298f82da4b184d1fb825b7ffe365e94a/release/en-US/b687e9589b834a2db872414b0b8d3a12.html

Below is a sample which is using Postman to consuming this API to create new user for SAC

1. Open Postman and execute "Post" request with URL:
   
    The URL is: <Token URL>?grant_type=client_credentials
    You can get token URL from System > Administration > App Integration tab.

    Here is a example of the URL: https://oauthasservices-XXXXX.X1.hana.ondemand.com/oauth2/api/v1/token?grant_type=client_credentials

    Here's the list of parameters needed to input maunally for this request:

   1) grant_type: client_credentials (generated directly after input above URL)
   2) Authorization tab:

         Basic Auth: create a OAuth client ID and password from SAC , input the ID & secret here. (How to create OAuth client , refer to above API document link)

   3) Headers tab:

         x-sap-sac-custom-auth :true
         Content-type: application/json

     Then get result like below and please note down the access_token value:
                         {
                             "access_token": "xxxxxxxxxxxxxxxx",
                             "token_type": "Bearer",
                             "expires_in": 31104000,
                             "scope": ""
                          }

2. Execute "Get" request with URL  like:

   The URL is  <TenantRUL>api/v1/scim/Users
   Here is a example of the URL: https://xxx.xx1.sapbusinessobjects.cloud/api/v1/scim/Users

    Here's the list of parameters needed to input maunally for this request:

    1) Authorization tab:

        Bearer Token
        Token value: access token value generated in step 1

    2)Headers tab:

         x-sap-sac-custom-auth:true
         x-csrf-token: fetch

    Then you can find x-csrf-token from Headers tab of result, note down the value:
     x-csrf-token  xxxxxxxxx

3. Execute "POST" request use the URL:

   The URL is  <TenantRUL>api/v1/scim/Users
   Here is a example of the URL: https://xxx.xx1.sapbusinessobjects.cloud/api/v1/scim/Users

    Here's the list of parameters needed to input maunally for this request:

    1) Authorization tab:

        Bearer Token
        Token value: access token value generated in step 1

    2) Headers tab:

         x-csrf-token :xxxxxxxx(result in step2)
         x-sap-sac-custom-auth: true
 
     In body  > Raw, input the following sample code to create user, select "json" format:

     {
       "schemas": [
       "urn:ietf:params:scim:schemas:core:2.0:User",
       "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"
       ],
       "userName":"xxxxxx@xxx.com",
       "name":
      {
         "givenName":"xxx",
         "familyName":"xxxx"
       },
       "displayName":"xxxx",
       "emails":[
       {
         "value":"xxxxxx@xxx.com",
         "type":"work",
         "primary":true
       }
       ],
       "roles":[],
       "groups":[],
       "urn:scim:schemas:extension:enterprise:1.0": {
       "manager": {
       "managerId": ""
       }
       }
     }

Note

This sample includes an empty groups array. When creating user objects, you cannot use this array to do team assignment. You must use the /Groups endpoint to create or update team information.

See Also

Keywords

SAP Cloud for Planning, sc4p, c4p, cforp, cloudforplanning, Cloud for Analytics, Cloud4Analytics, CloudforAnalytics, Cloud 4 Planning, BOC, SAPBusinessObjectsCloud, BusinessObjectsCloud, BOBJcloud, BOCloud., SAC, SAP AC, Cloud-Analytics, CloudAnalytics, SAPCloudAnalytics,Error, Issue, System, Data, User, API, 401, 404, 200, 201,api, sdk, create user, creation, sample, sac, how to, postman, coding , KBA , LOD-ANA-BI , Business Intelligence Functionality, Analytic Models , How To

Product

SAP Analytics Cloud 1.0