All of the Connections Online API methods have samples listed in the Docs that show what you need to send in your request and what they will return in response, but before you get to that point, you may be wondering how to make the request in the first place. Here are some examples of how you can make a request to the API.
https://api.connectionsonline.net/v4/...
https://api.connectionsonline.net/v4/projects
curl -u {user}/{token} https://api.connectionsonline.net/v4/...
curl -u bob@example.com/{UserToken}6qS12cMRHwHaXjp01oOjZBZLoSCfQxWBL7Tz5PIz https://api.connectionsonline.net/v4/projects
With HTTP authentication, the slash character in {user}/{token}
must be URL-encoded as %2F
.
function GetProjects() { jQuery.support.cors = true; $.ajax({ beforeSend: function (request) { var restAuthHeader = btoa($('UserName').val() + ':' + $('UserToken').val()); request.withCredentials = true; request.setRequestHeader("Authorization", "Basic " + restAuthHeader); }, url: 'https://api.connectionsonline.net/v4/projects', type: 'GET', dataType: 'json', success: function (data) { // Do something with the data. }, error: function (jqXHR, textStatus, errorThrown) { // Do something with the error. } }); }
function GetProjects() { jQuery.support.cors = true; $.ajax({ beforeSend: function (request) { var restAuthHeader = btoa($('bob@example.com').val() + ':' + $('{UserToken}6qS12cMRHwHaXjp01oOjZBZLoSCfQxWBL7Tz5PIz').val()); request.withCredentials = true; request.setRequestHeader("Authorization", "Basic " + restAuthHeader); }, url: 'https://api.connectionsonline.net/v4/projects', type: 'GET', dataType: 'json', success: function (data) { DisplayProjects(data); }, error: function (jqXHR, textStatus, errorThrown) { $('#error').html('<p>status code: ' + jqXHR.status + '</p><p>errorThrown: ' + errorThrown + '</p>').show(); console.log('textStatus:'); console.log(textStatus); console.log('errorThrown:'); console.log(errorThrown); } }); }