Categorisations

Definition

A Categorisation is a series of questions and answers that needs to be answered to determine which Rules to use when Reviwing an Asset. Typically Categorisation is completed by a User and contains multiple questions or Categories.

As an example; one question could be 'Which channel?', and user needs to select from three options; Email, Mail, Online.

In this example; 'Which channel?' is the Category, and 'Email', 'Mail', 'Online' are are various Options.

Create a Categorisation

Request

User input required

You typically create a categorisation when you want your users to provide information about an Asset

POST /v2/categorisations HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
  "data": {
    "type": "categorisations",
    "attributes": {}
  }
}

Response

HTTP/1.1 201 Created
Content-Type: application/vnd.api+json

{
    "data": {
        "type": "categorisations",
        "id": "1003",
        "relationships": {
            "categories": {
                "data": [
                    {
                        "type": "categories",
                        "id": "1004"
                    },
                    {
                        "type": "categories",
                        "id": "1005"
                    },
                    {
                        "type": "categories",
                        "id": "1006"
                    }
                ]
            }
        },
        "links": {
            "self": "https://api.redmarker.ai/v2/categorisations/1003"
        }
    },
    "included": [
        {
            "type": "categories",
            "id": "1004",
            "attributes": {
                "description": "What channel?",
                "multiple": true,
                "order": 0,
                "options": [
                    {
                        "label": "Online",
                        "value": "1"
                    },
                    {
                        "label": "Email",
                        "value": "2"
                    },
                    {
                        "label": "Mail",
                        "value": "3"
                    }
                ],
                "selections": []
            },
            "relationships": {
                "categorisations": {
                    "data": {
                        "type": "categorisations",
                        "id": "1003"
                    }
                }
            },
            "links": {
                "self": "https://api.redmarker.ai/v2/categorisations/1003/categories/1004"
            }
        },
        {
            "type": "categories",
            "id": "1005",
            "attributes": {
                "description": "What region?",
                "multiple": true,
                "order": 1,
                "options": [
                    {
                        "label": "Region",
                        "value": "4"
                    },
                    {
                        "label": "Dometic",
                        "value": "5"
                    },
                    {
                        "label": "International",
                        "value": "6"
                    }
                ],
                "selections": []
            },
            "relationships": {
                "categorisations": {
                    "data": {
                        "type": "categorisations",
                        "id": "1003"
                    }
                }
            },
            "links": {
                "self": "https://api.redmarker.ai/v2/categorisations/1003/categories/1005"
            }
        },
        {
            "type": "categories",
            "id": "1006",
            "attributes": {
                "description": "What sub region?",
                "multiple": true,
                "order": 2,
                "options": [],
                "selections": []
            },
            "relationships": {
                "categorisations": {
                    "data": {
                        "type": "categorisations",
                        "id": "1003"
                    }
                }
            },
            "links": {
                "self": "https://api.redmarker.ai/v2/categorisations/1003/categories/1006"
            }
        }
    ]
}

When all selections have been made, the status will update accordingly (to something non pending).

Choose Options

Example: Select the value 3 option for the first Category with ID: 1004.

Request

PATCH /v2/categorisations/1003/categories/1004 HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
  "data": {
    "type": "category",
    "id": "1004",
    "attributes": {
      "selected": "3"
    }
  }
}

Response

Dynamic options

After choosing value 3 Category ID:1004, different options became available for Category ID:1005 based on this selection.

{
    "data": {
        "type": "categories",
        "id": "1004",
        "attributes": {
            "description": "What channel?",
            "multiple": true,
            "order": 0,
            "options": [
                {
                    "label": "Online",
                    "value": "1"
                },
                {
                    "label": "Email",
                    "value": "2"
                },
                {
                    "label": "Mail",
                    "value": "3"
                }
            ],
            "selections": [
                "3"
            ]
        },
        "relationships": {
            "categorisations": {
                "data": {
                    "type": "categorisations",
                    "id": "1003"
                }
            }
        },
        "links": {
            "self": "https://api.redmarker.ai/v2/categorisations/1003/categories/1004"
        }
    },
    "included": [
        {
            "type": "categorisations",
            "id": "1003",
            "relationships": {
                "categories": {
                    "data": [
                        {
                            "type": "categories",
                            "id": "1004"
                        },
                        {
                            "type": "categories",
                            "id": "1005"
                        },
                        {
                            "type": "categories",
                            "id": "1006"
                        }
                    ]
                }
            },
            "links": {
                "self": "https://api.redmarker.ai/v2/categorisations/1003"
            }
        },
        {
            "type": "categories",
            "id": "1005",
            "attributes": {
                "description": "What region?",
                "multiple": true,
                "order": 0,
                "options": [
                    {
                        "label": "International",
                        "value": "1"
                    },
                    {
                        "label": "Domestic",
                        "value": "2"
                    },
                    {
                        "label": "Local",
                        "value": "3"
                    }
                ],
                "selections": []
            },
            "relationships": {
                "categorisations": {
                    "data": {
                        "type": "categorisations",
                        "id": "1003"
                    }
                }
            },
            "links": {
                "self": "https://api.redmarker.ai/v2/categorisations/1003/categories/1005"
            }
        },
        {
            "type": "categories",
            "id": "1006",
            "attributes": {
                "description": "What sub region?",
                "multiple": true,
                "order": 2,
                "options": [
                {
                    "label": "Region A",
                    "value": "7"
                },
                {
                    "label": "Region B",
                    "value": "8"
                }
                ],
                "selections": []
            },
            "relationships": {
                "categorisations": {
                    "data": {
                        "type": "categorisations",
                        "id": "1003"
                    }
                }
            },
            "links": {
                "self": "https://api.redmarker.ai/v2/categorisations/1003/categories/1006"
            }
        }
    ]
}