Chilkat Online Tools

Ruby / Salesforce Platform APIs / GetProductSellingModels

Back to Collection Items

require 'chilkat'

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

http = Chilkat::CkHttp.new()

queryParams = Chilkat::CkJsonObject.new()
queryParams.UpdateString("q","Select Id, name from ProductSellingModel Where NAME IN ('Evergreen Monthly', 'One-Time', 'Term Monthly') order by Name ASC")

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

# resp is a CkHttpResponse
resp = http.QuickRequestParams("GET","https://domain.com/services/data/v{{version}}/query",queryParams)
if (http.get_LastMethodSuccess() == false)
    print http.lastErrorText() + "\n";
    exit
end

print resp.get_StatusCode().to_s() + "\n";
print resp.bodyStr() + "\n";

Curl Command

curl -G -d "q=Select%20Id,%20name%20from%20ProductSellingModel%20Where%20NAME%20IN%20%28%27Evergreen%20Monthly%27,%20%27One-Time%27,%20%27Term%20Monthly%27%29%20order%20by%20Name%20ASC"
	-H "Authorization: Bearer <access_token>"
https://domain.com/services/data/v{{version}}/query

Postman Collection Item JSON

{
  "name": "GetProductSellingModels",
  "event": [
    {
      "listen": "test",
      "script": {
        "exec": [
          "const context = pm.environment.name ? pm.environment : pm.collectionVariables;",
          "const jsonData = JSON.parse(responseBody);",
          "",
          "context.set(\"EvergreenMonthlyPSM\", jsonData.records[0].Id);",
          "context.set(\"OneTimePSM\", jsonData.records[1].Id);",
          "context.set(\"TermMonthlyPSM\", jsonData.records[2].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 from ProductSellingModel Where NAME IN ('Evergreen Monthly', 'One-Time', 'Term Monthly') order by Name ASC",
      "host": [
        "{{_endpoint}}"
      ],
      "path": [
        "services",
        "data",
        "v{{version}}",
        "query"
      ],
      "query": [
        {
          "key": "q",
          "value": "Select Id, name from ProductSellingModel Where NAME IN ('Evergreen Monthly', 'One-Time', 'Term Monthly') order by Name ASC"
        }
      ]
    }
  },
  "response": [
  ]
}