API Reference

Getting Started with mlytics

This page will help you get started with mlytics. You'll be up and running in a jiffy!

The mlytics API allows you to programmatically access zone created in mlytics account with ease.

Overview

  1. You need a valid API Key to send requests to the endpoints.

  2. The API has an access rate limit applied to it.

  3. The mlytics API will only respond to secured communication done over HTTPS. HTTP requests will be sent a 301 redirect to corresponding HTTPS resources.

  4. Response to every request is sent in JSON format. In case the API request results in an error, it is represented by an "meta": {"code": 224xx,"status": "fail","message": "xxx"} key in the JSON response.

  5. The request method (verb) determines the nature of action you intend to perform. A request made using the GET method implies that you want to fetch something from mlytics, and POST implies you want to create something new to mlytics.

  6. The API calls will respond with appropriate HTTP status codes for all requests. Within mlytics Client, when a response is received, the status code is highlighted and is accompanied by a help text that indicates the possible meaning of the response code. A 200 OK indicates all went well, while 4XX or 5XX response codes indicate an error from the requesting client or our API servers respectively.

Authentication

An API Key is required to be sent as part of every request to the mlytics API, in the form of an apikey request header.

An API Key tells our API server that the request it received came from you. Everything that you have access to in mlytics is accessible with an API Key.

API Key related error response

If an API Key is missing, malformed, or invalid, you will receive a 403 Forbidden response code and the following JSON response:

{
  "message": "You cannot consume this service"
}

Using the API Key as a query parameter

Every request that accepts API Key as apikey request header, also accepts the key when sent as apikey URL query parameter.

API key sent as part of the header has a higher priority in case you send the key using both request header and query parameter.

Rate Limits

API access rate limits are applied at a per-key basis in unit time. In addition, every API response is accompanied by the following set of headers to identify the status of your consumption.

HeaderDescription
ratelimit-limitThe maximum number of requests that the consumer is permitted to make per minute.
ratelimit-remainingThe number of requests remaining in the current rate limit window.
ratelimit-resetThe time at which the current rate limit window resets in UTC epoch seconds.

Once you hit the rate limit, you will receive a response similar to the following JSON, with a status code of 429 Too Many Requests.

{
  "message": "API rate limit exceeded"
}