Back to Collection Items
var
http: TChilkatHttp;
success: Integer;
queryParams: TChilkatJsonObject;
resp: IChilkatHttpResponse;
begin
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http := TChilkatHttp.Create(Self);
queryParams := TChilkatJsonObject.Create(Self);
queryParams.UpdateString('q','Select ID, Name from productrelationshiptype where Name IN (''Bundle PRT'')');
// Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken := '<access_token>';
resp := http.QuickRequestParams('GET','https://domain.com/services/data/v{{version}}/query',queryParams.ControlInterface);
if (http.LastMethodSuccess = 0) then
begin
Memo1.Lines.Add(http.LastErrorText);
Exit;
end;
Memo1.Lines.Add(IntToStr(resp.StatusCode));
Memo1.Lines.Add(resp.BodyStr);
Curl Command
curl -G -d "q=Select%20ID,%20Name%20from%20productrelationshiptype%20where%20Name%20IN%20%28%27Bundle%20PRT%27%29"
-H "Authorization: Bearer <access_token>"
https://domain.com/services/data/v{{version}}/query
Postman Collection Item JSON
{
"name": "Get Product Relationship Type",
"event": [
{
"listen": "test",
"script": {
"exec": [
"const context = pm.environment.name ? pm.environment : pm.collectionVariables;",
"const jsonData = JSON.parse(responseBody);",
"",
"context.set(\"BundleProductRelationshipType\", jsonData.records[0].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 productrelationshiptype where Name IN ('Bundle PRT') ",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"query"
],
"query": [
{
"key": "q",
"value": "Select ID, Name from productrelationshiptype where Name IN ('Bundle PRT') "
}
]
}
},
"response": [
]
}