i connect with api to display specific data but not how to use this rails . not know put code in model
or controller
require 'rest-client'
require 'json'
url = 'https://xxxx.restdb.io/rest/data'
headers =
{
'content-type': "application/json",
'x-apikey': "-------",
'cache-control': "no-cache"
}
req = RestClient.get(url, headers)
we = JSON.parse(req.body)
p we
Aucun commentaire:
Enregistrer un commentaire