Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vSbResponseBody
Handle hoSbResponseBody
Handle hoJResp
Integer iRespStatusCode
String sId
String sV_Type
String sActiveSwitchboardIntegrationId
String sName
String sIntegrationId
String sIntegrationType
String sPendingSwitchboardIntegrationId
String sPendingSwitchboardIntegrationName
String sPendingSwitchboardIntegrationIntegrationId
String sPendingSwitchboardIntegrationIntegrationType
Boolean iIsDefault
String sDisplayName
String sDescription
String sIconUrl
String sLang
String sBusinessLastRead
String sLastUpdatedAt
String sTemp1
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
Set ComBasicAuth Of hoHttp To True
Set ComLogin Of hoHttp To "username"
Set ComPassword Of hoHttp To "password"
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComQuickGetSb Of hoHttp "https://domain.com/" vSbResponseBody To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
If (Not(IsComObjectCreated(hoJResp))) Begin
Send CreateComObject of hoJResp
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
Set ComEmitCompact Of hoJResp To False
Showln "Response Body:"
Get ComEmit Of hoJResp To sTemp1
Showln sTemp1
Get ComLastStatus Of hoHttp To iRespStatusCode
Showln "Response Status Code = " iRespStatusCode
If (iRespStatusCode >= 400) Begin
Showln "Response Header:"
Get ComLastHeader Of hoHttp To sTemp1
Showln sTemp1
Showln "Failed."
Procedure_Return
End
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "conversation": {
// "id": "c93bb9c14dde8ffb94564eae",
// "type": "personal",
// "activeSwitchboardIntegration": {
// "id": "5ef21b86e933b7355c11c604",
// "name": "bot",
// "integrationId": "5ef21b86e933b7355c11c605",
// "integrationType": "zd:agentWorkspace"
// },
// "pendingSwitchboardIntegration": {
// "id": "5ef21b86e933b7355c11c604",
// "name": "bot",
// "integrationId": "5ef21b86e933b7355c11c605",
// "integrationType": "zd:agentWorkspace"
// },
// "isDefault": false,
// "displayName": "pari",
// "description": "Conversation between Rogers and Carl.",
// "iconUrl": "https://www.gravatar.com/image.jpg",
// "metadata": {
// "lang": "en-ca"
// },
// "businessLastRead": "2020-06-23T14:33:47.492Z",
// "lastUpdatedAt": "2020-06-26T14:33:47.120Z"
// }
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
Get ComStringOf Of hoJResp "conversation.id" To sId
Get ComStringOf Of hoJResp "conversation.type" To sV_Type
Get ComStringOf Of hoJResp "conversation.activeSwitchboardIntegration.id" To sActiveSwitchboardIntegrationId
Get ComStringOf Of hoJResp "conversation.activeSwitchboardIntegration.name" To sName
Get ComStringOf Of hoJResp "conversation.activeSwitchboardIntegration.integrationId" To sIntegrationId
Get ComStringOf Of hoJResp "conversation.activeSwitchboardIntegration.integrationType" To sIntegrationType
Get ComStringOf Of hoJResp "conversation.pendingSwitchboardIntegration.id" To sPendingSwitchboardIntegrationId
Get ComStringOf Of hoJResp "conversation.pendingSwitchboardIntegration.name" To sPendingSwitchboardIntegrationName
Get ComStringOf Of hoJResp "conversation.pendingSwitchboardIntegration.integrationId" To sPendingSwitchboardIntegrationIntegrationId
Get ComStringOf Of hoJResp "conversation.pendingSwitchboardIntegration.integrationType" To sPendingSwitchboardIntegrationIntegrationType
Get ComBoolOf Of hoJResp "conversation.isDefault" To iIsDefault
Get ComStringOf Of hoJResp "conversation.displayName" To sDisplayName
Get ComStringOf Of hoJResp "conversation.description" To sDescription
Get ComStringOf Of hoJResp "conversation.iconUrl" To sIconUrl
Get ComStringOf Of hoJResp "conversation.metadata.lang" To sLang
Get ComStringOf Of hoJResp "conversation.businessLastRead" To sBusinessLastRead
Get ComStringOf Of hoJResp "conversation.lastUpdatedAt" To sLastUpdatedAt
End_Procedure
Curl Command
curl -X GET
-u 'username:password'
https://domain.com/
Postman Collection Item JSON
{
"name": "Get Conversation",
"_postman_id": "ffbb4dbd-fbf6-43f4-9e0c-6be5c4e2829c",
"request": {
"method": "GET",
"header": [
],
"url": "{{url}}/v2/apps/{{appId}}/conversations/{{conversationId}}",
"description": "Fetches an individual conversation."
},
"response": [
{
"id": "90c0f930-c5be-456b-93fd-2d14edac480c",
"name": "Ok",
"originalRequest": {
"method": "GET",
"header": [
{
"description": {
"content": "Added as a part of security scheme: bearer",
"type": "text/plain"
},
"key": "Authorization",
"value": "Bearer <token>"
}
],
"url": {
"raw": "{{baseUrl}}/v2/apps/:appId/conversations/:conversationId",
"host": [
"{{baseUrl}}"
],
"path": [
"v2",
"apps",
":appId",
"conversations",
":conversationId"
],
"variable": [
{
"key": "appId"
},
{
"key": "conversationId"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"conversation\": {\n \"id\": \"c93bb9c14dde8ffb94564eae\",\n \"type\": \"personal\",\n \"activeSwitchboardIntegration\": {\n \"id\": \"5ef21b86e933b7355c11c604\",\n \"name\": \"bot\",\n \"integrationId\": \"5ef21b86e933b7355c11c605\",\n \"integrationType\": \"zd:agentWorkspace\"\n },\n \"pendingSwitchboardIntegration\": {\n \"id\": \"5ef21b86e933b7355c11c604\",\n \"name\": \"bot\",\n \"integrationId\": \"5ef21b86e933b7355c11c605\",\n \"integrationType\": \"zd:agentWorkspace\"\n },\n \"isDefault\": false,\n \"displayName\": \"pari\",\n \"description\": \"Conversation between Rogers and Carl.\",\n \"iconUrl\": \"https://www.gravatar.com/image.jpg\",\n \"metadata\": {\n \"lang\": \"en-ca\"\n },\n \"businessLastRead\": \"2020-06-23T14:33:47.492Z\",\n \"lastUpdatedAt\": \"2020-06-26T14:33:47.120Z\"\n }\n}"
},
{
"id": "d66e4f40-123a-4f32-8858-445be2b989d3",
"name": "Conversation not found",
"originalRequest": {
"method": "GET",
"header": [
{
"description": {
"content": "Added as a part of security scheme: bearer",
"type": "text/plain"
},
"key": "Authorization",
"value": "Bearer <token>"
}
],
"url": {
"raw": "{{baseUrl}}/v2/apps/:appId/conversations/:conversationId",
"host": [
"{{baseUrl}}"
],
"path": [
"v2",
"apps",
":appId",
"conversations",
":conversationId"
],
"variable": [
{
"key": "appId"
},
{
"key": "conversationId"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}