RPC REST Endpoint

Last modified 13 Mar 2024 13:32 +01:00

Description

Here we are describing the RPC (Remote Procedure Call) endpoint in relation to midPoints REST API.

Endpoint
rpc/

Operations And Examples

The Remote Procedure Call endpoint gives you the possibility to execute commands and scripts of various nature on midPoint.

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:

Execute Script

Execute script with procedure call to recompute object on input
curl --user administrator:y0uR_P455woR*d \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-X POST http://localhost:8080/midpoint/ws/rest/rpc/executeScript \
-v \
--data-binary @./samples/rest/rpc-recompute-input-filter.json
Show data source example for "Execute script with procedure call to recompute object on input" | GitHub
{
  "@ns" : "http://midpoint.evolveum.com/xml/ns/public/model/scripting-3",
  "executeScript" : {
    "pipeline" : [ {
      "@element" : "action",
      "type" : "resolve"
    }, {
      "@element" : "action",
      "type" : "recompute"
    } ],
    "input" : {
      "value" : {
        "@type" : "c:ObjectReferenceType",
        "oid" : "a9885c61-c442-42d8-af34-8182a8653e3c",
        "type" : "UserType"
      }
    },
    "options" : {
      "continueOnAnyError" : "true"
    }
  }
}

The response is an HTTP 200 code in case of success with a response body.

Example Output of "Execute script with procedure call to recompute object on input" 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" : "http://midpoint.evolveum.com/xml/ns/public/common/api-types-3#ExecuteScriptResponseType",
    "output" : {
      "dataOutput" : {
        "item" : [ {
          "value" : {
            "@type" : "c:UserType",
            "oid" : "a9885c61-c442-42d8-af34-8182a8653e3c",
            "version" : "16",
            "name" : "Jack",
            "metadata" : {},
            "operationExecution" : [ {}, {}],
            "assignment" : [ {}, {} ],
            "iteration" : 0,
            "iterationToken" : "",
            "roleMembershipRef" : [ {}, {} ],
            "activation" : {},
            "emailAddress" : "jack@evolveum.com",
            "credentials" : {}
          },
          "result" : {
            "operation" : "com.evolveum.midpoint.model.impl.scripting.BulkActionsExecutor.process",
            "status" : "success",
            "importance" : "normal",
            "end" : "2024-02-19T12:05:26.393+01:00",
            "token" : 1000000000000004223
          }
        } ]
      },
      "consoleOutput" : "Recomputed user:a9885c61-c442-42d8-af34-8182a8653e3c(Jack)\n"
    },
    "result" : {
      "operation" : "executeScript",
      "status" : "success",
      "importance" : "normal",
      "start" : "2024-02-19T12:05:26.366+01:00",
      "end" : "2024-02-19T12:05:26.393+01:00",
      "microseconds" : 26863,
      "invocationId" : 17478,
      "token" : 1000000000000004219,
      "partialResults" : [ {} ]
    }
  }
}

Generate and Validate Value

Validate Value on Input Procedure Call
curl --user administrator:y0uR_P455woR*d \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-X POST http://localhost:8080/midpoint/ws/rest/rpc/validate \
-v \
--data-binary @./samples/rest/policy-items-password-validate.json
Show data source example for "Validate value on input procedure call" | GitHub
{
  "policyItemsDefinition": {
    "policyItemDefinition": {
      "value": "5ecr3t5AbC",
      "valuePolicyRef" :{
        "oid": "00000000-0000-0000-0000-000000000003"
      }
    }
  }
}

The response is an HTTP 200 code in case of success with a response body.

Example Output of "Validate value on input procedure call" 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" : "http://midpoint.evolveum.com/xml/ns/public/common/api-types-3#PolicyItemsDefinitionType",
    "policyItemDefinition" : [ {
      "valuePolicyRef" : {
        "@type" : "c:ObjectReferenceType",
        "oid" : "00000000-0000-0000-0000-000000000003"
      },
      "value" : "5ecr3t5AbC",
      "result" : {
        "operation" : "validateValue",
        "status" : "success",
        "importance" : "normal",
        "start" : "",
        "end" : "",
        "microseconds" : ,
        "invocationId" : ,
        "token" : ,
        "partialResults" : [ {}, {
          "operation" : "com.evolveum.midpoint.model.api.ModelInteractionService.validateValue.value",
          "status" : "success",
          "importance" : "normal",
          "start" : "",
          "end" : "",
          "microseconds" : ,
          "invocationId" : ,
          "params" : {
            "entry" : [ {
              "@ns" : "http://midpoint.evolveum.com/xml/ns/public/common/common-3",
              "paramValue" : {
                "@type" : "xsd:string",
                "@value" : "5ecr3t5AbC"
              },
              "key" : "valueToValidate"
            } ]
          },
          "token" : ,
          "partialResults" : [ {
            "operation" : "com.evolveum.midpoint.model.common.stringpolicy.ObjectValuePolicyEvaluator.validateValue",
            "status" : "success",
            "importance" : "",
            "start" : "",
            "end" : "",
            "microseconds" : ,
            "invocationId" : ,
            "token" : ,
            "partialResults" : [ {
              "operation" : "com.evolveum.midpoint.model.common.stringpolicy.ValuePolicyProcessor.stringPolicyValidation",
              "status" : "success",
              "importance" : "normal",
              "start" : "",
              "end" : "",
              "microseconds" : ,
              "invocationId" : ,
              "params" : {
                "entry" : [ {
                  "@ns" : "http://midpoint.evolveum.com/xml/ns/public/common/common-3",
                  "paramValue" : {
                    "@type" : "xsd:string",
                    "@value" : "Default Password Policy"
                  },
                  "key" : "policyName"
                } ]
              },
              "token" : 1000000000000005240,
              "partialResults" : [ {}, {
                "operation" : "Tested limitation: Lowercase characters",
                "status" : "success",
                "importance" : "normal",
                "end" : "",
                "token" :
              }, {
                "operation" : "Tested limitation: Uppercase characters",
                "status" : "success",
                "importance" : "normal",
                "end" : "",
                "token" :
              }, {
                "operation" : "Tested limitation: Numeric characters",
                "status" : "success",
                "importance" : "normal",
                "end" : "",
                "token" :
              }, {
                "operation" : "Tested limitation: Special characters",
                "status" : "success",
                "importance" : "normal",
                "end" : "",
                "token" :
              } ]
            } ]
          } ]
        } ]
      }
    } ]
  }
}

Common Use-case Examples

JSON Example

Show JSON Example
{
  "@ns" : "http://prism.evolveum.com/xml/ns/public/types-3",
  "object" : {
    "@type" : "http://midpoint.evolveum.com/xml/ns/public/common/api-types-3#ExecuteScriptResponseType",
    "output" : {
      "dataOutput" : {
        "item" : [ {
          "value" : {
            "@type" : "c:UserType",
            "oid" : "a9885c61-c442-42d8-af34-8182a8653e3c",
            "version" : "16",
            "name" : "Jack",
            "metadata" : {},
            "operationExecution" : [ {}, {}],
            "assignment" : [ {}, {} ],
            "iteration" : 0,
            "iterationToken" : "",
            "roleMembershipRef" : [ {}, {} ],
            "activation" : {},
            "emailAddress" : "jack@evolveum.com",
            "credentials" : {}
          },
          "result" : {
            "operation" : "com.evolveum.midpoint.model.impl.scripting.BulkActionsExecutor.process",
            "status" : "success",
            "importance" : "normal",
            "end" : "2024-02-19T12:05:26.393+01:00",
            "token" : 1000000000000004223
          }
        } ]
      },
      "consoleOutput" : "Recomputed user:a9885c61-c442-42d8-af34-8182a8653e3c(Jack)\n"
    },
    "result" : {
      "operation" : "executeScript",
      "status" : "success",
      "importance" : "normal",
      "start" : "2024-02-19T12:05:26.366+01:00",
      "end" : "2024-02-19T12:05:26.393+01:00",
      "microseconds" : 26863,
      "invocationId" : 17478,
      "token" : 1000000000000004219,
      "partialResults" : [ {} ]
    }
  }
}
Was this page helpful?
YES NO
Thanks for your feedback