Create User

Last modified 05 Feb 2024 11:58 +01:00
Table of Contents


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


Create a new User object in MidPoint with file data source
# Authenticating with the credentials "administrator" and password "y0uR_P455woR*d" on a localhost instance running on port 8080
curl --user administrator:y0uR_P455woR*d -H "Content-Type: application/json" -X POST http://localhost:8080/midpoint/ws/rest/users --data-binary @pathToMidpointGit\samples\rest\user-jack.json -v
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?
Thanks for your feedback