The API function in the Javascript SDK makes it easy to call Oauth based APIs. By using it, auth tokens will be handled automatically. To make a API call, an id.net user must first be logged in.

Alternately, if you need to access an id.net API for a guest, there is the apiGuest function.

See the API reference for a list of calls available.

Arguments

ID.API('API url', 'METHOD', arguments, callback);

Or

ID.apiGuest('API url', 'METHOD', arguments, callback);
  • Url is everything after http://id.net/api/v1/json/
  • Method is usually POST or GET
  • The argument is usually null but can be a JS object. Ex. {key: value}
  • Callback function with response argument

Example

<script type="text/javascript">
ID.api('links/pending', 'GET', null, function(response){
    console.log(response);
});
</script>