Create User

Last modified 13 Mar 2024 13:32 +01:00
Table of Contents

Description

Example of creating an midPoint object representing some identity data in the form of a new User type object

For the purpose of the sample we are using the CURL tool as it is a well maintained, well tested, and it’s widely accessible.

The body of the request will contain data from an external configuration file, the data will be inserted into the request via native Curl commands.

If you are using file as a source for the data in the REST call with curl, please, don’t forget to use '@' before the path to your file.

Sometimes the newlines are not correctly handled during the transfer. (See MID-5229.) If that occurs, please use --data-binary instead of -d.

Authentication methods used to work with the REST api

Authentication methods

Example

In our examples we are authenticating with the credentials, name "administrator" and password "y0uR_P455woR*d" on a localhost instance running on port 8080.

For some help regarding the REST examples please see this link:

Create a new User object in MidPoint with file data source
curl --user administrator:y0uR_P455woR*d \
-H "Content-Type: application/json" \
-X POST http://localhost:8080/midpoint/ws/rest/users \
-v \
--data-binary @./samples/rest/user-jack.json
Show data source example for "Create a new User object in MidPoint" | GitHub
{
  "user": {
    "name": "jack",
    "fullName": "Jack Sparrow",
    "givenName": "Jack",
    "familyName": "Sparrow"
  }
}

The response is an HTTP 201 code in case of success without a response body. Also, the response contains a Location Header pointing to the location of the created user.

Example location header
 # Location: http://localhost:8080/midpoint/ws/rest/users/e4b0c81e-7fc7-462d-a92c-b3e0b10b8b49
Was this page helpful?
YES NO
Thanks for your feedback