Question POST Resources


Create a Question

POST /questions
Parameter Type Default Required Description
title string - Between 10 and 100 characters.
description string (HTML + mentioning markup) null Unlimited length.
language string (language code) (automatically detected) 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 code) null If this field is omitted, the question will be uncategorized.

Payload

{
  "title": "Is Sherlock really dead?",
  "description": "<p>Post any information to 221B Baker Street, London.</p>",
  "category": 123
}

Be aware that this will not publish the question, it will be saved as a draft. It can be published with the question publish endpoint.

NOTE: We've deprecated the possibility to add tags to the question via the API. This is no longer possible. The JSON payload will however not fail deserialization if fields tag_relations and auto_tag_relations_excluded are present - it will be ignored. Field tag_relations are however still present in the response although they will only ever be auto tags.

Response

The endpoint will respond with the question resource.

{
    "id": "47",
    "is_published": false,
    "published": null,
    "language": "en",
    "title": "Is Sherlock really dead?",
    "slug": "is-sherlock-holmes-really-dead",
    "description": "<p>Post any information to 221B Baker Street, London.</p>",
    "solution_count": 0,
    "view_count": 28,
    "image": "https://cdn.example.com/avatar/default/2d/1b84215e2f035a22f6fec213d3b1d9.jpg",
    "created": "2014-01-02T10:13:21.000Z",
    "updated": "2014-01-02T10:13:22.000Z",
    "content_updated": "2014-01-02T10:13:23.000Z",
    "tag_relations": [
        {
             "tag": "Sherlock",
             "is_auto": true
        }
    ],
    "category": {
      "id": 123,
      "name": "A Category",
      "description": "Very interesting stuff.",
      "color": "#aa00ff",
      "translations": [
        {
          "language": "es",
          "name": "Una categoría",
          "description": "Cosas muy interesantes."
        }
      ]
    }
}


Register a view

POST /questions/:ID/view

Response

This request does not have a body, and in case of success, a HTTP 200 OK without body will be sent.


Set question image

This endpoint is deprecated since 2.94.0. The endpoint will always return successfully with the question object, but no question image will be updated.

POST /questions/:ID/image

Response

{
    "id": "47",
    "is_published": false,
    "language": "en",
    "title": "Is Sherlock really dead?",
    "slug": "is-sherlock-holmes-really-dead",
    "description": "<p>Post any information to 221B Baker Street, London.</p>",
    "solution_count": 0,
    "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-03T11:10:45.000Z",
    "tag_relations": [
        {
             "tag": "Sherlock Holmes",
             "is_auto": false
        },
        {
             "tag": "Moriarty",
             "is_auto": false
        }
    ],
    "attachments": "/questions/47/attachments",
    "category": "/categories/123"
}