Difference between revisions of "Submission Upload JSON API"
(3 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 test | + | content test |
contentLevel 0 | contentLevel 0 | ||
contentPreview test | contentPreview test | ||
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= | + | 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 | ||
+ | ×tamp=1271058686 | ||
Latest revision as of 20:24, 11 June 2018
|
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 ×tamp=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.