Product

Product is the merchant's product.



Endpoint


Method Description URI
POST Create a product /api/v2/products
GET Get a list of products /api/v2/products
PATCH Update a product's detail /api/v2/products/{ID}
DELETE Delete a product /api/v2/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/v2/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

{
    "success": true,
    "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}
    },
    "errors": null,
    "meta": {
        "timestamp": "2020-06-25 07:48:01 UTC",
        "timezone": "UTC"
    }
}

{info} For Error Reference, Related guide: Errors



Get a list of products

Parameters


Method URI
GET /api/v2/products

Response


{success} Success code : 200

{
    "success": true,
    "data": {
        "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/v2/products?page=1,
        "from": 1,
        "last_page": 1,
        "last_page_url": "{SERVER-URL}/api/v2/products?page=1",
        "next_page_url": null,
        "path": "{SERVER-URL}/api/v2/products?page=1",
        "per_page": 15,
        "prev_page_url": null,
        "to": 1,
        "total": 1
    },
    "errors": null,
    "meta": {
        "timestamp": "2020-06-25 07:23:54 UTC",
        "timezone": "UTC"
    }
}

{info} For Error Reference, Related guide: Errors



Update a product's detail

Parameters


Method URI
PATCH /api/v2/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

{
    "success": true,
    "data": {
                "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}
            },
    "errors": null,
    "meta": {
        "timestamp": "2020-06-25 07:22:29 UTC",
        "timezone": "UTC"
    }
}

{info} For Error Reference, Related guide: Errors



Delete a product

Parameters


Method URI
DELETE /api/v2/products/{ID}

Response


{success} Success code : 200

{
    "success": true,
    "data": true,
    "errors": null,
    "meta": {
        "timestamp": "2020-06-25 07:36:17 UTC",
        "timezone": "UTC"
    }
}

{info} For Error Reference, Related guide: Errors