Back to Collection Items
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Http")
set http = CreateObject("Chilkat.Http")
' Use this online tool to generate code from sample JSON: Generate Code to Create JSON
' The following JSON is sent in the request body.
' [
' {
' "operation": "replace",
' "field": "/telephoneNumber",
' "value": "{{$randomPhoneNumber}}"
' }
' ]
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.JsonArray")
set jarr = CreateObject("Chilkat.JsonArray")
success = jarr.AddObjectAt(-1)
' jsonObj_1 is a Chilkat.JsonObject
Set jsonObj_1 = jarr.ObjectAt(jarr.Size - 1)
success = jsonObj_1.UpdateString("operation","replace")
success = jsonObj_1.UpdateString("field","/telephoneNumber")
success = jsonObj_1.UpdateString("value","{{$randomPhoneNumber}}")
' Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>"
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.StringBuilder")
set sbRequestBody = CreateObject("Chilkat.StringBuilder")
success = jarr.EmitSb(sbRequestBody)
' resp is a Chilkat.HttpResponse
Set resp = http.PTextSb("PATCH","https://<tenant-name>.forgeblocks.com/openidm/managed/alpha_user/:_id",sbRequestBody,"utf-8","application/json",0,0)
If (http.LastMethodSuccess = 0) Then
outFile.WriteLine(http.LastErrorText)
WScript.Quit
End If
outFile.WriteLine(resp.StatusCode)
outFile.WriteLine(resp.BodyStr)
outFile.Close
Curl Command
curl -X PATCH
-H "Authorization: Bearer <access_token>"
-d '[
{
"operation": "replace",
"field": "/telephoneNumber",
"value": "{{$randomPhoneNumber}}"
}
]'
https://<tenant-name>.forgeblocks.com/openidm/managed/alpha_user/:_id
Postman Collection Item JSON
{
"name": "Step 3: Update a Managed Identity",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PATCH",
"header": [
],
"body": {
"mode": "raw",
"raw": "[\n {\n \"operation\": \"replace\",\n \"field\": \"/telephoneNumber\",\n \"value\": \"{{$randomPhoneNumber}}\"\n }\n]",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{platformUrl}}/openidm/managed/alpha_user/:_id",
"host": [
"{{platformUrl}}"
],
"path": [
"openidm",
"managed",
"alpha_user",
":_id"
],
"query": [
{
"key": "_fields",
"value": "",
"description": "Optional parameter containing a comma separated list of field references specifying which fields of the targeted JSON resource should be returned.",
"disabled": true
}
],
"variable": [
{
"key": "_id",
"value": "{{managedUserId}}"
}
]
}
},
"response": [
{
"name": "Success",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "(Required) ",
"key": "Accept-API-Version",
"value": "<string>"
}
],
"url": {
"raw": "{{baseUrl}}/openidm/managed/user#1.0_query_filter?_fields=&_prettyPrint=true&_queryFilter=<string>&_pageSize=<integer>&_totalPagedResultsPolicy=<string>&_sortKeys=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"openidm",
"managed",
"user"
],
"hash": "1.0_query_filter?_fields=&_prettyPrint=true&_queryFilter=<string>&_pageSize=<integer>&_totalPagedResultsPolicy=<string>&_sortKeys=<string>"
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [
],
"body": ""
}
]
}