POST http://localhost:8080/midpoint/ws/rest/resources/{oid}/test
Resource Specific Operations
Description
A set of operations which are specific for objects of the "Resource" type residing on the "resources" endpoint.
Request
For the request you should use the HTTP POST method. The URI of the request itself depends on the type of operation. There are TWO types of operation requests which are described on this page.
POST http://localhost:8080/midpoint/ws/rest/resources/{oid}/import/{objectClass}
Headers
Regarding authorization type, the "Basic" Authorization header should be used.
Authorization: Basic {Base64EncodedCredentials}
To specify the provided content type, please use the "Content-Type" header payload in the body:
"Content-Type: application/json"
You might need to specify the accepted type of content in case you are interested in a format different from xml (default):
"Accept: application/json"
Body
The resource specific operations do not need to contain any specific payload data in the body of the request.
Options
There are no supported operation options for this type of operation.
Response
Error code | Meaning |
---|---|
1xx |
Information. Stay tuned, operation is in progress. |
2xx |
Success. Operation finished successfully. There are two custom codes:
In this two cases, midPoint returns the OperationResult where there details of executed operations can be found. |
3xx |
Redirection or "in progress". This is returned mostly to indicate two cases:
|
4xx |
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. |
5xx |
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
The interface authorization needed for executing this type of request. The authorization is needed to access the specific part of the interface. For more information please see this page.
-
http://midpoint.evolveum.com/xml/ns/public/security/authorization-rest-3#testResource
-
http://midpoint.evolveum.com/xml/ns/public/security/authorization-rest-3#importFromResource
Model Authorization
The model authorization for the specific action. This authorization is needed to request/execute the concrete action. The examples are usually quite broad, and the actions can be additionally specified for a more fine-grained authorization. For more information please see this page.
For the test operation:
-
http://midpoint.evolveum.com/xml/ns/public/security/authorization-model-3#test
For the import operation:
-
http://midpoint.evolveum.com/xml/ns/public/security/authorization-model-3#importFromResource
Examples
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:
curl --user administrator:y0uR_P455woR*d \
-H "Accept: application/json" \
-X POST http://localhost:8080/midpoint/ws/rest/resources/ef2bc95b-76e0-59e2-86d6-9999cccccccc/test \
-v
The response is an HTTP 200 code in case of success with a response body containing the operation result.
Example Output of "Test Resource object" example
The example is simplified, some properties were removed to keep the example output "short". This example does not contain all possible properties of this object type.
{
"@ns" : "http://prism.evolveum.com/xml/ns/public/types-3",
"object" : {
"@type" : "c:OperationResultType",
"operation" : "com.evolveum.midpoint.schema.constants.TestResourceOpNames.test",
"status" : "success",
"importance" : "normal",
"start" : "",
"end" : "",
"microseconds" :,
"invocationId" :,
"params" : {
"entry" : []
},
"token" :,
"partialResults" : [ {}, {} ]
}
}
curl --user administrator:y0uR_P455woR*d \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-X POST http://localhost:8080/midpoint/ws/rest/resources/ef2bc95b-76e0-59e2-86d6-9999cccccccc/import/AccountObjectClass \
-v
The response is an HTTP 303 code in case of success without a response body. Yet there is a location header which can be used for a redirect. The object which is referred is a task used for asynchronous execution of the import operation. Please see this link for more information on the tasks endpoint.
Location: http://localhost:8080/midpoint/ws/rest/tasks/31e60ee4-8bb9-4a8d-a001-88ef6191d4ee