Chilkat Online Tools

C++ / Salesforce Platform APIs / GetPBEs(VirtualRouter)

Back to Collection Items

#include <CkHttp.h>
#include <CkJsonObject.h>
#include <CkHttpResponse.h>

void ChilkatSample(void)
    {
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    CkHttp http;
    bool success;

    CkJsonObject queryParams;
    queryParams.UpdateString("q","Select ID, Name, ProductSellingModel.Name from pricebookentry where Product2.Name IN ('Virtual Router') order by ProductSellingModel.Name ASC");

    // Adds the "Authorization: Bearer <access_token>" header.
    http.put_AuthToken("<access_token>");

    CkHttpResponse *resp = http.QuickRequestParams("GET","https://domain.com/services/data/v{{version}}/query",queryParams);
    if (http.get_LastMethodSuccess() == false) {
        std::cout << http.lastErrorText() << "\r\n";
        return;
    }

    std::cout << resp->get_StatusCode() << "\r\n";
    std::cout << resp->bodyStr() << "\r\n";
    delete resp;
    }

Curl Command

curl -G -d "q=Select%20ID,%20Name,%20ProductSellingModel.Name%20from%20pricebookentry%20where%20Product2.Name%20IN%20%28%27Virtual%20Router%27%29%20order%20by%20ProductSellingModel.Name%20ASC"
	-H "Authorization: Bearer <access_token>"
https://domain.com/services/data/v{{version}}/query

Postman Collection Item JSON

{
  "name": "GetPBEs(VirtualRouter)",
  "event": [
    {
      "listen": "test",
      "script": {
        "exec": [
          "const context = pm.environment.name ? pm.environment : pm.collectionVariables;",
          "const jsonData = JSON.parse(responseBody);",
          "",
          "context.set(\"VirtualRouterEvergrnPBE\", jsonData.records[0].Id);",
          "context.set(\"VirtualRouterTermedPBE\", jsonData.records[1].Id);",
          ""
        ],
        "type": "text/javascript"
      }
    }
  ],
  "protocolProfileBehavior": {
    "disableBodyPruning": true
  },
  "request": {
    "method": "GET",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{_endpoint}}/services/data/v{{version}}/query?q=Select ID, Name, ProductSellingModel.Name from pricebookentry where Product2.Name IN ('Virtual Router') order by ProductSellingModel.Name ASC",
      "host": [
        "{{_endpoint}}"
      ],
      "path": [
        "services",
        "data",
        "v{{version}}",
        "query"
      ],
      "query": [
        {
          "key": "q",
          "value": "Select ID, Name, ProductSellingModel.Name from pricebookentry where Product2.Name IN ('Virtual Router') order by ProductSellingModel.Name ASC"
        }
      ]
    }
  },
  "response": [
  ]
}