Create Category

Create Category

To create the data in the specified collection with the specified parameters. When a JSON object is saved, the object properties are automatically added to the collection you specified.

Method : POST

URL : /api/category

Body : JSON

{
	"name": "New Category",
	"image_url": "https://images.unsplash.com/photo-1682687220063-4742bd7fd538?auto=format&fit=crop&q=60&w=500"
}
name*Required
string

Category name.

image_url*Required
string

Category image URL

Response : 200 - OK

{
  "message": "Success add category"
}

Response : 422 - Unprocessable Content

{
    "error": [
        {
            "code": "too_small",
            "minimum": 1,
            "type": "string",
            "inclusive": true,
            "exact": false,
            "message": "Name is required",
            "path": [
                "name"
            ]
        },
        {
            "code": "too_small",
            "minimum": 1,
            "type": "string",
            "inclusive": true,
            "exact": false,
            "message": "Image URL is required",
            "path": [
                "image_url"
            ]
        }
    ]
}

Response : 500 - Server Error

Internal Server Error