Status update: The APIs are finally live on the mainnet. At this moment, all the APIs writing data require the whitelisting of your address. Contact the dev team on Slack to get whitelisted.
Join Primas developer community on Slack: https://slack.primas.io
3.0
Primas is a platform for premium quality content based on DTCP (Decentralized Trusted Content Protocol). Primas uses blockchain technology to ensure the credibility of content, uses economic incentives to accelerate the generation and circulation of high-quality content, and allows readers to see personalized, high-quality content through social recommendations. Traditional Internet applications can also use APIs to access Primas, immediately gaining access to the power Primas offers.
Primas decentralized network is accessible through one of the Primas Nodes. And every Primas Node exposes the same collection of APIs as described in this document. To use these APIs, you need to find a live Primas Node or host one yourself. Nodes hosted by the Primas development team are accessible at:
Testnet: https://staging.primas.io
Mainnet Nodes:
- Rigel A: https://pstdaily.com
- Betelgeuse: https://betelgeuse.primas.network
The getting started guide will walk you through the general process of connecting a traditional content application to Primas. Be sure to check the basic concepts about Primas and DTCP before you start.
APIs are served using standard RESTful methods with HTTPS. For posting, both JSON and Form-Data are supported for request body. Data sent from Primas Node is always in JSON format.
To post data in JSON format, set Content-Type
to application/json
in http header. To post using
Form-Data, set Content-Type
to application/x-www-form-urlencoded
or multipart-formdata
to upload images.
API should be prefixed with API version. For example, when trying to get the metadata for an article. We should call:
GET https://staging.primas.io/v3/content/1GFYUNP815RUIFDNNRKLNU78RPCFLNL5DWGT7EXODHFVRCRVXJ
The response data will always include a field result_code
indicating the invocation status.
On successful invocation result_code
will be 0
. And the response data is in the field data
.
Otherwise result_code
will be the corresponding error type while at the same time there will be another field
result_msg
containing the detailed description of the error.
Primas is built upon DTCP. A lot of APIs are transferring data in the DTCP standard. Check the DTCP brief introduction for a detailed explanation about DTCP and its usage in Primas.
APIs creating object, such as posting article, creating group, sharing article, all support batch post. Batch post can
only be used with JSON format posting. To post in batch, simply pass a JSON array whose elements are the same group of
metadata passed when creating a single object. The returning data
field becomes an array containing the corresponding
data for each metadata in the same order then.
- Content APIs
- Content Interaction APIs
- 1. Get share metadata
- 2. Get the shares of a group share
- 3. Get share reports
- 4. Report share
- 5. Get the likes of a group share
- 6. Like a group share
- 7. Cancel the like of a group share
- 8. Get the comments of a group share
- 9. Get replying comments of a comment
- 10. Comment a group share
- 11. Update the comment of a group share
- 12. Delete the comment of a group share
- Group APIs
- 1. Get group metadata
- 2. Create group
- 3. Update group
- 4. Dismiss group
- 5. Get group members
- 6. Join group
- 7. Approve or decline member application
- 8. Quit group or kick member out
- 9. Get group member whitelist
- 10. Add group member whitelist
- 11. Approve or decline group member whitelist
- 12. Quit group member whitelist
- 13. Get group shares
- 14. Share to a group
- 15. Approve or decline share application
- 16. Delete group share
- 17. Get group avatar metadata
- 18. Get group avatar raw image
- Account APIs
- 1. Get account metadata
- 2. Create account
- 3. Update account metadata
- 4. Get account credits list
- 5. Get account content list
- 6. Get account groups list
- 7. Get account shares
- 8. Get account shares in a single group
- 9. Get account likes
- 10. Get account comments
- 11. Get account group applications
- 12. Get account share applications
- 13. Get account report list
- 14. Get account notifications
- 15. Get account avatar metadata
- 16. Get account avatar raw image
- Token APIs
- Timeline APIs
- Query APIs
- System APIs
- Node APIs
result_code | result_msg | description |
---|---|---|
0 | success | Success |
400 | client error | Client error |
401 | invalid data | Invalid post data |
402 | parse input JSON format error | Invalid JSON string |
403 | client signature error | Signature verification failed |
404 | input parameter error | Invalid parameter |
405 | input parameter empty | Empty parameter |
406 | nonce less than lasted | Nonce is used before |
500 | server error | Server error |