Skip to content

Getting started

This tutorial shows how to send your first signed request to the MEGOGO Content API. When you complete it, you know that your keys work and that your code calculates the signature correctly.

Time: about 15 minutes.

Before you start

Make sure that you have:

  • The credentials from MEGOGO: a partner ID, a public key and a private key for one platform. See Credentials.
  • A computer that can send HTTPS requests. The examples use curl and Python 3.

Step 1. Calculate the signature

All Content API requests must have the sign parameter. This request has no other parameters. Calculate the MD5 hash of the private key. Then add the public key at the end:

from hashlib import md5

private_key = "{private_key}"
public_key = "{public_key}"

sign = md5(private_key.encode("utf-8")).hexdigest() + public_key
print(sign)

Result: a 32-character hexadecimal hash, then your public key. For example, 781e5e245d69b566979b86e28d23f2c7_example1_xx.

For requests with parameters, see Sign a request.

Step 2. Get the configuration

Send the request with the signature from step 1:

curl "https://api.megogo.net/v1/configuration?sign={sign}"

Expected response (shortened):

{
  "result": "ok",
  "code": 200,
  "data": {
    "geo": "kz",
    "categories": [
      { "id": 16, "title": "Films" },
      { "id": 4, "title": "Series" }
    ],
    "free_vod_types": ["ADVOD", "FVOD"]
  }
}
  • geo is the country that MEGOGO found for your request.
  • categories are the content categories. Use their id values in the catalog requests.

Step 3. Make sure that the request is correct

Check the result and code fields. Do not use only the HTTP status: most errors come with HTTP status 200.

Result Cause Action
HTTP 400, "message": "You entered wrong sign key" The signature is not correct, or the key is not known Do step 1 again. Make sure that you use the private key of the same key pair as the public key
HTTP 200, "result": "error" The parameters of the request are not correct Read code. See the Content API reference
HTTP 429 More than 1000 requests per minute with this key Send fewer requests

Next steps