📖
API documentation
  • 🚀 Dashboard
  • 📅Changelog
  • 💾Deprecations
  • 🛠️Resources
    • Artist
    • ArtistRole
    • AppleArtist
    • AssetAttachment
    • Availability
    • Booklet
    • Company
    • Continent
    • Currency
    • Customisation
    • Distributor
    • DistributorPriceCode
    • DistributorProductSubgenres
    • Dsp
    • DspState
    • DspTag
    • DspUploadIdentification
    • Gender
    • ImportTask
    • ImportTask [NEW]
    • Label
    • Language
    • Offer
    • Playlist
    • Product
    • ProductGenre
    • ProductType
    • Quotas
    • Record
    • Retail
    • Role
    • Right
    • SendTask
    • SendTaskFactory
    • SpotifyArtist
    • Tag
    • Territory
    • Track
    • TrackOffer
    • TrackVideo
    • Video
    • Webhooks
  • 💡Best practices
    • JSON API documentation
    • Perform your first request
    • Make specific JSON API request
    • Manage the static resources
    • List of common HTTP status codes
    • ⁉️Timeouts and Errors
  • 🖥️Tutorials
    • Full Scenario
    • Managing artists
    • Upload a Dolby Atmos
    • Set a timed release
    • Update Scenario
  • 🔗Exports
    • Daily Trends export
  • 📡Webhooks
    • Presentation
Powered by GitBook
On this page
  1. 💡Best practices

Perform your first request

Here is an API call example with Ruby language

PreviousJSON API documentationNextMake specific JSON API request

Last updated 1 year ago

CtrlK
  • Get your token
  • Call an endpoint

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",' .. }]'