Skip to main content

Create a Post

This endpoint creates a post

info

This operation requires authentication.

HTTP Request

POST /api/v2/post/

Parameters

NameInTypeRequiredDescription
» textbodystringfalseThe content of the post in html format, it can contain some mentions
» categoriesbodylist(integer)trueList of id of Category
» mediasbodylist(integer)falseList of id of Media (only one media of type share is allowed)
» locationbodyobject¦nullfalseThe Location object to associate at the post
»» locationbodystring¦nulltruenone
»» latbodynumber¦nulltruenone
»» lngbodynumber¦nulltruenone
» pollbodyobject¦nullfalseThe poll object to associate at the post
»» titlebodystringtruenone
»» multiple_choicesbodybooleanfalsenone
»» expiration_atbodystring(date-time)falsenone
»» choicesbodylist(object)truenone
»»» choicebodystringtruenone
» addressingbodylist(integer)falseList of id of Tag

Example Body Parameters

{
"text": "string",
"categories": [0],
"medias": [0],
"location": {
"location": "string",
"lat": 0,
"lng": 0
},
"poll": {
"title": "string",
"multiple_choices": true,
"closed": true,
"expiration_at": "2019-08-24T14:15:22Z",
"choices": [
{
"choice": "string"
}
]
},
"addressing": []
}

Example Request

const inputBody = '{
"text": "string",
"categories": [0],
"medias": [0],
"location": {
"location": "string",
"lat": 0,
"lng": 0
},
"poll": {
"title": "string",
"multiple_choices": true,
"closed": true,
"expiration_at": "2019-08-24T14:15:22Z",
"choices": [
{
"choice": "string"
}
]
},
"addressing": []
}';
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
201CreatednonePost

Example responses

{
"id": 0,
"type": "post",
"categories": [
{
"id": 0,
"tags": [],
"followed": false,
"order": 123,
"name": "string",
"name_synonyms": "string",
"slug": "string",
"slogan": "string",
"html_info": "string",
"seo_title": "string",
"seo_description": "string",
"auto_follow": "none",
"active": true,
"image_original": "string",
"image_bigger": "string",
"image_big": "string",
"image_medium": "string",
"image_small": "string",
"emotional_image_original": "string",
"emotional_image_position": 0,
"lastmod_datetime": "2019-08-24T14:15:22Z",
"stream_order_by": "recent",
"followers_counter": 13
}
],
"medias": [
{
"id": 0,
"added_at": "2019-08-24T14:15:22Z",
"type": "url",
"title": "string",
"description": "string",
"url": "https://example.com",
"image": "string",
"image_width": 0,
"image_height": 0,
"order": 0,
"embed": {
"id": 0,
"embed_type": "string",
"embed_id": "string",
"url": "string",
"metadata": {}
}
}
],
"location": {
"location": "string",
"lat": 0,
"lng": 0
},
"poll": {
"id": 0,
"title": "string",
"multiple_choices": true,
"added_at": "2019-08-24T14:15:22Z",
"modified_at": "2019-08-24T14:15:22Z",
"closed": true,
"expiration_at": "2019-08-24T14:15:22Z",
"hidden": "string",
"choices": [
{
"id": 0,
"choice": "string",
"order": 0,
"added_at": "2019-08-24T14:15:22Z",
"deleted": "string",
"vote_count": 0,
"voted": true
}
]
},
"last_activity_at": "2019-08-24T14:15:22Z",
"last_edited_at": null,
"author": {
"id": 0,
"username": "string",
"real_name": "string",
"date_joined": "2019-08-24T14:15:22Z",
"bio": "string",
"location": "string",
"location_lat_lng": "string",
"position_lat_lng": "string",
"date_of_birth": "string",
"description": "string",
"gender": "Male",
"website": "https://example.com",
"avatar": "string",
"cover": "string",
"ext_id": "string",
"tags": [],
"reputation": 111,
"followings_counter": 0,
"followers_counter": 0,
"posts_counter": 0,
"discussions_counter": 0,
"statuses_counter": 0,
"polls_counter": 0
},
"added_at": "2019-08-24T14:15:22Z",
"summary": "string",
"deleted": true,
"collapsed": false,
"comment_count": 0,
"vote_count": 0,
"voted": false,
"followed": false,
"suspended": true,
"flag_count": 0,
"share_count": 0,
"addressing": []
}