Skip to content

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": {
      "name": "Descriptive name"
    }
  }
}

Response

Pending status

Initially the Categorisation is in a pending status. This indicates that you still need to choose the Options

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

{
    "data": {
        "type": "categorisations",
        "id": "1003",
        "attributes": {
          "name": "Descriptive name",
          "status": "pending"
        },
        "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"
            }
        }
    ]
}

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": "categories",
    "id": "1004",
    "attributes": {
      "selections": ["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"
            }
        }
    ]
}

Mark as completed

Once you have completed making your selections against the various Categories, you need to mark the overall Categorisation status as completed as per the request below.

Critical step

It is essential to mark the Categorisations as completed otherwise the associated Review(s) will not commence. The Categorisation needs to be patched with a status of completed before a Review is created.

Request

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

{
  "data": {
    "type": "categorisations",
    "id": "1003",
    "attributes": {
      "status": "completed"
    }
  }
}