This is a simple documentation which i made for you. here i am going to show you how to interact with discourse platform i.e https://metastudio.org/ using discourse API’s.This documentation gives you a overview of a DISCOURSE APIs using curl.
For interacting to discourse platform using API’s, one important thing you need is API Key. Without API key you can not interact with discourse platform i.e https://metastudio.org/
To create an API key, Make sure you are admin of the site. once you have a proper access to the site, then follow the below steps as shown in the images to create an api key:
[size=6]GET API’s:[/size]
The GET request simply looks like this, for getting a specific resources. Once you have your API Key you can pass it in along with your API Username as an HTTP header like this:
Get some groups:
curl -X GET "https://metastudio.org/groups.json" -H "Api-Key: 9179xa8f80c6943ead9c7ab19ad3c67f542838a8ae2a854910d3a1dxd14773cf" -H "Api-Username: username"
Most API endpoints provide the same content as their HTML counterparts. For example the URL /groups
(i.e ChatShaala) serves a list of groups, the /groups.json
(i.e https://metastudio.org/groups.json) API provides the same information in JSON format.
Get some categories:
curl -X GET "https://metastudio.org/categories.json" -H "Api-Key: 91798a8f80c6943ead9c7ab19ad3c67f542838a8ae2a814910d3a1ded14773cf" -H "Api-Username: username"
URL /categories
(i.e ChatShaala - chatShaala for life-long STEM Education! Collaborative Open Online and Ongoing Learning through STEM games, activities and projects and earn badges from the referees!) serves a list of categories, the /categories.json
(i.e https://metastudio.org/categories.json) API provides the same information in JSON format.
Get a single Topic:
curl -X GET "https://metastudio.org/t/project-ideas-wiki-page/3801.json" -H "Api-Key: 91798a8f80c6943ead9c7abe9ad3c67f542s38a8ae2a854510d3a1ded14773cf" -H "Api-Username: username"
Note: Api-Username: name of the registered user of discourse platform i.e https://metastudio.org.
Api-key: Api key can be created by admin only.
[size=6]POST API’s[/size]
The Content-Type for POST and PUT requests can be set to application/x-www-form-urlencoded
, multipart/form-data
, or application\json
.
Create a single topic:
curl -X POST "https://metastudio.org/posts.json" \
-H "Content-Type: multipart/form-data;" \
-H "Api-Key: 91798a8f80c6943ead9c7ab19ad3c17f542838a8ae2a854910d3a1ded14773cf" \
-H "Api-Username: username" \
-F "title=new topic creating for testing" \
-F "raw=desc of new topic creating for testing" \
-F "archetype=regular" \
-F "category=5"
Likewise you can use PUT and DELETE API’s.
Refer below urls for more info:
when js framework is finalized to this project, after that i will make one more documentation on that framework. where i will show you how to write api calls using that framework.
Please feel free to ask any query.