Skip to main content

Create a Post

This endpoint creates a post

info

This operation requires authentication.

HTTP Request

POST /api/v2/post/

Parameters

info

By passing a category id that has parents defined, the system will automatically ascend the category graph based on the parents and will also automatically add the parents category ids to the post.

NameInTypeRequiredDescription
» textbodystringfalseThe content of the post in html format, it can contain some mentions
» categoriesbodylist(integer)trueList of Category ids
» groupbodyintegerfalseThe id of the group
» eventbodyintegerfalseThe id of the event
» mediasbodylist(integer)falseList of Media (only one media of type share is allowed) ids
» locationbodyobject¦nullfalseThe Location object to associate at the post
»» locationbodystring¦nulltrueLocation name
»» latbodynumber¦nulltrueLocation latitude
»» lngbodynumber¦nulltrueLocation longitude
» pollbodyobject¦nullfalseThe poll object to associate to the post
»» titlebodystringtruePoll title
»» multiple_choicesbodybooleanfalseIf poll choices can be multiple
»» expiration_atbodystring(date-time)falsePoll expiration datetime
»» choicesbodylist(object)truePoll choices objects
»»» choicebodystringtruePoll choice title
» addressingbodylist(integer)falseList of Tag ids

Example Body Parameters

{
"text": "string",
"categories": ["integer"],
"medias": ["integer"],
"location": {
"location": "string",
"lat": "integer",
"lng": "integer"
},
"poll": {
"title": "string",
"multiple_choices": "boolean",
"closed": "boolean",
"expiration_at": "string",
"choices": [
{
"choice": "string"
}
]
},
"addressing": ["integer"],
"tags": ["integer"]
}

Example Request

const inputBody = '{
"text": "string",
"categories": ["integer"],
"medias": ["integer"],
"location": {
"location": "string",
"lat": "integer",
"lng": "integer"
},
"poll": {
"title": "string",
"multiple_choices": "boolean",
"closed": "boolean",
"expiration_at": "string",
"choices": [
{
"choice": "string"
}
]
},
"addressing": ["integer"],
"tags": ["integer"]
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization': 'Bearer {access_token}'
};

fetch('/api/v2/post/',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});

Responses

StatusMeaningDescriptionSchema
201CreatedResponse status codePost