Authenticating in an API

Hi all

I’m stuck trying to authenticate, the documentation only shows an example in cURL and the examples available haven’t gotten me anywhere.

This is the API documentation:
Here is a range of samples in different languages:

I’ve tried a whole bunch of things but I’m fairly new to this and could really use some help.
I think I’m on the right track using the http requests library, but I haven’t really gotten anywhere.

import http.requests.*;

void setup() {
  size(1280, 720);
  GetRequest get = new GetRequest("https://" + "");
  get.addHeader("Content-Type", "application/json");
  get.addHeader("apikey", "InsertApiKeyHere"); 
  JSONObject response = parseJSONObject(get.getContent());
  println("status: " + response.getString("ticket"));

The above attempt returns

Jan 14, 2019 9:34:28 AM org.apache.http.impl.client.DefaultRequestDirector handleResponse
WARNING: Authentication error: Unable to respond to any of these challenges: {}
status: null

i not say it is wrong way, but i look at 2 examples,
and they work with

  json = loadJSONObject(url+query+"&page="+page+beginDate+endDate+"&api-key="+apiKey);


loadJSON(url,gotData);  // callback version

so pls check on

Hi! Thanks for the reply. I’ve tried that method but including the apiKey in the url doesn’t seem to work (won’t work when I try it in a browser either, unless I’m already logged in.)

Sorry to bump this, Are there any other suggestions?



How does it work? Who can access my helpdesk? Can everybody see my data?

Before you can set the priority of a ticket or change a customer’s name or use any of the APIs listed above, you need to “authenticate your ID” or “log in” in the same way you log in to your helpdesk’s web portal.

so possibly:

as a security measure you need to be
just API alone might not work

but that can only be answered

or you have any reason to believe that it is a processing issue?