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:...')
 
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
 +
{| style="width: 100%; background: #FF6600; margin: 1.2em 0 6px 0; border: 1px solid #ddd;"
 +
| style="width: 100%; color: #000;" |
 +
{| style="width: 100%; border: none; background: none;margin: 0.7em 0 0 0;"
 +
| style="width: 100%; text-align: center; white-space: nowrap; color: #000;" |
 +
NOTE: This API is OUTDATED and no longer supported! Please see https://wiki.sofurry.com/wiki/SoFurry_2.0_API for the new API!
 +
|}
 +
|}
 +
 
Prior to submitting content, users have to be authenticated either via http session or via the sofurry OTP authentication mechanism.
 
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):
+
Submissions are posted via HTTP POST to http://chat.sofurry.com/ajaxfetch.php with the following parameters (example):
  
 
  accessLevel 0
 
  accessLevel 0
  content <p> test</p>
+
  content test
 
  contentLevel 0
 
  contentLevel 0
 
  contentPreview test
 
  contentPreview test
Line 15: Line 24:
 
  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
Line 22: Line 31:
 
This leads to the following POST request:
 
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
+
  http://chat.sofurry.com/ajaxfetch.php?f=postPage
 +
&accessLevel=0
 +
&content=test
 +
&contentLevel=0
 +
&contentPreview=test
 +
&contentType=journals
 +
&display=Y
 +
&enableComments=1
 +
&enableVotes=1
 +
&folder=none
 +
&group%5B100%5D=false
 +
&group%5B10%5D=false
 +
&group%5B117%5D=false
 +
&isHighlight=false
 +
&keywords=sofurry
 +
&name=test%20entry
 +
&order=none
 +
&timestamp=1271058686
  
  
Line 37: Line 63:
 
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.
 
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>
+
  file [binary data]
 
  f postBinary
 
  f postBinary
  id
+
  id [empty if new artwork, submission id if editing existing submission]
 
  contentType artwork
 
  contentType artwork
 
  cb 496
 
  cb 496
Line 82: Line 108:
  
 
  {"id":"138741","success":true,"message":""}
 
  {"id":"138741","success":true,"message":""}
 +
 +
 +
 +
Explanation of parameters:
 +
 +
contentType: artwork, stories, journals, music
 +
accessLevel: 0=public, 1=registered users only, 2=group only, 3=friends only, 4=commission only, 5=private
 +
contentLevel: 0=clean, 1=adult, 2=extreme
 +
group[12345]: if true, his adds the submission to the group with the group id 12345. If false, the submission will be removed from that group.

Latest revision as of 20:24, 11 June 2018

NOTE: This API is OUTDATED and no longer supported! Please see https://wiki.sofurry.com/wiki/SoFurry_2.0_API for the new API!

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://chat.sofurry.com/ajaxfetch.php with the following parameters (example):

accessLevel	0
content	test
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://chat.sofurry.com/ajaxfetch.php?f=postPage
&accessLevel=0
&content=test
&contentLevel=0
&contentPreview=test
&contentType=journals
&display=Y
&enableComments=1
&enableVotes=1
&folder=none
&group%5B100%5D=false
&group%5B10%5D=false
&group%5B117%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	[empty if new artwork, submission id if editing existing submission]
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":""}


Explanation of parameters:

contentType: artwork, stories, journals, music
accessLevel: 0=public, 1=registered users only, 2=group only, 3=friends only, 4=commission only, 5=private
contentLevel: 0=clean, 1=adult, 2=extreme
group[12345]: if true, his adds the submission to the group with the group id 12345. If false, the submission will be removed from that group.