Perform your first request

Here is an API call example with Ruby language

Get your token

Firstly, you will need to get a token :

require "rest-client"
require "json"

login       = "Login"
password    = "Password"

response = RestClient.post(
            "https://api.idol.io/oauth/token",
            {
                grant_type: "password",
                username:   login,
                password:   password
            }
        )
token = JSON.parse(response)["access_token"] # => 'c90450...'

Call an endpoint

Once you get a token you can call any endpoint of our API, here is an example to retrieve your products :

response = RestClient.get(
              "https://api.idol.io/api/v2/products",
              "Content-Type": 'application/vnd.api+json',
              "Authorization": "Bearer <token>"
          )

 JSON.parse(response)['data'] # => '[{ "id": "<ID>", "type": "products",' .. }]'

Last updated