Difference between revisions of "Submission Upload JSON API"

From SoFurry
Jump to: navigation, search
(Created page with 'Prior to submitting content, users have to be authenticated either via http session or via the sofurry OTP authentication mechanism. Submissions are posted via HTTP POST to http:...')
 
Line 3: Line 3:
  
 
  accessLevel 0
 
  accessLevel 0
  content <p> test</p>
+
  content test story blablabla
 
  contentLevel 0
 
  contentLevel 0
 
  contentPreview test
 
  contentPreview test
Line 15: Line 15:
 
  group[117] false
 
  group[117] false
 
  isHighlight false
 
  isHighlight false
  keywords sofurry
+
  keywords sofurry, tiger, wolf
  name test entry
+
  name This is the story title
 
  order none
 
  order none
 
  timestamp 1271058686
 
  timestamp 1271058686

Revision as of 08:02, 12 April 2010

Prior to submitting content, users have to be authenticated either via http session or via the sofurry OTP authentication mechanism. Submissions are posted via HTTP POST to http://sofurry.com/ajaxfetch.php with the following parameters (example):

accessLevel	0
content	test story blablabla
contentLevel	0
contentPreview	test
contentType	journals
display	Y
enableComments	1
enableVotes	1
folder	none
group[100]	false
group[10]	false
group[117]	false
isHighlight	false
keywords	sofurry, tiger, wolf
name	This is the story title
order	none
timestamp	1271058686

This leads to the following POST request:

http://sofurry.com/ajaxfetch.php?f=postPage&accessLevel=0&content=%3Cp%3E%0A%09test%3C%2Fp%3E%0A&contentLevel=0&contentPreview=%09test&contentType=journals&display=Y&enableComments=1&enableVotes=1&folder=none&group%5B100%5D=false&group%5B10%5D=false&group%5B117%5D=false&group%5B11%5D=false&group%5B123%5D=false&group%5B128%5D=false&group%5B14%5D=false&group%5B181%5D=false&group%5B185%5D=false&group%5B186%5D=false&group%5B187%5D=false&group%5B193%5D=false&group%5B194%5D=false&group%5B195%5D=false&group%5B197%5D=false&group%5B1%5D=false&group%5B204%5D=false&group%5B205%5D=false&group%5B207%5D=false&group%5B221%5D=false&group%5B232%5D=false&group%5B259%5D=false&group%5B288%5D=false&group%5B322%5D=false&group%5B384%5D=false&group%5B405%5D=false&group%5B410%5D=false&group%5B411%5D=false&group%5B425%5D=false&group%5B4%5D=false&group%5B512%5D=false&group%5B532%5D=false&group%5B53%5D=false&group%5B54%5D=false&group%5B558%5D=false&group%5B561%5D=false&group%5B568%5D=false&group%5B575%5D=false&group%5B577%5D=false&group%5B578%5D=false&group%5B5%5D=false&group%5B61%5D=false&group%5B666%5D=false&group%5B67%5D=false&group%5B6%5D=false&group%5B706%5D=false&group%5B70%5D=false&group%5B73%5D=false&group%5B789%5D=false&group%5B78%5D=false&group%5B7%5D=false&group%5B83%5D=false&group%5B857%5D=false&group%5B873%5D=false&group%5B88%5D=false&group%5B8%5D=false&group%5B95%5D=false&group%5B98%5D=false&isHighlight=false&keywords=sofurry&name=test%20entry&order=none&timestamp=1271058686


The response is a JSON-encoded message that looks as follows:

{"id":138740,"success":true,"message":""}

ID is the resulting page id of the new submission. "message" contains an error message if success is not true.



When posting artwork, the submission is a two-step process. In the first step the image is uploaded, in the second step the other content is set.

file <binary data>
f	postBinary
id	
contentType	artwork
cb	496


The response will look as follows:

<script type="text/javascript">
window.parent.window.__UploadBinary_496({"id":138741,"filename":"\/art\/images\/toumal\/toumal_banner.jpg","thumbnail":"\/art\/thumbnails\/toumal\/toumal_banner.jpg","width":728,"height":90,"fileSize":35575,"success":true,"message":null,"origFilename":"banner.jpg","contentType":1,"name":"banner"});
</script>


The following post has to set the other parameters of this submission:

accessLevel	0
content	test
contentLevel	0
contentPreview	test
contentType	artwork
display	Y
enableComments	1
enableVotes	1
fileSize	35575
filename	/art/images/toumal/toumal_banner.jpg
folder	none
group[100]	false
group[10]	false
group[117]	false
height	90
id	138741
isHighlight	false
keywords	sofurry
name	banner
order	none
origFilename	banner.jpg
success	true
thumbnail	/art/thumbnails/toumal/toumal_banner.jpg?t=1271059035299
timestamp	1271059183
width	728

The response is the same as for uploading a text submission:

{"id":"138741","success":true,"message":""}