Chilkat Online Tools

Java / Coupa Postman Collection - OAuth - Master / GET ALL Supplier Sites against a Supplier record

Back to Collection Items

import com.chilkatsoft.*;

public class ChilkatExample {

  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }

  public static void main(String argv[])
  {
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    CkHttp http = new CkHttp();
    boolean success;

    CkJsonObject queryParams = new CkJsonObject();
    queryParams.UpdateString("fields","[\"id\",\"name\",\"code\",\"supplier_id\",{\"addresses\": [\"id\",\"supplier_id\",\"kind\",\"location_code\",\"address_name\",\"street_address\",\"street_address2\",\"city\",\"postal_code\",\"state\",{\"country\": [\"id\",\"code\",\"name\"]},{\"custom_fields\": {}}]},{\"contacts\": [\"id\",\"supplier_id\",\"kind\",\"name_given\",\"name_family\",\"email\"]}]");

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

    CkHttpResponse resp = http.QuickRequestParams("GET","https://domain.com/suppliers/:id/supplier_sites",queryParams);
    if (http.get_LastMethodSuccess() == false) {
        System.out.println(http.lastErrorText());
        return;
        }

    System.out.println(resp.get_StatusCode());
    System.out.println(resp.bodyStr());
  }
}

Curl Command

curl -G -d "fields=%5B%22id%22,%22name%22,%22code%22,%22supplier_id%22,%7B%22addresses%22%3A%20%5B%22id%22,%22supplier_id%22,%22kind%22,%22location_code%22,%22address_name%22,%22street_address%22,%22street_address2%22,%22city%22,%22postal_code%22,%22state%22,%7B%22country%22%3A%20%5B%22id%22,%22code%22,%22name%22%5D%7D,%7B%22custom_fields%22%3A%20%7B%7D%7D%5D%7D,%7B%22contacts%22%3A%20%5B%22id%22,%22supplier_id%22,%22kind%22,%22name_given%22,%22name_family%22,%22email%22%5D%7D%5D"
	-H "Authorization: Bearer <access_token>"
https://domain.com/suppliers/:id/supplier_sites

Postman Collection Item JSON

{
  "name": "GET ALL Supplier Sites against a Supplier record",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{URL}}/suppliers/:id/supplier_sites?fields=[\"id\",\"name\",\"code\",\"supplier_id\",{\"addresses\": [\"id\",\"supplier_id\",\"kind\",\"location_code\",\"address_name\",\"street_address\",\"street_address2\",\"city\",\"postal_code\",\"state\",{\"country\": [\"id\",\"code\",\"name\"]},{\"custom_fields\": {}}]},{\"contacts\": [\"id\",\"supplier_id\",\"kind\",\"name_given\",\"name_family\",\"email\"]}]",
      "host": [
        "{{URL}}"
      ],
      "path": [
        "suppliers",
        ":id",
        "supplier_sites"
      ],
      "query": [
        {
          "key": "fields",
          "value": "[\"id\",\"name\",\"code\",\"supplier_id\",{\"addresses\": [\"id\",\"supplier_id\",\"kind\",\"location_code\",\"address_name\",\"street_address\",\"street_address2\",\"city\",\"postal_code\",\"state\",{\"country\": [\"id\",\"code\",\"name\"]},{\"custom_fields\": {}}]},{\"contacts\": [\"id\",\"supplier_id\",\"kind\",\"name_given\",\"name_family\",\"email\"]}]"
        }
      ],
      "variable": [
        {
          "key": "id",
          "value": "3505"
        }
      ]
    }
  },
  "response": [
  ]
}