Article

One can request articles as required using this API endpoint.


Endpoint

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

Request Headers:

Authentication: Token <user-generated-token>

Request Payload:

{
    "article": "cards / cards-html / continuous / continuous-html / sectioned / sectioned-html",
    "params": "json encoded string with following definition",
    "preview": false,
    "id": "Optional article id (v4 uuid) to retrieve previously generated article."
}

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

{
    "key(available in ‘key’ field in model response payload)": "data (appropriate user data)",
    "key(available in ‘key’ field in model response payload)": "data(appropriate user data)"
}

Response:

{
    "success": true,
    "article": {
        "html": "This attribute is present only if requested type is one of continuous-html / sectioned-continuous-html",
        "text": "This attribute is present only if requested type is one of continuous / sectioned-continuous and contains a new line separated text",
        "cards": [
            {
                "html": "Only this if requested type is cards-html else others",
                "text": "Only if requested type is cards",
                "title": "Title of the card",
                "subheading": "Subheading of the card"
            }
        ]
    },
    "id": "Article id (v4 uuid) to retrieve same article. Aimed to provide the article for which the preview was created.",
    "code": 123,
    "message": "some message explaining code and status"
}

Curl:

curl -X POST 'https://api.brahmastra.tech/content/article/<model_id>/' -d 'article=sectioned-html&params={"source":"Maruti Baleno"}' -H 'Authorization: Token <your-auth-token-generated-above>'