Chilkat Online Tools

PowerBuilder / Salesforce Platform APIs / Get channel member

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_V_Type
string ls_V_Url
string ls_Id
integer li_IsDeleted
string ls_DeveloperName
string ls_Language
string ls_MasterLabel
string ls_NamespacePrefix
string ls_ManageableState
string ls_CreatedDate
string ls_CreatedById
string ls_LastModifiedDate
string ls_LastModifiedById
string ls_SystemModstamp
string ls_FullName
string ls_EventChannel
string ls_FilterExpression
string ls_SelectedEntity
string ls_Urls
integer i
integer li_Count_i

// 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

// Adds the "Authorization: Bearer <access_token>" header.
loo_Http.AuthToken = "<access_token>"

loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")

li_Success = loo_Http.QuickGetSb("https://domain.com/services/data/v{{version}}/tooling/sobjects/PlatformEventChannelMember/:PLATFORM_EVENT_CHANNEL_MEMBER_ID",loo_SbResponseBody)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_SbResponseBody
    return
end if

loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")

loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0

Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()

li_RespStatusCode = loo_Http.LastStatus
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
    Write-Debug "Response Header:"
    Write-Debug loo_Http.LastHeader
    Write-Debug "Failed."
    destroy loo_Http
    destroy loo_SbResponseBody
    destroy loo_JResp
    return
end if

// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)

// {
//   "attributes": {
//     "type": "PlatformEventChannelMember",
//     "url": "/services/data/v58.0/tooling/sobjects/PlatformEventChannelMember/0v84H000000PAvIQAW"
//   },
//   "Id": "0v84H000000PAvIQAW",
//   "IsDeleted": false,
//   "DeveloperName": "ChangeEvents_ContactChangeEvent",
//   "Language": "en_US",
//   "MasterLabel": "ContactChangeEvent",
//   "NamespacePrefix": null,
//   "ManageableState": "unmanaged",
//   "CreatedDate": "2022-12-30T15:10:39.000+0000",
//   "CreatedById": "00558000000yFyDAAU",
//   "LastModifiedDate": "2022-12-30T15:10:39.000+0000",
//   "LastModifiedById": "00558000000yFyDAAU",
//   "SystemModstamp": "2022-12-30T15:10:39.000+0000",
//   "FullName": "ChangeEvents_ContactChangeEvent",
//   "Metadata": {
//     "enrichedFields": [
//     ],
//     "eventChannel": "ChangeEvents",
//     "filterExpression": null,
//     "selectedEntity": "ContactChangeEvent",
//     "urls": null
//   },
//   "EventChannel": "ChangeEvents",
//   "SelectedEntity": "ContactChangeEvent",
//   "FilterExpression": null
// }

// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

ls_V_Type = loo_JResp.StringOf("attributes.type")
ls_V_Url = loo_JResp.StringOf("attributes.url")
ls_Id = loo_JResp.StringOf("Id")
li_IsDeleted = loo_JResp.BoolOf("IsDeleted")
ls_DeveloperName = loo_JResp.StringOf("DeveloperName")
ls_Language = loo_JResp.StringOf("Language")
ls_MasterLabel = loo_JResp.StringOf("MasterLabel")
ls_NamespacePrefix = loo_JResp.StringOf("NamespacePrefix")
ls_ManageableState = loo_JResp.StringOf("ManageableState")
ls_CreatedDate = loo_JResp.StringOf("CreatedDate")
ls_CreatedById = loo_JResp.StringOf("CreatedById")
ls_LastModifiedDate = loo_JResp.StringOf("LastModifiedDate")
ls_LastModifiedById = loo_JResp.StringOf("LastModifiedById")
ls_SystemModstamp = loo_JResp.StringOf("SystemModstamp")
ls_FullName = loo_JResp.StringOf("FullName")
ls_EventChannel = loo_JResp.StringOf("Metadata.eventChannel")
ls_FilterExpression = loo_JResp.StringOf("Metadata.filterExpression")
ls_SelectedEntity = loo_JResp.StringOf("Metadata.selectedEntity")
ls_Urls = loo_JResp.StringOf("Metadata.urls")
ls_EventChannel = loo_JResp.StringOf("EventChannel")
ls_SelectedEntity = loo_JResp.StringOf("SelectedEntity")
ls_FilterExpression = loo_JResp.StringOf("FilterExpression")
i = 0
li_Count_i = loo_JResp.SizeOfArray("Metadata.enrichedFields")
do while i < li_Count_i
    loo_JResp.I = i
    i = i + 1
loop


destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp

Curl Command

curl -X GET
	-H "Authorization: Bearer <access_token>"
https://domain.com/services/data/v{{version}}/tooling/sobjects/PlatformEventChannelMember/:PLATFORM_EVENT_CHANNEL_MEMBER_ID

Postman Collection Item JSON

{
  "name": "Get channel member",
  "protocolProfileBehavior": {
    "strictSSL": false,
    "disableBodyPruning": true
  },
  "request": {
    "method": "GET",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{_endpoint}}/services/data/v{{version}}/tooling/sobjects/PlatformEventChannelMember/:PLATFORM_EVENT_CHANNEL_MEMBER_ID",
      "host": [
        "{{_endpoint}}"
      ],
      "path": [
        "services",
        "data",
        "v{{version}}",
        "tooling",
        "sobjects",
        "PlatformEventChannelMember",
        ":PLATFORM_EVENT_CHANNEL_MEMBER_ID"
      ],
      "variable": [
        {
          "key": "PLATFORM_EVENT_CHANNEL_MEMBER_ID",
          "value": ""
        }
      ]
    }
  },
  "response": [
    {
      "name": "Get channel member",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{_endpoint}}/services/data/v{{version}}/tooling/sobjects/PlatformEventChannelMember/:PLATFORM_EVENT_CHANNEL_MEMBER_ID",
          "host": [
            "{{_endpoint}}"
          ],
          "path": [
            "services",
            "data",
            "v{{version}}",
            "tooling",
            "sobjects",
            "PlatformEventChannelMember",
            ":PLATFORM_EVENT_CHANNEL_MEMBER_ID"
          ],
          "variable": [
            {
              "key": "PLATFORM_EVENT_CHANNEL_MEMBER_ID",
              "value": "0v84H000000PAvIQAW"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Date",
          "value": "Mon, 03 Jul 2023 13:17:20 GMT"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=63072000; includeSubDomains"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-Robots-Tag",
          "value": "none"
        },
        {
          "key": "Cache-Control",
          "value": "no-cache,must-revalidate,max-age=0,no-store,private"
        },
        {
          "key": "Sforce-Limit-Info",
          "value": "api-usage=9/15000"
        },
        {
          "key": "Last-Modified",
          "value": "Fri, 30 Dec 2022 15:10:39 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=UTF-8"
        },
        {
          "key": "Vary",
          "value": "Accept-Encoding"
        },
        {
          "key": "Content-Encoding",
          "value": "gzip"
        },
        {
          "key": "Transfer-Encoding",
          "value": "chunked"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"attributes\": {\n        \"type\": \"PlatformEventChannelMember\",\n        \"url\": \"/services/data/v58.0/tooling/sobjects/PlatformEventChannelMember/0v84H000000PAvIQAW\"\n    },\n    \"Id\": \"0v84H000000PAvIQAW\",\n    \"IsDeleted\": false,\n    \"DeveloperName\": \"ChangeEvents_ContactChangeEvent\",\n    \"Language\": \"en_US\",\n    \"MasterLabel\": \"ContactChangeEvent\",\n    \"NamespacePrefix\": null,\n    \"ManageableState\": \"unmanaged\",\n    \"CreatedDate\": \"2022-12-30T15:10:39.000+0000\",\n    \"CreatedById\": \"00558000000yFyDAAU\",\n    \"LastModifiedDate\": \"2022-12-30T15:10:39.000+0000\",\n    \"LastModifiedById\": \"00558000000yFyDAAU\",\n    \"SystemModstamp\": \"2022-12-30T15:10:39.000+0000\",\n    \"FullName\": \"ChangeEvents_ContactChangeEvent\",\n    \"Metadata\": {\n        \"enrichedFields\": [],\n        \"eventChannel\": \"ChangeEvents\",\n        \"filterExpression\": null,\n        \"selectedEntity\": \"ContactChangeEvent\",\n        \"urls\": null\n    },\n    \"EventChannel\": \"ChangeEvents\",\n    \"SelectedEntity\": \"ContactChangeEvent\",\n    \"FilterExpression\": null\n}"
    }
  ]
}