Get Started

Get started

Send your first RewardAdz API request.

You are almost ready to send the first request but before that let understand how authorization works.

Keys and Authorization

When you created an app, you received a secret_key, and an app_id this is what you use to generate an access_token. down below is an example of how to generate an access_token.

Request access token

  • API
https://demo.rewardadz.com/public/api/v1/gateway/access_token
  • METHOD GET
  • HEADERS
x-secret-key:456xxxxx

below is a sample implementation using NodeJs 🍧

get_accesstoken.js
const get_token = async () => {
  const url = "https://demo.rewardadz.com/public/api/v1/gateway/access_token";
  const config = {
    headers: {
      "x-secret-key": "456xxxxx",
    },
  };
  try {
    let access_token = await axios.get(url, config);
    //do something with the responnse
  } catch (error) {
    //handle error
  }
};

If the secret key is not provided, the API will return a status 401 with the below body.

{
  "success": false,
  "ra_message": "Key not provided",
  "ra_response_data": null
}

if the secret key is provided but invalid, the API will return a status 401 with the below body.

{
  "success": false,
  "ra_message": "Invalid Key",
  "ra_response_data": null
}

if the secret key is valid the API will return a status 200 with the below body.

{
  "success": true,
  "ra_message": "Access token issued successfully",
  "ra_response_data": {
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1NzczMDY0MDVhZmZmYTRjOTMwY2ZmNSIsImVtYWlsIjoiIiwiY2xpZW50X2NvZGUiOiJyYTk4MDAzNzIiLCJpYXQiOjE3MDY3MzAxMTQsImV4cCI6MTcwNjc0MDkxNH0.EXAJKv0pCoURi7mE612HbXO3grOdDq7wktjPaHGenBE"
  }
}

Authorization has been successfully completed ✅, and we can now proceed to the API requests.