PowerBuilder / Creatio API / Modify a field of an object collection instance
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_BdRequestBody
oleobject loo_Resp
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_BdRequestBody = create oleobject
// Use "Chilkat_9_5_0.BinData" for versions of Chilkat < 10.0.0
li_rc = loo_BdRequestBody.ConnectToNewObject("Chilkat.BinData")
li_Success = loo_BdRequestBody.LoadFile("scr_NewContactPhoto.png")
if li_Success <> 1 then
Write-Debug "Failed to load scr_NewContactPhoto.png"
destroy loo_Http
destroy loo_BdRequestBody
return
end if
loo_Http.SetRequestHeader("BPMCSRF","{{BPMCSRF}}")
loo_Http.SetRequestHeader("Accept","application/json; text/plain; */*")
loo_Resp = loo_Http.PBinaryBd("PUT","https://myserver.com/0/odata/Collection4({{FieldName6Value6}})/{{FieldName4}}",loo_BdRequestBody,"application/octet-stream; IEEE754Compatible=true",0,0)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_BdRequestBody
return
end if
Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp
destroy loo_Http
destroy loo_BdRequestBody
Curl Command
curl -X PUT
-H "Accept: application/json; text/plain; */*"
-H "Content-Type: application/octet-stream; IEEE754Compatible=true"
-H "BPMCSRF: {{BPMCSRF}}"
--data-binary '@scr_NewContactPhoto.png'
https://myserver.com/0/odata/Collection4({{FieldName6Value6}})/{{FieldName4}}
Postman Collection Item JSON
{
"name": "Modify a field of an object collection instance",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
},
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PUT",
"header": [
{
"key": "Accept",
"value": "application/json; text/plain; */*",
"type": "text"
},
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/octet-stream; IEEE754Compatible=true",
"type": "text"
},
{
"key": "BPMCSRF",
"value": "{{BPMCSRF}}",
"type": "text"
}
],
"body": {
"mode": "file",
"file": {
"src": "/C:/Users/M.Kysla/Downloads/scr_NewContactPhoto.png"
}
},
"url": {
"raw": "{{BaseURI}}/0/odata/{{CollectionName4}}({{FieldName6Value6}})/{{FieldName4}}",
"host": [
"{{BaseURI}}"
],
"path": [
"0",
"odata",
"{{CollectionName4}}({{FieldName6Value6}})",
"{{FieldName4}}"
]
},
"description": "Request for modifying a field of an object collection instance."
},
"response": [
{
"name": "[200] Modifies an object collection instance",
"originalRequest": {
"method": "PUT",
"header": [
{
"key": "Accept",
"value": "application/json; text/plain; */*",
"type": "text"
},
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/octet-stream; IEEE754Compatible=true",
"type": "text"
},
{
"key": "BPMCSRF",
"value": "{{BPMCSRF}}",
"type": "text"
}
],
"body": {
"mode": "file",
"file": {
"src": "/C:/Users/M.Kysla/Downloads/scr_NewContactPhoto.png"
},
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://myserver.com/0/odata/SysImage(410006e1-ca4e-4502-a9ec-e54d922d2c01)/Data",
"protocol": "https",
"host": [
"myserver",
"com"
],
"path": [
"0",
"odata",
"SysImage(410006e1-ca4e-4502-a9ec-e54d922d2c01)",
"Data"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "Text",
"header": [
],
"cookie": [
],
"body": ""
}
]
}