Back to Collection Items
IncludeFile "CkJsonObject.pb"
IncludeFile "CkHttp.pb"
IncludeFile "CkHttpResponse.pb"
Procedure ChilkatExample()
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success.i
queryParams.i = CkJsonObject::ckCreate()
If queryParams.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckUpdateString(queryParams,"fields","[" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "created_at" + Chr(34) + "," + Chr(34) + "updated_at" + Chr(34) + "," + Chr(34) + "title" + Chr(34) + "," + Chr(34) + "description" + Chr(34) + "," + Chr(34) + "status" + Chr(34) + "," + Chr(34) + "owner_id" + Chr(34) + "," + Chr(34) + "due_date" + Chr(34) + "," + Chr(34) + "start_date" + Chr(34) + "," + Chr(34) + "duration" + Chr(34) + "," + Chr(34) + "percentage" + Chr(34) + "," + Chr(34) + "linkable_type" + Chr(34) + "," + Chr(34) + "linkable_id" + Chr(34) + ",{ " + Chr(34) + "owner" + Chr(34) + ": [ " + Chr(34) + "id" + Chr(34) + "]},{ " + Chr(34) + "resolved_by" + Chr(34) + ": [ " + Chr(34) + "id" + Chr(34) + "]},{ " + Chr(34) + "linkable" + Chr(34) + ": [" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "created_at" + Chr(34) + "," + Chr(34) + "updated_at" + Chr(34) + "," + Chr(34) + "name" + Chr(34) + "," + Chr(34) + "active" + Chr(34) + "," + Chr(34) + "open" + Chr(34) + "," + Chr(34) + "description" + Chr(34) + "," + Chr(34) + "mention_name" + Chr(34) + "," + Chr(34) + "start_date" + Chr(34) + "," + Chr(34) + "external_reference_number" + Chr(34) + "," + Chr(34) + "end_date" + Chr(34) + "," + Chr(34) + "commodity_id" + Chr(34) + "," + Chr(34) + "status" + Chr(34) + ",{" + Chr(34) + "template_group" + Chr(34) + ":[" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "name" + Chr(34) + ",{" + Chr(34) + "custom_fields" + Chr(34) + ": {}}]},{" + Chr(34) + "category" + Chr(34) + ": [" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "name" + Chr(34) + ",{" + Chr(34) + "custom_fields" + Chr(34) + ": {}}]},{" + Chr(34) + "department" + Chr(34) + ":[" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "name" + Chr(34) + ",{" + Chr(34) + "custom_fields" + Chr(34) + ": {}}]},{" + Chr(34) + "users" + Chr(34) + ": [" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "email" + Chr(34) + ",{" + Chr(34) + "custom_fields" + Chr(34) + ": {}}]},{" + Chr(34) + "commodity" + Chr(34) + ":[" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "name" + Chr(34) + ",{" + Chr(34) + "custom_fields" + Chr(34) + ": {}}]},{" + Chr(34) + "custom_fields" + Chr(34) + ": {}}]},{ " + Chr(34) + "created_by" + Chr(34) + ": [ " + Chr(34) + "id" + Chr(34) + "]},{ " + Chr(34) + "updated_by" + Chr(34) + ": [" + Chr(34) + "id" + Chr(34) + "]}]")
; Adds the "Authorization: Bearer <access_token>" header.
CkHttp::setCkAuthToken(http, "<access_token>")
resp.i = CkHttp::ckQuickRequestParams(http,"GET","https://domain.com/projects/:project_id/tasks",queryParams)
If CkHttp::ckLastMethodSuccess(http) = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
CkJsonObject::ckDispose(queryParams)
ProcedureReturn
EndIf
Debug Str(CkHttpResponse::ckStatusCode(resp))
Debug CkHttpResponse::ckBodyStr(resp)
CkHttpResponse::ckDispose(resp)
CkHttp::ckDispose(http)
CkJsonObject::ckDispose(queryParams)
ProcedureReturn
EndProcedure
Curl Command
curl -G -d "fields=%5B%22id%22,%22created_at%22,%22updated_at%22,%22title%22,%22description%22,%22status%22,%22owner_id%22,%22due_date%22,%22start_date%22,%22duration%22,%22percentage%22,%22linkable_type%22,%22linkable_id%22,%7B%20%22owner%22%3A%20%5B%20%22id%22%5D%7D,%7B%20%22resolved_by%22%3A%20%5B%20%22id%22%5D%7D,%7B%20%22linkable%22%3A%20%5B%22id%22,%22created_at%22,%22updated_at%22,%22name%22,%22active%22,%22open%22,%22description%22,%22mention_name%22,%22start_date%22,%22external_reference_number%22,%22end_date%22,%22commodity_id%22,%22status%22,%7B%22template_group%22%3A%5B%22id%22,%22name%22,%7B%22custom_fields%22%3A%20%7B%7D%7D%5D%7D,%7B%22category%22%3A%20%5B%22id%22,%22name%22,%7B%22custom_fields%22%3A%20%7B%7D%7D%5D%7D,%7B%22department%22%3A%5B%22id%22,%22name%22,%7B%22custom_fields%22%3A%20%7B%7D%7D%5D%7D,%7B%22users%22%3A%20%5B%22id%22,%22email%22,%7B%22custom_fields%22%3A%20%7B%7D%7D%5D%7D,%7B%22commodity%22%3A%5B%22id%22,%22name%22,%7B%22custom_fields%22%3A%20%7B%7D%7D%5D%7D,%7B%22custom_fields%22%3A%20%7B%7D%7D%5D%7D,%7B%20%22created_by%22%3A%20%5B%20%22id%22%5D%7D,%7B%20%22updated_by%22%3A%20%5B%22id%22%5D%7D%5D"
-H "Authorization: Bearer <access_token>"
https://domain.com/projects/:project_id/tasks
Postman Collection Item JSON
{
"name": "GET All Tasks linked to a specific Project",
"request": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{URL}}/projects/:project_id/tasks?fields=[\"id\",\"created_at\",\"updated_at\",\"title\",\"description\",\"status\",\"owner_id\",\"due_date\",\"start_date\",\"duration\",\"percentage\",\"linkable_type\",\"linkable_id\",{ \"owner\": [ \"id\"]},{ \"resolved_by\": [ \"id\"]},{ \"linkable\": [\"id\",\"created_at\",\"updated_at\",\"name\",\"active\",\"open\",\"description\",\"mention_name\",\"start_date\",\"external_reference_number\",\"end_date\",\"commodity_id\",\"status\",{\"template_group\":[\"id\",\"name\",{\"custom_fields\": {}}]},{\"category\": [\"id\",\"name\",{\"custom_fields\": {}}]},{\"department\":[\"id\",\"name\",{\"custom_fields\": {}}]},{\"users\": [\"id\",\"email\",{\"custom_fields\": {}}]},{\"commodity\":[\"id\",\"name\",{\"custom_fields\": {}}]},{\"custom_fields\": {}}]},{ \"created_by\": [ \"id\"]},{ \"updated_by\": [\"id\"]}]",
"host": [
"{{URL}}"
],
"path": [
"projects",
":project_id",
"tasks"
],
"query": [
{
"key": "fields",
"value": "[\"id\",\"created_at\",\"updated_at\",\"title\",\"description\",\"status\",\"owner_id\",\"due_date\",\"start_date\",\"duration\",\"percentage\",\"linkable_type\",\"linkable_id\",{ \"owner\": [ \"id\"]},{ \"resolved_by\": [ \"id\"]},{ \"linkable\": [\"id\",\"created_at\",\"updated_at\",\"name\",\"active\",\"open\",\"description\",\"mention_name\",\"start_date\",\"external_reference_number\",\"end_date\",\"commodity_id\",\"status\",{\"template_group\":[\"id\",\"name\",{\"custom_fields\": {}}]},{\"category\": [\"id\",\"name\",{\"custom_fields\": {}}]},{\"department\":[\"id\",\"name\",{\"custom_fields\": {}}]},{\"users\": [\"id\",\"email\",{\"custom_fields\": {}}]},{\"commodity\":[\"id\",\"name\",{\"custom_fields\": {}}]},{\"custom_fields\": {}}]},{ \"created_by\": [ \"id\"]},{ \"updated_by\": [\"id\"]}]"
}
],
"variable": [
{
"key": "project_id",
"value": "15"
}
]
}
},
"response": [
]
}