Back to Collection Items
// This example assumes the Chilkat API to have been previously unlocked.
// See Global_Ref.html">Global Unlock Sample for sample code.
http := chilkat.NewHttp()
var success bool
queryParams := chilkat.NewJsonObject()
queryParams.UpdateString("q","Select Id, Name from TaxTreatment Where name='No Tax Treatment'")
// Adds the "Authorization: Bearer <access_token>" header.
http.SetAuthToken("<access_token>")
resp := http.QuickRequestParams("GET","https://domain.com/services/data/v{{version}}/query",queryParams)
if http.LastMethodSuccess() == false {
fmt.Println(http.LastErrorText())
http.DisposeHttp()
queryParams.DisposeJsonObject()
return
}
fmt.Println(resp.StatusCode())
fmt.Println(resp.BodyStr())
resp.DisposeHttpResponse()
http.DisposeHttp()
queryParams.DisposeJsonObject()
Curl Command
curl -G -d "q=Select%20Id,%20Name%20from%20TaxTreatment%20Where%20name%3D%27No%20Tax%20Treatment%27"
-H "Authorization: Bearer <access_token>"
https://domain.com/services/data/v{{version}}/query
Postman Collection Item JSON
{
"name": "Get Default Tax Treatment",
"event": [
{
"listen": "test",
"script": {
"exec": [
"const context = pm.environment.name ? pm.environment : pm.collectionVariables;",
"const jsonData = JSON.parse(responseBody);",
"",
"context.set(\"defaultTaxTreatment\", 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 TaxTreatment Where name='No Tax Treatment'",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"query"
],
"query": [
{
"key": "q",
"value": "Select Id, Name from TaxTreatment Where name='No Tax Treatment'"
}
]
}
},
"response": [
]
}