Chilkat Online Tools

Node.js / Coupa Postman Collection - OAuth - Master / GET Task by ID

Back to Collection Items

var os = require('os');
if (os.platform() == 'win32') {  
    if (os.arch() == 'ia32') {
        var chilkat = require('@chilkat/ck-node21-win-ia32');
    } else {
        var chilkat = require('@chilkat/ck-node21-win64'); 
    }
} else if (os.platform() == 'linux') {
    if (os.arch() == 'arm') {
        var chilkat = require('@chilkat/ck-node21-arm');
    } else if (os.arch() == 'x86') {
        var chilkat = require('@chilkat/ck-node21-linux32');
    } else {
        var chilkat = require('@chilkat/ck-node21-linux64');
    }
} else if (os.platform() == 'darwin') {
    if (os.arch() == 'arm64') {
        var chilkat = require('@chilkat/ck-node21-mac-m1');
    } else {
        var chilkat = require('@chilkat/ck-node21-macosx');
    }
}


function chilkatExample() {

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

    var http = new chilkat.Http();
    var success;

    var queryParams = new chilkat.JsonObject();
    queryParams.UpdateString("linkable-type","Project");
    queryParams.UpdateString("owner-id[blank]","false");
    queryParams.UpdateString("linkable[status][not_eq]","draft");
    queryParams.UpdateString("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\"]}]");

    // Adds the "Authorization: Bearer <access_token>" header.
    http.AuthToken = "<access_token>";

    // resp: HttpResponse
    var resp = http.QuickRequestParams("GET","https://domain.com/tasks/:id",queryParams);
    if (http.LastMethodSuccess == false) {
        console.log(http.LastErrorText);
        return;
    }

    console.log(resp.StatusCode);
    console.log(resp.BodyStr);


}

chilkatExample();

Curl Command

curl -G -d "linkable-type=Project"
	-d "owner-id[blank]=false"
	-d "linkable[status][not_eq]=draft"
	-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/tasks/:id

Postman Collection Item JSON

{
  "name": "GET Task by ID",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{URL}}/tasks/:id?linkable-type=Project&owner-id[blank]=false&linkable[status][not_eq]=draft&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": [
        "tasks",
        ":id"
      ],
      "query": [
        {
          "key": "linkable-type",
          "value": "Project"
        },
        {
          "key": "owner-id[blank]",
          "value": "false"
        },
        {
          "key": "linkable[status][not_eq]",
          "value": "draft"
        },
        {
          "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": "id",
          "value": "845"
        }
      ]
    }
  },
  "response": [
  ]
}