Create/Update and Delete Categories

Instructions

When creating a category our API will create a unique "ID" for that category, so you can update or delete it.

Category creation example

{
    "categories": [
        {
            "name": "categoria base"
        },
        {
            "name": "categoria base > subcatgoria"
        },
        {
            "name": "categoria base > subcatgoria > tipo"
        },
        {
            "name": "categoria base > outrasubcategoria > outrotipo"
        }
    ]
}

Example of category return

In the example return after creating the category, see that each category has an "id".

{
    "categories": [
        {
            "name": "categoria base",
            "id": "60c76e2c6c2d0b7c3fb21fa0"
        },
        {
            "name": "categoria base > subcatgoria",
            "id": "60c76e2c6c2d0b7c3fb21fa1"
        },
        {
            "name": "categoria base > subcatgoria > tipo",
            "id": "60c76e2c6c2d0b7c3fb21fa2"
        },
        {
            "name": "categoria base > outrasubcategoria > outrotipo",
            "id": "60c76e2c6c2d0b7c3fb21fa3"
        }
    ]
}

Update Example

In this example update I will change the category name "categoria base" to "categoria example".

I will use the "id" of the category to make this name change.

category id: 60c76e2c6c2d0b7c3fb21fa0

{
    "categories": [
        {
            "name": "categoria example",
            "id": "60c76e2c6c2d0b7c3fb21fa0"
        }
    ]
}

Example of category return

{
    "categories": [
        {
            "name": "categoria example",
            "id": "60c76e2c6c2d0b7c3fb21fa0"
        },
        {
            "name": "categoria base > subcatgoria",
            "id": "60c76e2c6c2d0b7c3fb21fa1"
        },
        {
            "name": "categoria base > subcatgoria > tipo",
            "id": "60c76e2c6c2d0b7c3fb21fa2"
        },
        {
            "name": "categoria base > outrasubcategoria > outrotipo",
            "id": "60c76e2c6c2d0b7c3fb21fa3"
        }
    ]
}

Deleting category

To delete a category, just inform the corresponding "id".

In this example I'm deleting the category named "category example" just informing the "id" of the category and the "remove:true"

{
    "categories": [
        {
            "id": "60c76e2c6c2d0b7c3fb21fa0",
            "remove": true
        }
    ]
}

Example of category return

{
    "categories": [
        {
            "name": "categoria base > subcatgoria > tipo",
            "id": "60c76e2c6c2d0b7c3fb21fa2"
        },
        {
            "name": "categoria base > outrasubcategoria > outrotipo",
            "id": "60c76e2c6c2d0b7c3fb21fa3"
        }
    ]
}
Language
Click Try It! to start a request and see the response here!