JPT Post interface
Introduction
PostAction
is associated with all post and partly thread related jobs.
All interfaces of this controller is placed under /user
path.
All interfaces require authentication fields.
API
Add Post
To add a new post. Use this interface to create post metadata without uploading the torrent file.
1 |
|
The post
object is exactly as specification, but user could not specify the id of post to be persisted as well as some of other fields like postTime
, infoHash
, rate
.
Note that the minLevel
is to set the minimum required level of user to download. User could not create
a level without proper permission. Ideally, user should choose a level from list.
Update Post meta and content
Use this interface to update the meta data and content of a post.
Only author and administrators could update a post.
1 |
|
This interface has the same restriction as Add post
.
The target post to be updated will be and only be the {pid}
specified in URL.
Get Post metadata and content
Anyone could see any post.
1 |
|
Delete Post
Only author and administrators could delete a post.
1 |
|
Add Thread for a Post
Any user could reply thread to post
1 |
|
Thread
object is exactly as specification. But for user could specify few fields as the example above.
the target post is specified in URL, replyer is specified in request header uid
.
Get Thread page for a Post
Get a page of threads, page number starts from 1 and default as 1.
Default page size is 5.
1 |
|
Upload torrent file of a Post
Upload the corresponding torrent file of a post.
Only author could upload it.
A torrent file could and only could upload to a post once. If user finds the torrent is incorrect, they have to re-post and upload again.
1 |
|
Just like other file uploads, must upload the origin torrent file directly to server.
It actually uploads the torrent file as byte array.
Download torrent file of a Post
Only users that reach minLevel
requirement of a post could download the torrent file.
1 |
|
If everything run smoothly, client side will get a response with header
Content-Disposition: attachment; filename=hash.torrent;
which means user will get browser prompt to get download. Depending on browser implementation in detail.