VB6 / Creatio API / Delete object collection instance
Back to Collection Items
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
Dim http As New ChilkatHttp
Dim success As Long
http.SetRequestHeader "Content-Type","application/json"
http.SetRequestHeader "ForceUseSession","true"
http.SetRequestHeader "BPMCSRF","{{BPMCSRF}}"
http.SetRequestHeader "Accept","application/json"
Dim resp As ChilkatHttpResponse
Set resp = http.QuickRequest("DELETE","https://myserver.com/0/odata/Collection3(Id)")
If (http.LastMethodSuccess = 0) Then
Debug.Print http.LastErrorText
Exit Sub
End If
Dim respStatusCode As Long
respStatusCode = resp.StatusCode
Debug.Print "Response Status Code = " & respStatusCode
If (respStatusCode <> 204) Then
Debug.Print "Response Header:"
Debug.Print resp.Header
Debug.Print "Response Body:"
Debug.Print resp.BodyStr
Debug.Print "Failed."
Exit Sub
End If
Debug.Print "Success."
Curl Command
curl -X DELETE
-H "Accept: application/json"
-H "Content-Type: application/json"
-H "ForceUseSession: true"
-H "BPMCSRF: {{BPMCSRF}}"
https://myserver.com/0/odata/Collection3(Id)
Postman Collection Item JSON
{
"name": "Delete object collection instance",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "DELETE",
"header": [
{
"key": "Accept",
"value": "application/json",
"type": "text"
},
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
},
{
"key": "ForceUseSession",
"value": "true",
"type": "text"
},
{
"key": "BPMCSRF",
"value": "{{BPMCSRF}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{BaseURI}}/0/odata/{{CollectionName3}}({{ObjectId1}})",
"host": [
"{{BaseURI}}"
],
"path": [
"0",
"odata",
"{{CollectionName3}}({{ObjectId1}})"
]
},
"description": "Request for deleting an object collection instance."
},
"response": [
{
"name": "[204] Deletes an object collection instance",
"originalRequest": {
"method": "DELETE",
"header": [
{
"key": "Accept",
"value": "application/json",
"type": "text"
},
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
},
{
"key": "ForceUseSession",
"value": "true",
"type": "text"
},
{
"key": "BPMCSRF",
"value": "{{BPMCSRF}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://myserver.com/0/odata/Contact(c31c7862-fe33-4a13-9bbc-0943fa08fd02)",
"protocol": "https",
"host": [
"myserver",
"com"
],
"path": [
"0",
"odata",
"Contact(c31c7862-fe33-4a13-9bbc-0943fa08fd02)"
]
}
},
"status": "No Content",
"code": 204,
"_postman_previewlanguage": "html",
"header": [
{
"key": "Cache-Control",
"value": "private"
},
{
"key": "Content-Type",
"value": "text/html; charset=utf-8"
},
{
"key": "Server",
"value": "Microsoft-IIS/10.0"
},
{
"key": "X-Powered-By",
"value": "ASP.NET"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "Date",
"value": "Fri, 06 Mar 2020 07:29:26 GMT"
},
{
"key": "Content-Length",
"value": "4949"
}
],
"cookie": [
],
"body": ""
}
]
}