Questions And Answers

This is the final step of the process where one can request questions along with answers as required.


Endpoint

POST /content/qna/{content-model-id}/

Request Headers:

Authentication: Token <user-generated-token>

Request Payload:

{
    "article": "cards",
    "params": "json encoded string with following definition"
}

JSON encoded string for params is the set of parameters required for the content model and as requested by the models query.

{
    "page": {
        "id": "UID",
        "category": ["category1","category2"],
        "count":2
    }
}

The parameters are:

  • page: An object for which questions have to be generated.
  • id: Any UUID wrt your content model, which can be a link or some id for your data extraction api according to the relevant content model for you. It is the context accessed via this id on which the questions can be generated.
  • category: Category of questions required (depends on the content model) and possible values would be shared appropriately.
  • count: The count of questions for each category. A category dependent maximum value might be set internally and would be communicated with the model.

Response:

{
    "success": true,
    "article": {
        "cards": [
            {
                "id": "UID",
                "category": "category1",
                "question": "This is the first question about category 1",
                "answer": "This is an answer to this question. The context of the answer is seeded from the link requested"
            },
            {
                "id": "UID",
                "category": "category1",
                "question": "This is the second question about category 1",
                "answer": "This is an answer to this question. The context of the answer is seeded from the link requested"
            },
            {
                "id": "UID",
                "category": "category2",
                "question": "This is the first question about category 2",
                "answer": "This is an answer to this question. The context of the answer is seeded from the link requested"
            },
            {
                "id": "UID",
                "category": "category2",
                "question": "This is the second question about category 2",
                "answer": "This is an answer to this question. The context of the answer is seeded from the link requested"
            }
        ]
    },
    "code": 123,
    "message": "some message explaining code and status"
}

Curl:

curl -X POST 'http://stage.brahmastra.tech/content/qna/<model_id>/' -d 'article=cards&params={"page":{"id":"UID","category":["category1","category2"],"count":2}}' -H 'Authorization: Token <your-auth-token-generated-above>'