Create/update collection

Hello,

I’m trying to use the API to create/update collection schema.

As per the documentation, it should be possible to update but I’m getting 404. Below is my request.

Is it otherwise possible to create a new collection using the same/another endpoint?

Thanks

Hang

POST /api/collections/updateCollection/apitest HTTP/1.1
Host: https://mycockpit.com
Cockpit-Token: mytoken
Content-Type: application/json

{
    "fields": [
        {
            "name": "display_name",
            "label": "Display Name",
            "type": "text",
            "default": "",
            "info": "Name of the country as displayed to customers",
            "group": "",
            "localize": false,
            "options": [],
            "width": "1-1",
            "lst": true,
            "acl": [],
            "required": false
        }
    ]
}

You have to wrap your object with a data object, see: https://getcockpit.com/documentation/api/collections

{
    "data": {
        "fields": [
            {
                "name": "display_name",
                "label": "Display Name",
                "type": "text",
                "default": "",
                "info": "Name of the country as displayed to customers",
                "group": "",
                "localize": false,
                "options": [],
                "width": "1-1",
                "lst": true,
                "acl": [],
                "required": false
            }
        ]
    }
}