Difference between revisions of "API Usage Guide"

From SailBlogs Support Wiki
Jump to: navigation, search
Line 16: Line 16:
 
* contents
 
* contents
 
* comments
 
* comments
 +
** msgID
 
* curxp
 
* curxp
 
* curpc
 
* curpc

Revision as of 14:29, 19 January 2010

The following section describes the HTTP requests that can be made to the SailBlogs server, and the XML response that is returned.

Base URL

All calls to the SailBlogs API will be made to the following URL:

http://www.sailblogs.com/api/sbapi.php

URL Parameters

auth

Authorization key. This is REQUIRED for all API calls.

http://www.sailblogs.com/api/sbapi.php?auth=ZGVtb0BzYWlsYmxvZ3MuY29tOmxhbmRyMHZlcg,,

dt

Datatype indicator. This tells the API what kind of information you're requesting. Possible values are:

  • blog
    • items
  • contents
  • comments
    • msgID
  • curxp
  • curpc
  • test

dt=blog

http://www.sailblogs.com/api/sbapi.php?auth=ZGVtb0BzYWlsYmxvZ3MuY29tOmxhbmRyMHZlcg,,&dt=blog

Output:

<xjournal>
   <api_res>0</api_res>
   <api_res_msg>Ok</api_res_msg>
   <entry>
      <msgID>114806</msgID>
      <postDate>2009-09-29 11:09:37</postDate>
      <title>This is test entry 3 with a lat/long included</title>
      <location>Minneapolis</location>
      <author></author>
      <imageFile/>
      <thumbnail/>
      <teaser>
      This is a blog post that includes a lat/long reference and a youtube video:

      [%youtube*http://www.youtube.com/watch?v=-lriRLdiAQE%v]

      Line below video...
      </teaser>
      <body>
      This is a blog post that includes a lat/long reference and a youtube video:
      
      [%youtube*http://www.youtube.com/watch?v=-lriRLdiAQE%v]

      Line below video...
      </body>
      <comments>0</comments>
      <nextmsg/>
      <prevmsg/>
      <latitude>44 57.22'N</latitude>
      <longitude>193 22.36'W</longitude>
      <declat>44.9537</declat>
      <declong>-193.3727</declong>
   </entry>
</xjournal>

If the items parameter is included, the system will return the number of blog posts requested:

http://www.sailblogs.com/api/sbapi.php?auth=ZGVtb0BzYWlsYmxvZ3MuY29tOmxhbmRyMHZlcg,,&dt=blog&items=3

The above will return the three most recent entries.

dt=contents

Returns the table of contents for a particular blog:

http://www.sailblogs.com/api/sbapi.php?auth=ZGVtb0BzYWlsYmxvZ3MuY29tOmxhbmRyMHZlcg,,&dt=contents

Output:

<xjournal>
   <api_res>0</api_res>
   <api_res_msg>Ok</api_res_msg>
   <entry>
      <msgID>114806</msgID>
      <postDate>2009-09-29 11:09:37</postDate>
      <title>This is test entry 3 with a lat/long included</title>
      <location>Minneapolis</location>
      <author></author>
      <imageFile/>
      <display/>
   </entry>
   <entry>
      <msgID>114804</msgID>
      <postDate>2009-09-28 11:06:19</postDate>
      <title>This is entry number 2</title>
      <location>Minneapolis</location>
      <author>Tim</author>
      <imageFile/>
      <display/>
   </entry>
   <entry>
      <msgID>103152</msgID>
      <postDate>2009-09-27 10:50:36</postDate>
      <title>This is my first entry</title>
      <location></location>
      <author></author>
      <imageFile>p1010001_scale.jpg</imageFile>
      <display>p1010001_scale.jpg</display>
   </entry>
</xjournal>