[seomoz-api] Batch Request Format

65 views
Skip to first unread message
Message has been deleted

psw

unread,
May 12, 2010, 6:04:19 PM5/12/10
to SEOmoz API
Hi all,
I was wondering if someone had a valid example of what a batch JSON
request to the url_metrics API would look like. I have seen a
reference to this capability in the online docs, but not an actual
usage.
So far, I am able to send single URL requests into the API with a
simple test case, but I really need to be able to send many URLs in
one request.

Thanks in advance,
Patrick

--
You received this message because you are subscribed to the Google Groups "SEOmoz API" group.
To post to this group, send email to seomo...@googlegroups.com.
To unsubscribe from this group, send email to seomoz-api+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/seomoz-api?hl=en.

Jeff Pollard

unread,
May 12, 2010, 6:10:21 PM5/12/10
to seomo...@googlegroups.com
Hello Patrick,

The linkscape-gem utilizes the batch JSON request for the API.  See the "Requesting Data on MUltiple URLs" part of the README.  We're utilizing this in some internal apps and it's working well, and is faster (especially for small #s of columns) since metrics are fetched in parallel in the backend.

Info on requesting multiple URLs at a time was recently added to the API Wiki.  You can check it out here (see the bottom section):


Thanks,

-J

psw

unread,
May 13, 2010, 11:01:41 AM5/13/10
to SEOmoz API
Hi Jeff,
Thanks for the pointer to the linkscape-gem. I took a look through the
source, and attempted to install the gem package manager to get it
installed - but I am on an old version of Ubuntu, and it is not
cooperating.

It appears from the source code [request.rb] that is an array of urls
is passed into the program, and then a .merge command is run on it.

My goal is to try and reproduce the URL request format that this app
produces in my J2EE app. Would it be possible to send me a valid
request that shows how more than one URL would be passed in to the
server from this client? From that, I could try and figure-out how I
could do it in Java.

Hope this makes sense.

Best Regards,
Patrick


On May 12, 6:10 pm, Jeff Pollard <j...@seomoz.org> wrote:
> Hello Patrick,
>
> The linkscape-gem utilizes the batch JSON request for the API.  See the
> "Requesting Data on MUltiple URLs" part of the
> README<http://github.com/seomoz/linkscape-gem>.
>  We're utilizing this in some internal apps and it's working well, and is
> faster (especially for small #s of columns) since metrics are fetched in
> parallel in the backend.
>
> Info on requesting multiple URLs at a time was recently added to the API
> Wiki.  You can check it out here (see the bottom section):
>
> http://apiwiki.seomoz.org/Request-Response+Format
>
> Thanks,
>
> -J
>
>
>
> On Wed, May 12, 2010 at 3:02 PM, psw <patrick.wy...@gmail.com> wrote:
> > Hi all,
> > I was wondering if someone had a valid example of what a batch JSON
> > request to the url_metrics API would look like. I have seen a
> > reference to this capability in the online docs, but not an actual
> > usage.
> > So far, I am able to send single URL requests into the API with a
> > simple test case, but I really need to be able to send many URLs in
> > one request.
>
> > Thanks in advance,
> > Patrick
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "SEOmoz API" group.
> > To post to this group, send email to seomo...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > seomoz-api+...@googlegroups.com<seomoz-api%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/seomoz-api?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "SEOmoz API" group.
> To post to this group, send email to seomo...@googlegroups.com.
> To unsubscribe from this group, send email to seomoz-api+...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/seomoz-api?hl=en.

Jeff Pollard

unread,
May 26, 2010, 1:13:42 PM5/26/10
to seomo...@googlegroups.com
Hello Patrick,

Sorry for the immense delay, things have been a little busy around the office :)  The bulk API operates exactly the same as the normal API, except that your request to the API is a POST as opposed to a GET, and the request has a body - a JSON-encoded array of URLs.  The response from the API is a JSON-encoded array of url data, as opposed to just one JSON object of URL data.

Here is a sample request with Curl for that data:

curl "http://lsapi.seomoz.com/linkscape/url-metrics/?AccessID=my_access_id&Expires=1274893869&Signature=ETZcxG3avCb3KFdMYgm2XRi6BE4%3D&Cols=546299707389" --data "["www.seomoz.org/","www.seomoz.org/blog/"]"

And the sample response (note that I removed a lot of columns from the response for readability):

[{"feid":901504,"fejp":7.344112387236008,"fejr":7.4 
87130929872663e-07,"fid":23104,"fipl":19965,"fjp":8.237663818629526,"fjr":6.506748463818193e-06,"fmrp":6.842455688331352, [...] "utrr":6.651548800471646e-08,"uu":"www.seomoz.org/"},{"feid":901504,"fejp":7.344112387236008,"fejr":7.487130929872663e-07,"fid":23104,"fipl":19965,"fjp":8.237663818629526,"fjr":6.506748463818193e-06,"fmrp":6.842455688331352, [...] "utrr":4.742012098915273e-10,"uu":"www.seomoz.org/blog/"}] 

-J 

Patrick

unread,
May 26, 2010, 1:20:38 PM5/26/10
to SEOmoz API
Jeff,
Thank you very much for the response. I know how things can get - and
that is a great thing!
I did figure-out how to make my requests from our Java app by
monitoring the behavior of the Ruby gem your team provided.
All is working very well at this point.

Thanks again,
Patrick

On May 26, 1:13 pm, Jeff Pollard <j...@seomoz.org> wrote:
> Hello Patrick,
>

> Sorry for the immense delay, things have been a little busy around the
> office :)  The bulk API operates exactly the same as the normal API, except
> that your request to the API is a POST as opposed to a GET, and the request
> has a body - a JSON-encoded array of URLs.  The response from the API is a
> JSON-encoded array of url data, as opposed to just one JSON object of URL
> data.
>
> Here is a sample request with Curl for that data:
>
> curl "
>

> >http://lsapi.seomoz.com/linkscape/url-metrics/?AccessID=my_access_id&..."


> > --data "["www.seomoz.org/","www.seomoz.org/blog/"]"
>
> And the sample response (note that I removed a lot of columns from the
> response for readability):
>
> [{"feid":901504,"fejp":7.344112387236008,"fejr":7.4
>
> 87130929872663e-07,"fid":23104,"fipl":19965,"fjp":8.237663818629526,"fjr":6.506748463818193e-06,"fmrp":6.842455688331352,
>
> > [...] "utrr":6.651548800471646e-08,"uu":"www.seomoz.org/"},{"feid":901504,"fejp":7.344112387236008,"fejr":7.487130929872663e-07,"fid":23104,"fipl":19965,"fjp":8.237663818629526,"fjr":6.506748463818193e-06,"fmrp":6.842455688331352,
> > [...] "utrr":4.742012098915273e-10,"uu":"www.seomoz.org/blog/"}]
>
> -J
>

> > <seomoz-api%2Bunsu...@googlegroups.com<seomoz-api%252Buns...@googlegroups.com>

sumant kumar

unread,
May 30, 2016, 7:26:40 AM5/30/16
to SEOmoz API, je...@seomoz.org
Hi Jef,

When i make curl request to bulk API, it gives an error.

Here is my sample request:


Response:

{"status": "400", "error_message": "No JSON could be decoded from the request body. Please check your request for syntax errors."}

Please, let me know if i am doing anything wrong.
Reply all
Reply to author
Forward
0 new messages