Skip to main content

Create a Discussion

This endpoint creates a discussion.

info

This operation requires authentication

HTTP Request

POST /api/v2/discussion/

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 discussion.

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

Example Body Parameters

{
"title": "string",
"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 = {
"title": "string",
"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/discussion/',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});

Responses

StatusMeaningDescriptionSchema
201CreatedResponse status codeDiscussion