cancel
Showing results for 
Search instead for 
Did you mean: 

Consume REST SCIM API of SAP IAS

NizareDamoumat
Explorer
0 Kudos
145

Hello

I'd like to create a simple user management API to consume the SCIM API of SAP IAS. 

I got as a result : <html><body>No service was found.</body></html>

Here are the steps I followed :

1 - creation of a destination in CF :

NizareDamoumat_0-1728913781437.png

2 - setting my xs-app.json :

 

{
  "authenticationMethod": "route",

  "routes": [
    {
      "source": "^/api(.*)$",
      "target": "/api/$1",
      "destination": "IAS_Identity_Directory",
      "authenticationType": "xsuaa",
      "csrfProtection": false
    }
  ]
}

 

3 - updating the ui5-local.yaml :

 

# yaml-language-server: $schema=https://sap.github.io/ui5-tooling/schema/ui5.yaml.json

specVersion: "3.1"
metadata:
  name: com.vesi.zfamanage
type: application
server:
  customMiddleware:
    - name: fiori-tools-proxy
      afterMiddleware: compression
      configuration:
        ignoreCertError: false  # Ignore certificate errors for local development
        backend:
          - path: /api
            destination: IAS_Identity_Directory
    - name: fiori-tools-appreload
      afterMiddleware: compression
      configuration:
        port: 35729
        path: webapp
        delay: 300
    - name: fiori-tools-preview
      afterMiddleware: fiori-tools-appreload
      configuration:
        component: com.vesi.zfamanage
        ui5Theme: sap_horizon

 

4 - requesting the right path with a simple ajax call : 

 

        onInit: function () {
            this._fetchUsers();
        },

        _fetchUsers: function () {
            var sUrl = "/api/scim/Users";
            $.ajax({
                url: sUrl,
                method: "GET",
                contentType: "application/scim+json",
                dataType: "json",
                success: function (data) {
                    console.log("Users retrieved:", data);
                    MessageToast.show("Users retrieved successfully!");
                },
                error: function (err) {
                    console.error("Error fetching users:", err);
                    MessageToast.show("Error fetching users");
                }
            });
        }

 

I tried differents paths and approach without any success maybe I'm missing something on the connectivity part of BTP.
From Postman, I'm able to request the API.

Thank you in advance for your help! 🙂

Accepted Solutions (0)

Answers (2)

Answers (2)

WouterLemaire
Active Contributor
0 Kudos

You still need to assign the role to your site in the Site Directory. Once you've done that, it will create a role collection in BTP which you can assign to a CIS User Group or directly to a user, see documentation:

https://help.sap.com/docs/build-work-zone-standard-edition/sap-build-work-zone-standard-edition/assi... 

WouterLemaire
Active Contributor
0 Kudos

Can you check the network trace?

The url of your ajax call needs to be added to the hostname + unique id of the app and not just after the hostname. In that case, it won't be resovled by the approuter.