0% found this document useful (0 votes)
9 views3 pages

Apiuser Workzone

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views3 pages

Apiuser Workzone

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

7/23/2024

SAP Build Work Zone, standard edition


Generated on: 2024-07-23 15:59:34 GMT+0000

SAP Build Work Zone, standard edition | Cloud

PUBLIC

Original content: https://help.sap.com/docs/WZ_STD/8c8e1958338140699bd4811b37b82ece?locale=en-


US&state=PRODUCTION&version=Cloud

Warning

This document has been generated from the SAP Help Portal and is an incomplete version of the official SAP product
documentation. The information included in custom documentation may not re ect the arrangement of topics in the SAP Help
Portal, and may be missing important aspects and/or correlations to other topics. For this reason, it is not for productive use.

For more information, please visit the https://help.sap.com/docs/disclaimer.

This is custom documentation. For more information, please visit the SAP Help Portal 1
7/23/2024

User API Service


The application router exposes a user API that returns the details of the users who are logged in to the application.

The user API supports two endpoints:

/currentUser : returns all details of logged in users

/attributes: returns the main user properties

 Note
Returning content-type in a response has now been updated according to common API standards. The user-api
is now returning “content-type = application/json”, which may require an adjustment to HTML5
applications coding such as removing the JSON.parse code, as this will be done automatically.

The /currentUser endpoint response has the following format:

 Sample Code

```
{
"firstname": "John",
"lastname": "Doe",
"email": "[email protected]",
"name": "[email protected]",
"displayName": "John Doe ([email protected])"
}
```

The /attributes endpoint response has the following format:

 Sample Code

```
{
"firstname": "John",
"lastname": "Doe",
"email": "[email protected]",
"name": "[email protected]"
}
```

 Note
The "name" property is the user ID in the identity provider, which in many cases is also the email address.

Con guring the User API Service in the Routing Con guration File
The user API can be implemented by modelling an xs-app.json route using the sap-approuter-userapi service .

This is custom documentation. For more information, please visit the SAP Help Portal 2
7/23/2024
The following example handles both endpoints:

 Sample Code

{
"source": "^/user-api(.*)",
"target": "$1",
"service": "sap-approuter-userapi"
}

The following example uses only the /currentUser endpoint:

 Sample Code

{
"source": "^/user-api/currentUser$",
"target": "/currentUser",
"service": "sap-approuter-userapi"
}

Related Information
routes

This is custom documentation. For more information, please visit the SAP Help Portal 3

You might also like