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) If this field is omitted, the language will be detected automatically based on the title and description text, even if a different language was explicitly specified during a previous request.
category int (category id) If this field is omitted, the question will keep its category.
tag_relations { "tag": "Sherlock", "is_auto": true } List of tags. Must be between 1 and 10 tags.

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": false
        },
        {
             "tag": "Death",
             "is_auto": false 
        },
        {
             "tag": "Moriarty",
             "is_auto": false
        }
    ],
    "attachments": "/questions/47/attachments",
    "category": 123
}


Publish a Question

PUT /questions/:id/publish

Publishes a draft.

Note that published questions are subjected to a stricter validation than question drafts. For example, for a question to be published, it must have at least one tag relation. 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 will be number of experts who have been informed for that 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.