Create Operation

Last modified 27 Feb 2024 09:31 +01:00

Create With Rest

Request to create a midPoint object based on data provided in the body of the request.


Use either the HTTP POST or PUT method with your request. Based on the method used there are different requirements on the resulting URI:

Using the PUT method, the client has to provide a complete object, including the identifier (OID).

Create operation using HTTP PUT
PUT http://localhost:8080/midpoint/ws/rest/{endpoint}/{oid}

If you use the POST method to create new web resources, you can do this without the need to know the complete URI (i.e. without the oid identifier).

Create operation using HTTP POST
POST http://localhost:8080/midpoint/ws/rest/{endpoint}/


Regarding authorization type, the "Basic" Authorization header should be used.

Authorization header example replace {Base64EncodedCredentials} with the encoded credentials
Authorization: Basic {Base64EncodedCredentials}

In case of the create operation you need to specify the provided content type of the payload in the body:

Content type header example, other media types are supported as well
"Content-Type: application/json"
For supported media types please refer to the following section of the documentation

Supported Media Types



Example of usage of options:


In case of create with the use of the PUT method please have a look at the folowing links were you can find the options described:

Usable options for this type of operation


If you want to use the POST method please have a look at the following links were you can find the options described:

Usable options for this type of operation



Error code Meaning


Information. Stay tuned, operation is in progress.


Success. Operation finished successfully. There are two custom codes:

  • 250 for partial error which means that during processing some error occurred but some changes was executed.

  • 240 for handled error which means that there was originally error, but midPoint was able to fix this using its consistency mechanism.

In this two cases, midPoint returns the OperationResult where there details of executed operations can be found.


Redirection or "in progress". This is returned mostly to indicate two cases:

  • Operation has finished, but the results are not in this resource. Redirection is issues to point the client to the results. Typical example is creation of an object with POST to a collection web resource. In this case a new object is created, new URI is assigned and the client is redirected to this URI. Retrieving that URI provides created object and 200 status code, indicating that the operation is finished.

  • Operation is in progress (asynchronous operation). In this case midPoint API redirects the client to a task object that can be used to track progress of the operation.


Client errors. The client has sent request that cannot be processed. This indicates usual situation that are well handled by the midPoint code. Maybe the client request to create conflicting object, delete non-existent object, modification that violates the schema and so on. The OperationResult structure is usually provided in the response to provide more details about the situation.


Server errors. Situations that the server cannot handle and where the cause is unknown. This usually means bugs in the code, insufficient resources such as RAM or disk space, unforeseen failures in the infrastructure and so on. The OperationResult structure might or might not be provided in this case. Some errors are so severe that the structured error information might not be available.

Status codes and the indication of errors and asynchronous processing applies uniformly to all midPoint web resources (both RESTful and RPC).

Access Authorization



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