Difference between revisions of "Submission Download JSON API"

From SoFurry
Jump to: navigation, search
m (Listing: Updating URL to chat.sofurry.com ... per Toumal.)
m (Downloading: Updating URL to chat.sofurry.com ...)
Line 64: Line 64:
 
To download a story, you have to issue a separate request:
 
To download a story, you have to issue a separate request:
  
   http://sofurry.com/ajaxfetch.php?f=getpagecontent&pid=12345
+
   http://chat.sofurry.com/ajaxfetch.php?f=getpagecontent&pid=12345
  
 
12345 being the page id of the story you want to download.
 
12345 being the page id of the story you want to download.

Revision as of 15:14, 28 May 2012

Downloading submissions from SoFurry is a two stage process: Listing and downloading. Downloads are pretty straightforward for images and music, all you need is the file URL which you get in a listing request. Downloading stories is done via a separate request.

Listing

Here is an example listing request:

 http://chat.sofurry.com/ajaxfetch.php?f=browse&sort=0&contentType=-1&viewSource=0&page=0

Explanation of parameters:

 sort: 0 = sort by date
       1 = sort by title
       2 = sort by popularity
 
 contentType: -1 = all content
              0 = stories
              1 = art
              2 = music
              3 = journal
 
 viewSource: 0 = all
             1 = favorites (needs viewUserID parameter in request!)
             2 = watchlist (needs viewUserID parameter in request!)
             3 = folder (needs folderID parameter in request!)
             4 = groups (needs gid parameter with the group ID in request!)
             5 = search (needs search parameter with comma separated tags in request!)
             6 = commission (needs cid parameter with commission ID in request!)
             7 = user (needs viewUserID parameter in request!)
             8 = featured
             9 = highlights (needs viewUserID parameter in request!)
             10 = group watchlist (needs viewUserID parameter in request!)
             11 = combined watchlist (needs viewUserID parameter in request!)
 
 page: 0..n (available number of pages is returned with the response to this request)


Note: Personal data like user favorites and watchlist may be blocked for non-authorized requests. If your app is to be used by the user himself querying his own data, be sure to send proper OTP authentication credentials to gain access to this information. Access to group galleries may require OTP authentication as a user who is member of that group, depending on the group visibility setting.


The response will look like this:

 {"success":"true","currentpage":"0","totalpages":233,"messageType":3,"pagecontents":[
   {"currentpage":0,"totalpages":233,"messageType":3,"items":[
     {"href":"\/page\/142819\/tab\/browse all",
      "pid":"142819",
      "name":"Psicosis Drain",
      "authorName":"Aitos Saibankan",
      "authorId":"30791",
      "thumb":"\/art\/thumbnails\/aitos-saibankan\/aitos-saibankan_psicosis-drain.jpg",
      "contentType":"1",
      "date":"1-May-2010",
      "width":40,"height":55,
      "contentLevel":"1",
      "keywords":"Wolf, Masturbation, Magic, Demon, Mind Control, Dark, M\/M"},
     {"href":...
      ...
     }
   ]}
 ]}

Downloading

To download a story, you have to issue a separate request:

 http://chat.sofurry.com/ajaxfetch.php?f=getpagecontent&pid=12345

12345 being the page id of the story you want to download. The response looks as follows:

{"id":"12345","success":true,"content":"Story content in html format"}