Product

Product is the merchant's product.



Endpoint


Method Description URI
POST Create a product /api/products
GET Get a list of products /api/products
PATCH Update a product's detail /api/products/{ID}
DELETE Delete a product /api/products/{ID}



Required Headers


Key Value
Accept application/json
Content-Type application/json
Authorization Bearer {ACCESS-TOKEN}


Create a product

Parameters


Method URI
POST /api/products

Body:


Key Type Required
title string Yes
code string Yes
price integer Yes

Example :

{
    "title": "example-title",
    "code": "Asxxd23d",
    "price" : 5
}

Response


{success} Success code : 200

{
    "title": "example-title",
    "code": "Asxxd23d",
    "price": 5,
    "organization_id": 1,
    "updated_at": "2020-06-25 07:48:01",
    "created_at": "2020-06-25 07:48:01",
    "id": {ID}
}

{info} For Error Reference, Related guide: Errors



Get a list of products

Parameters


Method URI
GET /api/products

Response


{success} Success code : 200

{
    "current_page": 1,
    "data": [
        {
            "title": "example-title",
            "code": "Asxxd23d",
            "price": 5,
            "organization_id": 1,
            "updated_at": "2020-06-25 07:48:01",
            "created_at": "2020-06-25 07:48:01",
            "id": {ID}
        }
    ],
    "first_page_url": "{SERVER-URL}/api/products?page=1,
    "from": 1,
    "last_page": 1,
    "last_page_url": "{SERVER-URL}/api/products?page=1",
    "next_page_url": null,
    "path": "{SERVER-URL}/api/products?page=1",
    "per_page": 15,
    "prev_page_url": null,
    "to": 1,
    "total": 1
}

{info} For Error Reference, Related guide: Errors



Update a product's detail

Parameters


Method URI
PATCH /api/products/{ID}

Body:


Key Type Required
title string No
code string No
price integer No

Example :

{
    "title": "example-title-update",
    "code": "Asxxd23d",
    "price" : 5
}

Response


{success} Success code : 200

{
    "title": "example-title-update",
    "code": "Asxxd23d",
    "price": 5,
    "organization_id": 1,
    "updated_at": "2020-06-25 07:48:01",
    "created_at": "2020-06-25 07:48:01",
    "id": {ID}
}

{info} For Error Reference, Related guide: Errors



Delete a product

Parameters


Method URI
DELETE /api/products/{ID}

Response


{success} Success code : 200

[ ]

{info} For Error Reference, Related guide: Errors