24. One Identity API
22 января 2020 г.
10:41
Api Designer
Примеры
QBM\dvd\AddOn\ApiSamples
Включить Debug App server
В web.config
\<add key="debugmode" value="true"/>
#Run script
\$Param1 = "465e6cb3-7a7d-41ec-9690-21963867a256"
\$Param2 = "d6d14a3a-c8fd-46fe-9daf-9a61a8d4180d"
\$Param3 = "True"
\$Param4 = "OK"
\$body1 = @{parameters = @("465e6cb3-7a7d-41ec-9690-21963867a256", "d6d14a3a-c8fd-46fe-9daf-9a61a8d4180d", "True", "OK") } | ConvertTo-Json
\$newURI = (Invoke-RestMethod -Uri "https://t-oneim-4.domain/AppServer/api/script/CCC_MakeDecision" -WebSession \$wsession -Method Put -Body \$body1 -ContentType "application/json; charset=utf-8").uri
Рабочий вариант (надо указывать все 5 параметров было!)
\$authdata = @{AuthString = "Module=DialogUser;User=[REDACTED_USER];Password=" }
\$authJson = ConvertTo-Json \$authdata -Depth 2
# Login (important, pass the NAME for your session variable in -SessionVariable)
Invoke-RestMethod -Uri "https://t-oneim-4.domain/AppServer/auth/apphost" -Body \$authJson.ToString() -Method Post -UseDefaultCredentials -Headers @{Accept = "application/json" } -SessionVariable wsession
\$body1 = @{parameters = @("d6d14a3a-c8fd-46fe-9daf-9a61a8d4180d", "True", "OK","","") } | ConvertTo-Json
\$newURI = (Invoke-RestMethod -Uri "https://t-oneim-4.domain/AppServer/api/entity/PersonWantsOrg/465e6cb3-7a7d-41ec-9690-21963867a256/method/MakeDecision" -WebSession \$wsession -Method Put -Body \$body1 -ContentType "application/json; charset=utf-8").uri
Вызов метода из скрипта
Postman
https://academy.terrasoft.ru/documents/technic-sdk/7-15/vyzov-servisa-s-pomoshchyu-postman
Не запускается скрипт, через api
-
Create a new program function ‘Enable script execution’ in Designer.
-
Assign the script to the program function.
-
Create a new permission group and assign the group to the newly created program function.
-
Assign user to the new permission group.
-
Compile the database.
-
Execute the script via Identity Manager REST API.
You are right that, at least for version 7.0.x, your authenticated user (depending on the authenticator) needs to have the mentioned program function assigned. (Short Name Common_StartScript).
What's new in 7.1 in regards to the scripts, ist that the REST API will block the execution of script if you script does not have a program function assigned, for security reasons. The authenticated user must be entitled to use the same program function.
This is an addition to the requirements, that the authenticated user must be entitled to use the program function "Allow the starting of arbitrary scripts from the frontend" in order to execute a script in general.
Note: To keep things simple, this program function is allowed to be the Common_StartScript program function.
As a reminder and for completeness, two links around the program functions.
How to check which program functions are available to the current user?
How to assign the program functions?
!!!!!


