Chat now with support
Chat with Support

Identity Manager 9.1.3 - REST API Reference Guide

Run script request

To run a script, use the URL <baseURL>/api/script/{name}.

Table 48: Run script request

HTTP method

URI

Body

Put

<BaseURL>/api/script/{name}

{

"parameters": [

"Parameter value"],

"base": "XObjectKey",

"value": "Sample value",

"returnRawResult": true

}

Table 49: Run script parameters

Parameter

Description

Parameter type

Data type

name

Script name (required).

path

string

parameters

Script parameters.

body

object[]

base

Object key of base object.

body

string

value

Content of the value variable in the script.

body

object

returnRawResult

Allow to return the raw object or string as result.

body

boolean

Body schema:

ScriptParameters {

parameters (object, optional),

base (string, optional): Object key of base object,

value (object, optional): Content of the Value variable in the script

}

Response schema:

ScriptResult {

result (object, optional): Return value of the script,

value (object, optional): Content of the Value variable in the script

}

Example 1:

https://<Hostname>/AppServer/api/script/QER_GetWebBaseURL

Body:

{}

Response:

{

"result": "https://<Hostname>/IdentityManager/"

}

Example 2:

https://<Hostname>/AppServer/api/script/VI_AE_BuildCentralAccount

Body:

{

"parameters": [

"f79c30fd-87bb-4958-a812-0683ddcac7c9",

"Adams",

"David"

]

}

Response:

{

"result": "DAVIDA"

}

Example 3:

https://<Hostname>/AppServer/api/script/VI_AE_BuildCentralAccount

Body:

{

"parameters": [

"f79c30fd-87bb-4958-a812-0683ddcac7c9",

"Adams",

"David"

],

"returnRawResult": true

}

Response:

{

"result": "DAVIDA"

}

Windows PowerShell sample

# Construct auth json

$authdata = @{AuthString="Module=DialogUser;User=<user name>;Password="}

$authJson = ConvertTo-Json $authdata -Depth 2

 

# Login (important, pass the NAME for your session variable in -SessionVariable)

Invoke-RestMethod -Uri "https://<Hostname>/AppServer/auth/apphost" -Body $authJson.ToString() -Method Post -UseDefaultCredentials -Headers @{Accept="application/json"} -SessionVariable wsession -ContentType "application/json"

 

# Do stuff (always pass -WebSession and use the variable you NAMED in the previous step)

 

# Sample 1: Load collection using Post method

$body = @{where="LastName like 'B%'";orderBy="LastName ASC, FirstName DESC"} | ConvertTo-Json

Invoke-RestMethod -Uri "https://<Hostname>/AppServer/api/entities/Person?loadType=ForeignDisplays" -WebSession $wsession -Method Post -Body $body -ContentType application/json

 

# Sample 2: Create a new object and return URI of new object

$body = @{values=@{FirstName="Jeremia";LastName="Bodewell";IsExternal=1;BirthDate="1993-05-14";Gender=1}} | ConvertTo-Json

$newURI = (Invoke-RestMethod -Uri "https://<Hostname>/AppServer/api/entity/Person" -WebSession $wsession -Method Post -Body $body -ContentType application/json).uri

 

# Sample 3: Get all properties for new object

(Invoke-RestMethod -Uri $newURI -WebSession $wsession -Method Get -ContentType application/json).Values

 

# Sample 4: Update the new object

$body=@{values=@{LastName="Garibaldi";IsExternal=0;ExitDate="2021-12-16T14:24:32.424Z";PersonalTitle="Administration (EMEA)"}} | ConvertTo-Json

Invoke-RestMethod -Uri $NewURI -WebSession $wsession -Method Put -Body $body -ContentType application/json

 

# Sample 5: Delete the new object

Invoke-RestMethod -Uri $NewURI -WebSession $wsession -Method Delete -ContentType application/json

 

# Logout

Invoke-RestMethod -Uri "https://<Hostname>/AppServer/auth/logout" -WebSession $wsession -Method Post -ContentType "application/json"

Related Documents

The document was helpful.

Select Rating

I easily found the information I needed.

Select Rating