Pulling Bright Local API Data into my Ruby on Rails App - API Docs written in PHP -
i'm trying build rails app pulls data several different seo tool api's. bright local (see api docs here - http://apidocs.brightlocal.com/) api doc examples written in php, can't read great.
so first, ask specific question, how write batch request in ruby:
<?php use brightlocal\api; use brightlocal\batches\v4 batchapi; $api = new api('[insert_api_key]', '[insert_api_secret]'); $batchapi = new batchapi($api); $result = $batchapi->create(); if ($result['success']) { $batchid = $result['batch-id']; }
also, suggestions how can bring myself snuff on using api's in rails apps?
our docs show php examples - although planning expand on , ruby 1 of languages we'll looking add.
a simple command line curl request above php code this:
curl --data "api-key=<your api key here>" https://tools.brightlocal.com/seo-tools/api/v4/batch
and return response this:
{"success":true,"batch-id":<returned batch id>}
all our api endpoints respond either post, put, or delete. it's important note whenever data posted post or put it's passed "param1=value1¶m2=value2" in body of request rather json encoded.
i don't know ruby @ i'm afraid might make request want:
params = {"api-key" => "<your api key>"} net::http::post.new("https://tools.brightlocal.com/seo-tools/api/v4/batch").set_form_data(params)
Comments
Post a Comment