This documentation applies to LEXolution version 9.7 and later.
This article explains how an application logs in to the LEXolution REST API.
The examples use Postman, which you can use to try out the interface. Set up
your access (client) beforehand — see Einrichtung
Lexolution REST-API im IAM. For a description of the available functions, refer to REST-API Referenz.
REST API Anmeldung 01REST API Anmeldung 01
"Service Provider Network" can also be the "Customer Network" if the service provider's application runs on-premises at your location.
"Service Provider Network" can also be the cloud.
If the service provider's software does not run on the same network as the LEXolution server (on-premises at your location), you will need to open the port for the LEXolution REST API. Only then can the service provider access it from outside.
Sample Application
STP provides the .NET sample application
LexolutionRestDemo.sln. It demonstrates how to log in to the
REST API as both a Public Client and a Confidential Client. It also includes
functional examples, such as creating a case file, an invoice, or an activity.
The sample application is available as a ZIP archive containing source code files.
You can open it with, for example, Visual Studio or JetBrains Rider. Before
running it, set a few constants in the code. You can obtain these settings
from STP or from your client. For more details, refer to the
Readme.md file in the solution.
Logging in with Postman
In Postman, set the Auth Type to
OAuth 2.0:
REST API Anmeldung 02REST API Anmeldung 02
In the following examples, replace stppde in the URLs
with your tenant name, and replace stp-cloud-dev.de with the
address of your production environment, for example stp-cloud.de or
stp-cloud.ch.
Logging in with a Confidential Client
To log in with a Confidential Client, set the
Grant type to Client Credentials and
configure the remaining fields as follows:
REST API Anmeldung 03REST API Anmeldung 03
Enter any name you like in the Token Name field.
For Grant type, select Client Credentials.
Enter the Access Token URL, using your tenant name and environment.
Enter the Client ID. This is the name (not the display name) of the application you previously set up in the Identity Admin. It may also be an automatically assigned GUID. Example:
REST API Anmeldung 04REST API Anmeldung 04
Enter the Client Secret. This is the secret you previously defined in the Identity Admin. Enter the Value (unhashed), which is only visible at the time of creation:
REST API Anmeldung 05REST API Anmeldung 05
In the Scope field, enter the desired scopes separated by spaces:
Scope
Effect
lexkms.read
Read-only access to the REST API
lexkms.access
Read and write access
kms.impersonation
Read or write as any LEXolution user
Leave the remaining settings at their default values.
Logging in with a Public Client
To log in with a Public Client, set the Grant
type to Authorization Code (With PKCE) and
configure the remaining fields as follows:
REST API Anmeldung 06REST API Anmeldung 06
Enter any name you like in the Token Name field.
For Grant type, select Authorization Code (With PKCE).
In the Callback URL field, enter one of the
Redirect URIs you previously configured in the Identity
Admin. It must match exactly.
Enter the Auth URL and the Access
Token URL, using your tenant name and environment. In the
example, these are
https://stppde.stp-cloud-dev.de/identity/connect/authorize
and
https://stppde.stp-cloud-dev.de/identity/connect/token.
Enter the Client ID. This is again the name (not the display name) of the application in the Identity Admin.
A Client Secret is not required for a Public Client.
In the Scope field, enter the desired scopes separated by spaces. You will need:
profile
openid
offline_access, if you want refresh tokens and have previously enabled them in the Identity Admin
email, if you need the email address in the ID token
at least one of the three LEXolution REST API scopes:
lexkms.read, lexkms.access, or
kms.impersonation
Leave the remaining settings at their default values.
Click Get new access token. The first time you click it, the interactive login screen will appear. Use Clear
cookies to delete saved login data and sign in again.
REST API Anmeldung 07REST API Anmeldung 07
Impersonation Using the Impersonation Header
As a Confidential Client, all reads and writes to the LEXolution REST API are performed as the technical system user
StpAdmin.
To read or write as one of the users set up in LEXolution, include a header containing the user's email address or XId. This requires the kms.impersonation scope:
Header
Value
UserLoginname
Email address of the desired LEXolution user
UserXId
XId of the desired LEXolution user
REST API Anmeldung 08REST API Anmeldung 08
This also works with a Public Client. In that case, you log in as the technical user and impersonate the actual user. The LEXolution server configuration setting
RestApiUserIdIsEmail is relevant for this.
Test Call: "Who Am I"
You can use Postman to check which user you are currently accessing the LEXolution REST API as. To do this, call the endpoint
…/MitarbeiterInfo/GetCurrentUser without any additional parameters:
REST API Anmeldung 09REST API Anmeldung 09
The response returns the Id, XId, and MitarbeiterId of the user. The StpAdmin user has no MitarbeiterId.
You can use the MitarbeiterId to retrieve further information about the employee, for example using
…/MitarbeiterInfo/GetMitarbeiterInfos1?ids=<MitarbeiterId>:
REST API Anmeldung 10REST API Anmeldung 10
------------------------------------------------------------------------------------------------------------------ This article has been automatically translated by an AI and may therefore contain errors.