Question PUT Resources
Update a Question
PUT /questions/:id
Parameter | Type | Description |
---|---|---|
title |
string |
Between 10 and 100 characters. |
description |
string (HTML + mentioning markup) |
Unlimited length. |
language |
string (language code) |
The question language will be detected automatically based on the title and description text. Providing a language explicitly is usually not necessary, and only helps in cases where the automatic language detection is not able to detect the language unambiguously (e.g. when title and description are in different languages). |
category |
int (category id) |
If this field is omitted, the question will keep its category. |
Payload
{
"title": "Is Sherlock Holmes really dead?"
}
There is no need to send the entire question resource to update a single property, it is sufficient to send the properties that have to change.
Only the author and admins are allowed to edit questions.
Response
In response, the full question is given.
{
"id": "47",
"is_published": true,
"published": "2015-02-02T11:36:05.000Z",
"language": "en",
"title": "Is Sherlock Holmes really dead?",
"slug": "is-sherlock-holmes-really-dead",
"description": "<p>Post any information to 221B Baker Street, London.</p>",
"solution_count": 0,
"view_count": 29,
"image": "https://cdn.example.com/avatar/default/2d/1b84215e2f035a22f6fec213d3b1d9.jpg",
"created": "2014-01-02T10:13:21.000Z",
"updated": "2014-01-03T12:16:45.000Z",
"content_updated": "2014-01-03T12:16:45.000Z",
"tag_relations": [
{
"tag": "Sherlock Holmes",
"is_auto": true
},
{
"tag": "Death",
"is_auto": true
}
],
"attachments": "/questions/47/attachments",
"category": {
"id": 123,
"name": "A Category",
"description": "Very interesting stuff.",
"color": "#aa00ff",
"translations": [
{
"language": "es",
"name": "Una categoría",
"description": "Cosas muy interesantes."
}
]
}
}
Publish a Question
PUT /questions/:id/publish
Publishes a question draft. This means that the question becomes visible to other users, and that relevant experts will be notified and requested to answer the question.
Note that published questions are subjected to a stricter validation than question drafts. While a question draft can have an empty title, a published question must have a nonempty title. For this reason, the publish endpoint might respond with a validation error, even though the question draft was previously created without validation errors.
Response
The response contains the number of experts who have been notified about the question.
{
"number_of_experts": 5
}
Restore a deleted question
PUT /questions/:ID/restore
This request does not have a body, and in case of success, a HTTP 200 OK
without body will be sent.