Making an API call


When submitting a request to the Conjointly API to provide a service or information, the message sent is referred to as an API call. An API call is made up of four elements:

  1. The HTTP verb.
  2. The url and endpoint of your request.
  3. The header.
  4. The parameters.

HTTP verb

The Conjointly API uses standard HTTP methods to operate on each request.

HTTP Method / ActionDescription
GETGet a list of resources
POSTCreate a new resource
PUTUpdate or replace an existing resource
PATCHUpdate or modify an existing resource
DELETEDelete a resource

Request URL

The Uniform Resource Locator (URL) and endpoint of a Conjointly API call depend on the specific call being made. The base URL for all API requests is api.conjoint.ly, and the endpoint for each call is listed as route in respective API documentation. For example, launching a Market Test has the route /api/ocmr/launch, resulting in the full URL of https://api.conjoint.ly/api/ocmr/launch.

Header fields

A header ensures the Conjointly API understands what you are requesting and ensures you are getting the response you are expecting. Four common headers in the Conjointly API are:

HeaderDescription
Authorization: Bearer ${token}This header authenticates the sender of the request and confirms that they have permission to access or manipulate the relevant data.
Content-typeThis header helps the server to identify the media type of the request body. In general, the Conjointly API specifies the content-type to be application/json.
AcceptThis header indicates which content types the client is able to understand. Similarly, the Conjointly API specifies it to be application/json in most cases.
X-Requested-WithThis header helps to store information about the creation of the request such as client information, method used. For instance, the XMLHttpRequest.

Parameters

The Conjointly API requires all register parameters to be included in a JSON. All JSON parameters must be of type String but able to be converted in the required type.

Once that an API call is made to Conjointly, you can expect the return of one of the HTTP Status Codes that lets you know the request was either processed successfully or unsuccessfully.

Next