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.
Name | In | Type | Required | Description |
---|---|---|---|---|
» text | body | string | false | The content of the post in html format, it can contain some mentions |
» categories | body | list(integer) | true | List of Category ids |
» group | body | integer | false | The id of the group |
» event | body | integer | false | The id of the event |
» medias | body | list(integer) | false | List of Media (only one media of type share is allowed) ids |
» location | body | object¦null | false | The Location object to associate at the post |
»» location | body | string¦null | true | Location name |
»» lat | body | number¦null | true | Location latitude |
»» lng | body | number¦null | true | Location longitude |
» poll | body | object¦null | false | The poll object to associate to the post |
»» title | body | string | true | Poll title |
»» multiple_choices | body | boolean | false | If poll choices can be multiple |
»» expiration_at | body | string(date-time) | false | Poll expiration datetime |
»» choices | body | list(object) | true | Poll choices objects |
»»» choice | body | string | true | Poll choice title |
» addressing | body | list(integer) | false | List of Tag ids |
Example Body Parameters
- JSON
{
"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
- JavaScript
- Bash
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);
});
# You can also use wget
curl -X POST /api/v2/post/ \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access_token}' \
--data-raw '{
"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"]
}'
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | Response status code | Post |