API Calls

Making calls to the Clerk.io API from your application.

You can use Clerk.js to make calls to the Clerk.io API without dealing with the low-level details.

Clerk.js uses the following format: Clerk('call', api, args, callback) where each argument is described below.

ArgumentType
apiThe API endpoint.
argsAn object with keys as argument names dictionary. Check individual endpoint for required arguments.
callbackJavascript function handling the response. The response should take a single argument that's the response object from the API.
errorJavascript function handling any error. The response should take a single argument that's the response object from the API.
Clerk("call", 
  "recommendations/popular",
  {
    key: "INSERT_KEY",
    limit: 10,
    labels:["Home Page / Bestsellers"]
  },
  function(response){ 
    console.log(response); 
  },
  function(response){ 
    console.error(response); 
  }
);