MENU navbar-image

Introduction

This documentation aims to provide all the information you need to work with our API.

Authenticating requests

To authenticate requests, include an Authorization header with the value "Bearer {YOUR_AUTH_KEY}".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

You can retrieve your token by visiting your dashboard and clicking Generate API token.

Generate Administrator

Generate the admin user

API to generate the super administrator. It is only a one-time call in the entire lifetime of the application.

Example request:
curl --request POST \
    "https://ecomapi.bmehul.com/api/v1/admin/generate" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"first_name\": \"John\",
    \"last_name\": \"Doe\",
    \"email\": \"johndoe@example.com\",
    \"password\": \"Secret\",
    \"confirm_password\": \"Secret\"
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/generate"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "first_name": "John",
    "last_name": "Doe",
    "email": "johndoe@example.com",
    "password": "Secret",
    "confirm_password": "Secret"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/generate';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'first_name' => 'John',
            'last_name' => 'Doe',
            'email' => 'johndoe@example.com',
            'password' => 'Secret',
            'confirm_password' => 'Secret',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/admin/generate

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

first_name   string   

Required. Your first name. Example: John

last_name   string   

Required. Your last name. Example: Doe

email   string   

Required. Should be a valid and unique email address. This will be used at the time of signing in to the application. Must be a valid email address. Example: johndoe@example.com

password   string   

Required. Choose a strong password. Example: Secret

confirm_password   string   

Required. Should be same as password field. The value and password must match. Example: Secret

Common Endpoints

Authentication

The endpoints that are common for all the users in the whole application.

Registration

API to register a user in the application.

Example request:
curl --request POST \
    "https://ecomapi.bmehul.com/api/common/register" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"first_name\": \"John\",
    \"last_name\": \"Doe\",
    \"email\": \"johndoe@example.com\",
    \"password\": \"Secret\",
    \"confirm_password\": \"Secret\"
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/common/register"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "first_name": "John",
    "last_name": "Doe",
    "email": "johndoe@example.com",
    "password": "Secret",
    "confirm_password": "Secret"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/common/register';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'first_name' => 'John',
            'last_name' => 'Doe',
            'email' => 'johndoe@example.com',
            'password' => 'Secret',
            'confirm_password' => 'Secret',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (201):


{
    "status": "success",
    "message": "You have registered successfully.",
    "data": {
        "first_name": "John",
        "last_name": "Doe",
        "email": "johndoe@example.com",
        "updated_at": "2023-06-01T14:46:10.000000Z",
        "created_at": "2023-06-01T14:46:10.000000Z",
        "id": 2
    }
}
 

Example response (422):


{
    "message": "The first name field is required. (and 4 more errors)",
    "errors": {
        "first_name": [
            "The first name field is required.",
        ],
        "last_name": [
            "The last name field is required.",
        ],
        "email": [
            "The email field is required.",
        ],
        "password": [
            "The password field is required.",
        ],
        "confirm_password": [
            "The confirm password field is required.",
        ]
    }
}

 

Request   

POST api/common/register

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

first_name   string   

Required. Your first name. Example: John

last_name   string   

Required. Your last name. Example: Doe

email   string   

Required. Should be a valid and unique email address. This will be used at the time of signing in to the application. Must be a valid email address. Example: johndoe@example.com

password   string   

Required. Choose a strong password. Example: Secret

confirm_password   string   

Required. Should be same as password field. The value and password must match. Example: Secret

Login

Login the user (admin and non-admin), and generate the bearer token. This token will be used for further requests in the admin user panel or in the non-admin user panel.

Example request:
curl --request POST \
    "https://ecomapi.bmehul.com/api/common/login" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"email\": \"userone@example.com\",
    \"password\": \"Secret\"
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/common/login"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "userone@example.com",
    "password": "Secret"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/common/login';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'email' => 'userone@example.com',
            'password' => 'Secret',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/common/login

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

email   string   

Requred. The email address of the user that you are trying to authenticate. Should be a valid email address. Must be a valid email address. The email of an existing record in the users table. Example: userone@example.com

password   string   

Required. The password associated with the above email address. Example: Secret

Logout

requires authentication

Logout the admin user or non-admin user. When they log out, all the tokens related to their account will also get deleted.

Example request:
curl --request POST \
    "https://ecomapi.bmehul.com/api/common/logout" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/common/logout"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/common/logout';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/common/logout

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Password Resetting

The endpoints URL for request password change and resetting the same.

Send Password Reset Link

Send the password reset link to the provided email address via an E-Mail.

Example request:
curl --request POST \
    "https://ecomapi.bmehul.com/api/common/forgot-password" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"email\": \"userone@example.com\"
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/common/forgot-password"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "userone@example.com"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/common/forgot-password';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'email' => 'userone@example.com',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/common/forgot-password

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

email   string   

Required. The email address that you have registered your account with. Should be a valid email address. Must be a valid email address. The email of an existing record in the users table. Example: userone@example.com

Reset Password

Reset the admin's or the user's password with the new password. Deletes the record from the database table after resetting.

Example request:
curl --request POST \
    "https://ecomapi.bmehul.com/api/common/reset-password" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"email\": \"johndoe@example.com\",
    \"token\": \"PZj7o5NBJmWhmaJ6mAH8zMSOck5vFTlPOuaT\",
    \"new_password\": \"Secret\",
    \"repeat_new_password\": \"Secret\"
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/common/reset-password"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "johndoe@example.com",
    "token": "PZj7o5NBJmWhmaJ6mAH8zMSOck5vFTlPOuaT",
    "new_password": "Secret",
    "repeat_new_password": "Secret"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/common/reset-password';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'email' => 'johndoe@example.com',
            'token' => 'PZj7o5NBJmWhmaJ6mAH8zMSOck5vFTlPOuaT',
            'new_password' => 'Secret',
            'repeat_new_password' => 'Secret',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/common/reset-password

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

email   string   

Required. The email address that you have registered with. Should be valid and should exist in the application. Must be a valid email address. The email of an existing record in the password_reset_tokens table. Example: johndoe@example.com

token   string   

Required. The token that was sent to the email address. The token of an existing record in the password_reset_tokens table. Example: PZj7o5NBJmWhmaJ6mAH8zMSOck5vFTlPOuaT

new_password   string   

Required. The new password to log in to your account. Example: Secret

repeat_new_password   string   

Required. Repeat the same password that has been added in new_password field. The value and new_password must match. Example: Secret

Account Settings

The endpoints related to the user account of both admin user and non-admin user.

General Settings

requires authentication

Update the general settings of the user.

Example request:
curl --request PUT \
    "https://ecomapi.bmehul.com/api/common/account-settings/general" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"first_name\": \"John\",
    \"last_name\": \"Doe\",
    \"email\": \"johndoe@example.com\"
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/common/account-settings/general"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "first_name": "John",
    "last_name": "Doe",
    "email": "johndoe@example.com"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/common/account-settings/general';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'first_name' => 'John',
            'last_name' => 'Doe',
            'email' => 'johndoe@example.com',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (201):


{
    "status": "success",
    "message": "General Settings updated successfully.",
    "data": {
        "id": 1,
        "first_name": "John",
        "last_name": "Doe",
        "email": "johndoe@example.com",
        "created_at": "2023-05-17T00:00:00.000000Z",
        "updated_at": "2023-05-17T00:00:00.000000Z",
        "deleted_at": null
    }
}
 

Request   

PUT api/common/account-settings/general

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

first_name   string   

The first name of the admin user. Example: John

last_name   string   

The last name of the admin user. Example: Doe

email   string   

The email of the admin user. Example: johndoe@example.com

Change Password

requires authentication

Update the password of the currently authenticated admin user. It will be updated only when the current password is matched.

Example request:
curl --request PUT \
    "https://ecomapi.bmehul.com/api/common/account-settings/change-password" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"current_password\": \"Pa$$w0rd\",
    \"new_password\": \"Secret\",
    \"new_password_confirmation\": \"Secret\"
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/common/account-settings/change-password"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "current_password": "Pa$$w0rd",
    "new_password": "Secret",
    "new_password_confirmation": "Secret"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/common/account-settings/change-password';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'current_password' => 'Pa$$w0rd',
            'new_password' => 'Secret',
            'new_password_confirmation' => 'Secret',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (201):


{
    "status": "success",
    "message": "Password updated successfully.",
    "data": []
}
 

Request   

PUT api/common/account-settings/change-password

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

current_password   string   

The admin user's current password. Example: Pa$$w0rd

new_password   string   

The new password. Example: Secret

new_password_confirmation   string   

Confirm the new password, should match new_password. Example: Secret

Administrator Endpoints

Categories

List All categories

requires authentication

Display all the categories with pagination. At a time, there are total of 16 records that will be displayed.

Example request:
curl --request GET \
    --get "https://ecomapi.bmehul.com/api/v1/admin/categories?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/categories"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/categories';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "",
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "name": "Qui Nobis Nisi",
                "slug": "qui-nobis-nisi",
                "meta_title": "Qui Nobis Nisi Laravel E-Commerce API",
                "meta_description": "Qui Nobis Nisi Laravel E-Commerce API",
                "meta_keywords": "Qui Nobis Nisi Laravel E-Commerce API"
            },
            {
                "id": 2,
                "name": "Aut Et Quidem",
                "slug": "aut-et-quidem",
                "meta_title": "Aut Et Quidem Laravel E-Commerce API",
                "meta_description": "Aut Et Quidem Laravel E-Commerce API",
                "meta_keywords": "Aut Et Quidem Laravel E-Commerce API"
            },
            {
                "id": 3,
                "name": "Nostrum Aut Optio",
                "slug": "nostrum-aut-optio",
                "meta_title": "Nostrum Aut Optio Laravel E-Commerce API",
                "meta_description": "Nostrum Aut Optio Laravel E-Commerce API",
                "meta_keywords": "Nostrum Aut Optio Laravel E-Commerce API"
            },
            {
                "id": 4,
                "name": "Perspiciatis Commodi Est",
                "slug": "perspiciatis-commodi-est",
                "meta_title": "Perspiciatis Commodi Est Laravel E-Commerce API",
                "meta_description": "Perspiciatis Commodi Est Laravel E-Commerce API",
                "meta_keywords": "Perspiciatis Commodi Est Laravel E-Commerce API"
            },
            {
                "id": 5,
                "name": "Nisi In Eveniet",
                "slug": "nisi-in-eveniet",
                "meta_title": "Nisi In Eveniet Laravel E-Commerce API",
                "meta_description": "Nisi In Eveniet Laravel E-Commerce API",
                "meta_keywords": "Nisi In Eveniet Laravel E-Commerce API"
            },
            {
                "id": 6,
                "name": "Possimus Placeat Ad",
                "slug": "possimus-placeat-ad",
                "meta_title": "Possimus Placeat Ad Laravel E-Commerce API",
                "meta_description": "Possimus Placeat Ad Laravel E-Commerce API",
                "meta_keywords": "Possimus Placeat Ad Laravel E-Commerce API"
            },
            {
                "id": 7,
                "name": "Maiores Quia Ut",
                "slug": "maiores-quia-ut",
                "meta_title": "Maiores Quia Ut Laravel E-Commerce API",
                "meta_description": "Maiores Quia Ut Laravel E-Commerce API",
                "meta_keywords": "Maiores Quia Ut Laravel E-Commerce API"
            },
            {
                "id": 8,
                "name": "Qui Repellat Molestias",
                "slug": "qui-repellat-molestias",
                "meta_title": "Qui Repellat Molestias Laravel E-Commerce API",
                "meta_description": "Qui Repellat Molestias Laravel E-Commerce API",
                "meta_keywords": "Qui Repellat Molestias Laravel E-Commerce API"
            },
            {
                "id": 9,
                "name": "Nisi Soluta Nihil",
                "slug": "nisi-soluta-nihil",
                "meta_title": "Nisi Soluta Nihil Laravel E-Commerce API",
                "meta_description": "Nisi Soluta Nihil Laravel E-Commerce API",
                "meta_keywords": "Nisi Soluta Nihil Laravel E-Commerce API"
            },
            {
                "id": 10,
                "name": "Esse Placeat Corrupti",
                "slug": "esse-placeat-corrupti",
                "meta_title": "Esse Placeat Corrupti Laravel E-Commerce API",
                "meta_description": "Esse Placeat Corrupti Laravel E-Commerce API",
                "meta_keywords": "Esse Placeat Corrupti Laravel E-Commerce API"
            },
            {
                "id": 11,
                "name": "Est Quas Libero",
                "slug": "est-quas-libero",
                "meta_title": "Est Quas Libero Laravel E-Commerce API",
                "meta_description": "Est Quas Libero Laravel E-Commerce API",
                "meta_keywords": "Est Quas Libero Laravel E-Commerce API"
            },
            {
                "id": 12,
                "name": "Dolorem Beatae Ipsa",
                "slug": "dolorem-beatae-ipsa",
                "meta_title": "Dolorem Beatae Ipsa Laravel E-Commerce API",
                "meta_description": "Dolorem Beatae Ipsa Laravel E-Commerce API",
                "meta_keywords": "Dolorem Beatae Ipsa Laravel E-Commerce API"
            },
            {
                "id": 13,
                "name": "Voluptatem Dolorem Doloremque",
                "slug": "voluptatem-dolorem-doloremque",
                "meta_title": "Voluptatem Dolorem Doloremque Laravel E-Commerce API",
                "meta_description": "Voluptatem Dolorem Doloremque Laravel E-Commerce API",
                "meta_keywords": "Voluptatem Dolorem Doloremque Laravel E-Commerce API"
            },
            {
                "id": 14,
                "name": "Necessitatibus Doloribus Beatae",
                "slug": "necessitatibus-doloribus-beatae",
                "meta_title": "Necessitatibus Doloribus Beatae Laravel E-Commerce API",
                "meta_description": "Necessitatibus Doloribus Beatae Laravel E-Commerce API",
                "meta_keywords": "Necessitatibus Doloribus Beatae Laravel E-Commerce API"
            },
            {
                "id": 15,
                "name": "Corrupti Eveniet Dolor",
                "slug": "corrupti-eveniet-dolor",
                "meta_title": "Corrupti Eveniet Dolor Laravel E-Commerce API",
                "meta_description": "Corrupti Eveniet Dolor Laravel E-Commerce API",
                "meta_keywords": "Corrupti Eveniet Dolor Laravel E-Commerce API"
            },
            {
                "id": 16,
                "name": "Dolorum Commodi Qui",
                "slug": "dolorum-commodi-qui",
                "meta_title": "Dolorum Commodi Qui Laravel E-Commerce API",
                "meta_description": "Dolorum Commodi Qui Laravel E-Commerce API",
                "meta_keywords": "Dolorum Commodi Qui Laravel E-Commerce API"
            }
        ],
        "first_page_url": "http://localhost:8000/api/v1/admin/categories?page=1",
        "from": 1,
        "last_page": 4,
        "last_page_url": "http://localhost:8000/api/v1/admin/categories?page=4",
        "links": [
            {
                "url": null,
                "label": "« Previous",
                "active": false
            },
            {
                "url": "http://localhost:8000/api/v1/admin/categories?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": "http://localhost:8000/api/v1/admin/categories?page=2",
                "label": "2",
                "active": false
            },
            {
                "url": "http://localhost:8000/api/v1/admin/categories?page=3",
                "label": "3",
                "active": false
            },
            {
                "url": "http://localhost:8000/api/v1/admin/categories?page=4",
                "label": "4",
                "active": false
            },
            {
                "url": "http://localhost:8000/api/v1/admin/categories?page=2",
                "label": "Next »",
                "active": false
            }
        ],
        "next_page_url": "http://localhost:8000/api/v1/admin/categories?page=2",
        "path": "http://localhost:8000/api/v1/admin/categories",
        "per_page": 16,
        "prev_page_url": null,
        "to": 16,
        "total": 50
    }
}
 

Request   

GET api/v1/admin/categories

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

The page number. Defaults to 1. Example: 1

Add new category

requires authentication

Create a new category and store it's details.

Example request:
curl --request POST \
    "https://ecomapi.bmehul.com/api/v1/admin/categories" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"T-shirt for Women\",
    \"description\": \"T-shirt for Women made of the best quality materials sold all over the world.\",
    \"meta_title\": \"T-shirt for Women made of the best quality materials.\",
    \"meta_description\": \"T-shirt for Women made of the best quality materials sold all over the world.\",
    \"meta_keywords\": \"T-shirt, t-shirt for women, best quality tshirt for women\"
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/categories"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "T-shirt for Women",
    "description": "T-shirt for Women made of the best quality materials sold all over the world.",
    "meta_title": "T-shirt for Women made of the best quality materials.",
    "meta_description": "T-shirt for Women made of the best quality materials sold all over the world.",
    "meta_keywords": "T-shirt, t-shirt for women, best quality tshirt for women"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/categories';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'name' => 'T-shirt for Women',
            'description' => 'T-shirt for Women made of the best quality materials sold all over the world.',
            'meta_title' => 'T-shirt for Women made of the best quality materials.',
            'meta_description' => 'T-shirt for Women made of the best quality materials sold all over the world.',
            'meta_keywords' => 'T-shirt, t-shirt for women, best quality tshirt for women',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (201):


{
    "status": "success",
    "message": "Category added successfully.",
    "data": {
        "name": "Category 1",
        "description": "Qui aut quia soluta ut et repellendus aut.",
        "meta_title": "jqfpfenwpledzbrovcmnsylb",
        "meta_description": "sdovbzcbfmbwnxpgvrqzdi",
        "meta_keywords": "dvrisbpzc",
        "slug": "qblbi",
        "updated_at": "2023-05-18T00:00:00.000000Z",
        "created_at": "2023-05-18T00:00:00.000000Z",
        "id": 1
    }
}
 

Example response (422):


{
    "message": "The name field is required. (and 3 more errors)",
    "errors": {
        "name": [
            "The name field is required."
        ],
        "description": [
            "The description field is required."
        ],
        "meta_title": [
            "The meta title field is required."
        ],
        "meta_description": [
            "The meta description field is required."
        ]
    }
}
 

Request   

POST api/v1/admin/categories

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

name   string   

Required. The name of the category, should be unique. Must not be greater than 100 characters. Example: T-shirt for Women

description   string   

Required. The description of the category. Must not be greater than 255 characters. Example: T-shirt for Women made of the best quality materials sold all over the world.

meta_title   string   

Required. The title of the page. Refers to the text that is displayed on search engine result pages and browser tabs to indicate the topic of a webpage. Must not be greater than 80 characters. Example: T-shirt for Women made of the best quality materials.

meta_description   string   

Required. This informs and interests users with a short, relevant summary of what a particular page is about. Must not be greater than 180 characters. Example: T-shirt for Women made of the best quality materials sold all over the world.

meta_keywords   string  optional  

A comma separated words or phrases related to the category. Must not be greater than 255 characters. Example: T-shirt, t-shirt for women, best quality tshirt for women

Get single category

requires authentication

Fetch the details about the given category id.

Example request:
curl --request GET \
    --get "https://ecomapi.bmehul.com/api/v1/admin/categories/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/categories/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/categories/1';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "",
    "data": {
        "name": "Category 1",
        "description": "Qui aut quia soluta ut et repellendus aut.",
        "meta_title": "jqfpfenwpledzbrovcmnsylb",
        "meta_description": "sdovbzcbfmbwnxpgvrqzdi",
        "meta_keywords": "dvrisbpzc",
        "id": 1
    }
}
 

Example response (404):


{
    "status": "failed",
    "message": "Category not found.",
    "data": []
}
 

Request   

GET api/v1/admin/categories/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The id of the category. Example: 1

Update category

requires authentication

Update the category details of the given id.

Example request:
curl --request PUT \
    "https://ecomapi.bmehul.com/api/v1/admin/categories/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"T-shirt for Women\",
    \"description\": \"T-shirt for Women made of the best quality materials sold all over the world.\",
    \"meta_title\": \"T-shirt for Women made of the best quality materials.\",
    \"meta_description\": \"T-shirt for Women made of the best quality materials sold all over the world.\",
    \"meta_keywords\": \"T-shirt, t-shirt for women, best quality tshirt for women\"
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/categories/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "T-shirt for Women",
    "description": "T-shirt for Women made of the best quality materials sold all over the world.",
    "meta_title": "T-shirt for Women made of the best quality materials.",
    "meta_description": "T-shirt for Women made of the best quality materials sold all over the world.",
    "meta_keywords": "T-shirt, t-shirt for women, best quality tshirt for women"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/categories/1';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'name' => 'T-shirt for Women',
            'description' => 'T-shirt for Women made of the best quality materials sold all over the world.',
            'meta_title' => 'T-shirt for Women made of the best quality materials.',
            'meta_description' => 'T-shirt for Women made of the best quality materials sold all over the world.',
            'meta_keywords' => 'T-shirt, t-shirt for women, best quality tshirt for women',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Category updated successfully.",
    "data": {
        "name": "Category 1",
        "description": "Qui aut quia soluta ut et repellendus aut.",
        "meta_title": "jqfpfenwpledzbrovcmnsylb",
        "meta_description": "sdovbzcbfmbwnxpgvrqzdi",
        "meta_keywords": "dvrisbpzc",
        "slug": "qblbi",
        "updated_at": "2023-05-18T00:00:00.000000Z",
        "created_at": "2023-05-18T00:00:00.000000Z",
        "id": 1
    }
}
 

Example response (404):


{
    "status": "failed",
    "message": "Category not found.",
    "data": []
}
 

Example response (422):


{
    "message": "The name field is required. (and 3 more errors)",
    "errors": {
        "name": [
            "The name field is required."
        ],
        "description": [
            "The description field is required."
        ],
        "meta_title": [
            "The meta title field is required."
        ],
        "meta_description": [
            "The meta description field is required."
        ]
    }
}
 

Request   

PUT api/v1/admin/categories/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The id of the category. Example: 1

Body Parameters

name   string   

Required. The name of the category, should be unique. Must not be greater than 100 characters. Example: T-shirt for Women

description   string   

Required. The description of the category. Must not be greater than 255 characters. Example: T-shirt for Women made of the best quality materials sold all over the world.

meta_title   string   

Required. The title of the page. Refers to the text that is displayed on search engine result pages and browser tabs to indicate the topic of a webpage. Must not be greater than 80 characters. Example: T-shirt for Women made of the best quality materials.

meta_description   string   

Required. This informs and interests users with a short, relevant summary of what a particular page is about. Must not be greater than 180 characters. Example: T-shirt for Women made of the best quality materials sold all over the world.

meta_keywords   string  optional  

A comma separated words or phrases related to the category. Must not be greater than 255 characters. Example: T-shirt, t-shirt for women, best quality tshirt for women

Delete a category

requires authentication

Delete the category details of the given id. This will soft delete the category. Meaning the record will be present in the database, however, it won't be available to access.

Example request:
curl --request DELETE \
    "https://ecomapi.bmehul.com/api/v1/admin/categories/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/categories/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/categories/1';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Category deleted successfully.",
    "data": [],
}

 

Example response (404):


{
    "status": "failed",
    "message": "Category not found.",
    "data": []
}
 

Request   

DELETE api/v1/admin/categories/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The id of the category. Example: 1

Tags

List All tags

requires authentication

Display all the tags with pagination. At a time, there are total of 16 records that will be displayed.

Example request:
curl --request GET \
    --get "https://ecomapi.bmehul.com/api/v1/admin/tags?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/tags"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/tags';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "",
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "name": "Laborum Tempora Maxime",
                "slug": "laborum-tempora-maxime",
                "description": "Eos qui esse magnam molestiae dolorem perspiciatis.",
                "meta_title": "Laborum Tempora Maxime Laravel E-Commerce API",
                "meta_description": "Laborum Tempora Maxime Laravel E-Commerce API",
                "meta_keywords": "Laborum Tempora Maxime Laravel E-Commerce API"
            },
            {
                "id": 2,
                "name": "Officiis Sit Cum",
                "slug": "officiis-sit-cum",
                "description": "Dolores optio sapiente voluptatem.",
                "meta_title": "Officiis Sit Cum Laravel E-Commerce API",
                "meta_description": "Officiis Sit Cum Laravel E-Commerce API",
                "meta_keywords": "Officiis Sit Cum Laravel E-Commerce API"
            },
            {
                "id": 3,
                "name": "Sed Eaque Sapiente",
                "slug": "sed-eaque-sapiente",
                "description": "Nostrum est autem ut consectetur.",
                "meta_title": "Sed Eaque Sapiente Laravel E-Commerce API",
                "meta_description": "Sed Eaque Sapiente Laravel E-Commerce API",
                "meta_keywords": "Sed Eaque Sapiente Laravel E-Commerce API"
            },
            {
                "id": 4,
                "name": "Porro Sunt Et",
                "slug": "porro-sunt-et",
                "description": "Consequatur enim eos sed voluptatum eos.",
                "meta_title": "Porro Sunt Et Laravel E-Commerce API",
                "meta_description": "Porro Sunt Et Laravel E-Commerce API",
                "meta_keywords": "Porro Sunt Et Laravel E-Commerce API"
            },
            {
                "id": 5,
                "name": "Voluptatem Esse Commodi",
                "slug": "voluptatem-esse-commodi",
                "description": "Ipsum ullam voluptatem debitis dolorem.",
                "meta_title": "Voluptatem Esse Commodi Laravel E-Commerce API",
                "meta_description": "Voluptatem Esse Commodi Laravel E-Commerce API",
                "meta_keywords": "Voluptatem Esse Commodi Laravel E-Commerce API"
            },
            {
                "id": 6,
                "name": "Fugit Maiores Voluptas",
                "slug": "fugit-maiores-voluptas",
                "description": "Culpa aut sit voluptatem ut et.",
                "meta_title": "Fugit Maiores Voluptas Laravel E-Commerce API",
                "meta_description": "Fugit Maiores Voluptas Laravel E-Commerce API",
                "meta_keywords": "Fugit Maiores Voluptas Laravel E-Commerce API"
            },
            {
                "id": 7,
                "name": "Et Ex Molestiae",
                "slug": "et-ex-molestiae",
                "description": "Asperiores sit et natus.",
                "meta_title": "Et Ex Molestiae Laravel E-Commerce API",
                "meta_description": "Et Ex Molestiae Laravel E-Commerce API",
                "meta_keywords": "Et Ex Molestiae Laravel E-Commerce API"
            },
            {
                "id": 8,
                "name": "Dicta Est Sunt",
                "slug": "dicta-est-sunt",
                "description": "Tenetur eum aperiam non error.",
                "meta_title": "Dicta Est Sunt Laravel E-Commerce API",
                "meta_description": "Dicta Est Sunt Laravel E-Commerce API",
                "meta_keywords": "Dicta Est Sunt Laravel E-Commerce API"
            },
            {
                "id": 9,
                "name": "Perferendis Earum Facilis",
                "slug": "perferendis-earum-facilis",
                "description": "Aut aut molestiae similique commodi nam iure.",
                "meta_title": "Perferendis Earum Facilis Laravel E-Commerce API",
                "meta_description": "Perferendis Earum Facilis Laravel E-Commerce API",
                "meta_keywords": "Perferendis Earum Facilis Laravel E-Commerce API"
            },
            {
                "id": 10,
                "name": "Vero Aut Architecto",
                "slug": "vero-aut-architecto",
                "description": "Delectus dolorem mollitia eius.",
                "meta_title": "Vero Aut Architecto Laravel E-Commerce API",
                "meta_description": "Vero Aut Architecto Laravel E-Commerce API",
                "meta_keywords": "Vero Aut Architecto Laravel E-Commerce API"
            },
            {
                "id": 11,
                "name": "Nihil Eum Aut",
                "slug": "nihil-eum-aut",
                "description": "Voluptatem laboriosam eum error nulla quo facilis.",
                "meta_title": "Nihil Eum Aut Laravel E-Commerce API",
                "meta_description": "Nihil Eum Aut Laravel E-Commerce API",
                "meta_keywords": "Nihil Eum Aut Laravel E-Commerce API"
            },
            {
                "id": 12,
                "name": "Omnis Optio Ipsam",
                "slug": "omnis-optio-ipsam",
                "description": "Rerum eveniet et qui non minima aperiam id.",
                "meta_title": "Omnis Optio Ipsam Laravel E-Commerce API",
                "meta_description": "Omnis Optio Ipsam Laravel E-Commerce API",
                "meta_keywords": "Omnis Optio Ipsam Laravel E-Commerce API"
            },
            {
                "id": 13,
                "name": "Incidunt Nesciunt Hic",
                "slug": "incidunt-nesciunt-hic",
                "description": "Eum nulla laborum eius ut sit hic.",
                "meta_title": "Incidunt Nesciunt Hic Laravel E-Commerce API",
                "meta_description": "Incidunt Nesciunt Hic Laravel E-Commerce API",
                "meta_keywords": "Incidunt Nesciunt Hic Laravel E-Commerce API"
            },
            {
                "id": 14,
                "name": "Velit Quia Sit",
                "slug": "velit-quia-sit",
                "description": "Deleniti voluptatem rerum et necessitatibus voluptas.",
                "meta_title": "Velit Quia Sit Laravel E-Commerce API",
                "meta_description": "Velit Quia Sit Laravel E-Commerce API",
                "meta_keywords": "Velit Quia Sit Laravel E-Commerce API"
            },
            {
                "id": 15,
                "name": "Omnis Sint Est",
                "slug": "omnis-sint-est",
                "description": "Totam quasi velit occaecati non ducimus.",
                "meta_title": "Omnis Sint Est Laravel E-Commerce API",
                "meta_description": "Omnis Sint Est Laravel E-Commerce API",
                "meta_keywords": "Omnis Sint Est Laravel E-Commerce API"
            },
            {
                "id": 16,
                "name": "Inventore Earum Aliquam",
                "slug": "inventore-earum-aliquam",
                "description": "Libero commodi laboriosam ipsam accusantium laborum voluptas.",
                "meta_title": "Inventore Earum Aliquam Laravel E-Commerce API",
                "meta_description": "Inventore Earum Aliquam Laravel E-Commerce API",
                "meta_keywords": "Inventore Earum Aliquam Laravel E-Commerce API"
            }
        ],
        "first_page_url": "http://localhost:8000?page=1",
        "from": 1,
        "last_page": 4,
        "last_page_url": "http://localhost:8000?page=4",
        "links": [
            {
                "url": null,
                "label": "« Previous",
                "active": false
            },
            {
                "url": "http://localhost:8000?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": "http://localhost:8000?page=2",
                "label": "2",
                "active": false
            },
            {
                "url": "http://localhost:8000?page=3",
                "label": "3",
                "active": false
            },
            {
                "url": "http://localhost:8000?page=4",
                "label": "4",
                "active": false
            },
            {
                "url": "http://localhost:8000?page=2",
                "label": "Next »",
                "active": false
            }
        ],
        "next_page_url": "http://localhost:8000?page=2",
        "path": "http://localhost:8000",
        "per_page": 16,
        "prev_page_url": null,
        "to": 16,
        "total": 50
    }
}
 

Request   

GET api/v1/admin/tags

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

The page number. Defaults to 1. Example: 1

Add new tag

requires authentication

Create a new tag and store it's details.

Example request:
curl --request POST \
    "https://ecomapi.bmehul.com/api/v1/admin/tags" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"T-shirt for Women\",
    \"description\": \"T-shirt for Women made of the best quality materials sold all over the world.\",
    \"meta_title\": \"T-shirt for Women made of the best quality materials.\",
    \"meta_description\": \"T-shirt for Women made of the best quality materials sold all over the world.\",
    \"meta_keywords\": \"T-shirt, t-shirt for women, best quality tshirt for women\"
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/tags"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "T-shirt for Women",
    "description": "T-shirt for Women made of the best quality materials sold all over the world.",
    "meta_title": "T-shirt for Women made of the best quality materials.",
    "meta_description": "T-shirt for Women made of the best quality materials sold all over the world.",
    "meta_keywords": "T-shirt, t-shirt for women, best quality tshirt for women"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/tags';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'name' => 'T-shirt for Women',
            'description' => 'T-shirt for Women made of the best quality materials sold all over the world.',
            'meta_title' => 'T-shirt for Women made of the best quality materials.',
            'meta_description' => 'T-shirt for Women made of the best quality materials sold all over the world.',
            'meta_keywords' => 'T-shirt, t-shirt for women, best quality tshirt for women',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (201):


{
    "status": "success",
    "message": "Tag added successfully.",
    "data": {
        "name": "Tag 1",
        "description": "Qui aut quia soluta ut et repellendus aut.",
        "meta_title": "jqfpfenwpledzbrovcmnsylb",
        "meta_description": "sdovbzcbfmbwnxpgvrqzdi",
        "meta_keywords": "dvrisbpzc",
        "slug": "qblbi",
        "updated_at": "2023-05-18T00:00:00.000000Z",
        "created_at": "2023-05-18T00:00:00.000000Z",
        "id": 1
    }
}
 

Example response (422):


{
    "message": "The name field is required. (and 3 more errors)",
    "errors": {
        "name": [
            "The name field is required."
        ],
        "description": [
            "The description field is required."
        ],
        "meta_title": [
            "The meta title field is required."
        ],
        "meta_description": [
            "The meta description field is required."
        ]
    }
}
 

Request   

POST api/v1/admin/tags

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

name   string   

Required. The name of the tag, should be unique. Must not be greater than 100 characters. Example: T-shirt for Women

description   string   

Required. The description of the tag. Must not be greater than 255 characters. Example: T-shirt for Women made of the best quality materials sold all over the world.

meta_title   string   

Required. The title of the page. Refers to the text that is displayed on search engine result pages and browser tabs to indicate the topic of a webpage. Must not be greater than 80 characters. Example: T-shirt for Women made of the best quality materials.

meta_description   string   

Required. This informs and interests users with a short, relevant summary of what a particular page is about. Must not be greater than 180 characters. Example: T-shirt for Women made of the best quality materials sold all over the world.

meta_keywords   string  optional  

A comma separated words or phrases related to the tag. Must not be greater than 255 characters. Example: T-shirt, t-shirt for women, best quality tshirt for women

Get single tag

requires authentication

Fetch the details about the given tag id.

Example request:
curl --request GET \
    --get "https://ecomapi.bmehul.com/api/v1/admin/tags/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/tags/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/tags/1';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "",
    "data": {
        "name": "Tag 1",
        "description": "Qui aut quia soluta ut et repellendus aut.",
        "meta_title": "jqfpfenwpledzbrovcmnsylb",
        "meta_description": "sdovbzcbfmbwnxpgvrqzdi",
        "meta_keywords": "dvrisbpzc",
        "id": 1
    }
}
 

Example response (404):


{
    "status": "failed",
    "message": "Tag not found.",
    "data": []
}
 

Request   

GET api/v1/admin/tags/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The id of the tag. Example: 1

Update tag

requires authentication

Update the tag details of the given id.

Example request:
curl --request PUT \
    "https://ecomapi.bmehul.com/api/v1/admin/tags/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"T-shirt for Women\",
    \"description\": \"T-shirt for Women made of the best quality materials sold all over the world.\",
    \"meta_title\": \"T-shirt for Women made of the best quality materials.\",
    \"meta_description\": \"T-shirt for Women made of the best quality materials sold all over the world.\",
    \"meta_keywords\": \"T-shirt, t-shirt for women, best quality tshirt for women\"
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/tags/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "T-shirt for Women",
    "description": "T-shirt for Women made of the best quality materials sold all over the world.",
    "meta_title": "T-shirt for Women made of the best quality materials.",
    "meta_description": "T-shirt for Women made of the best quality materials sold all over the world.",
    "meta_keywords": "T-shirt, t-shirt for women, best quality tshirt for women"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/tags/1';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'name' => 'T-shirt for Women',
            'description' => 'T-shirt for Women made of the best quality materials sold all over the world.',
            'meta_title' => 'T-shirt for Women made of the best quality materials.',
            'meta_description' => 'T-shirt for Women made of the best quality materials sold all over the world.',
            'meta_keywords' => 'T-shirt, t-shirt for women, best quality tshirt for women',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Tag updated successfully.",
    "data": {
        "name": "Tag 1",
        "description": "Qui aut quia soluta ut et repellendus aut.",
        "meta_title": "jqfpfenwpledzbrovcmnsylb",
        "meta_description": "sdovbzcbfmbwnxpgvrqzdi",
        "meta_keywords": "dvrisbpzc",
        "slug": "qblbi",
        "updated_at": "2023-05-18T00:00:00.000000Z",
        "created_at": "2023-05-18T00:00:00.000000Z",
        "id": 1
    }
}
 

Example response (404):


{
    "status": "failed",
    "message": "Tag not found.",
    "data": []
}
 

Example response (422):


{
    "message": "The name field is required. (and 3 more errors)",
    "errors": {
        "name": [
            "The name field is required."
        ],
        "description": [
            "The description field is required."
        ],
        "meta_title": [
            "The meta title field is required."
        ],
        "meta_description": [
            "The meta description field is required."
        ]
    }
}
 

Request   

PUT api/v1/admin/tags/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The id of the tag. Example: 1

Body Parameters

name   string   

Required. The name of the category, should be unique. Must not be greater than 100 characters. Example: T-shirt for Women

description   string   

Required. The description of the category. Must not be greater than 255 characters. Example: T-shirt for Women made of the best quality materials sold all over the world.

meta_title   string   

Required. The title of the page. Refers to the text that is displayed on search engine result pages and browser tabs to indicate the topic of a webpage. Must not be greater than 80 characters. Example: T-shirt for Women made of the best quality materials.

meta_description   string   

Required. This informs and interests users with a short, relevant summary of what a particular page is about. Must not be greater than 180 characters. Example: T-shirt for Women made of the best quality materials sold all over the world.

meta_keywords   string  optional  

A comma separated words or phrases related to the category. Must not be greater than 255 characters. Example: T-shirt, t-shirt for women, best quality tshirt for women

Delete a tag

requires authentication

Delete the tag details of the given id. This will soft delete the tag. Meaning the record will be present in the database, however, it won't be available to access.

Example request:
curl --request DELETE \
    "https://ecomapi.bmehul.com/api/v1/admin/tags/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/tags/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/tags/1';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Tag deleted successfully.",
    "data": []
}
 

Example response (404):


{
    "status": "failed",
    "message": "Tag not found.",
    "data": []
}
 

Request   

DELETE api/v1/admin/tags/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The id of the tag. Example: 1

Brands

List All brands

requires authentication

Display all the brands with pagination. At a time, there are total of 16 records that will be displayed.

Example request:
curl --request GET \
    --get "https://ecomapi.bmehul.com/api/v1/admin/brands?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/brands"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/brands';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "",
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "name": "Sint Rerum Officiis",
                "slug": "sint-rerum-officiis",
                "meta_title": "Sint Rerum Officiis Laravel E-Commerce API",
                "meta_description": "Sint Rerum Officiis Laravel E-Commerce API",
                "meta_keywords": "Sint Rerum Officiis Laravel E-Commerce API"
            },
            {
                "id": 2,
                "name": "Corporis Earum Quas",
                "slug": "corporis-earum-quas",
                "meta_title": "Corporis Earum Quas Laravel E-Commerce API",
                "meta_description": "Corporis Earum Quas Laravel E-Commerce API",
                "meta_keywords": "Corporis Earum Quas Laravel E-Commerce API"
            },
            {
                "id": 3,
                "name": "Adipisci Incidunt Et",
                "slug": "adipisci-incidunt-et",
                "meta_title": "Adipisci Incidunt Et Laravel E-Commerce API",
                "meta_description": "Adipisci Incidunt Et Laravel E-Commerce API",
                "meta_keywords": "Adipisci Incidunt Et Laravel E-Commerce API"
            },
            {
                "id": 4,
                "name": "Voluptatem Maiores Et",
                "slug": "voluptatem-maiores-et",
                "meta_title": "Voluptatem Maiores Et Laravel E-Commerce API",
                "meta_description": "Voluptatem Maiores Et Laravel E-Commerce API",
                "meta_keywords": "Voluptatem Maiores Et Laravel E-Commerce API"
            },
            {
                "id": 5,
                "name": "Doloremque Sequi Aut",
                "slug": "doloremque-sequi-aut",
                "meta_title": "Doloremque Sequi Aut Laravel E-Commerce API",
                "meta_description": "Doloremque Sequi Aut Laravel E-Commerce API",
                "meta_keywords": "Doloremque Sequi Aut Laravel E-Commerce API"
            },
            {
                "id": 6,
                "name": "Beatae Quidem Ipsam",
                "slug": "beatae-quidem-ipsam",
                "meta_title": "Beatae Quidem Ipsam Laravel E-Commerce API",
                "meta_description": "Beatae Quidem Ipsam Laravel E-Commerce API",
                "meta_keywords": "Beatae Quidem Ipsam Laravel E-Commerce API"
            },
            {
                "id": 7,
                "name": "Quia Atque Consequatur",
                "slug": "quia-atque-consequatur",
                "meta_title": "Quia Atque Consequatur Laravel E-Commerce API",
                "meta_description": "Quia Atque Consequatur Laravel E-Commerce API",
                "meta_keywords": "Quia Atque Consequatur Laravel E-Commerce API"
            },
            {
                "id": 8,
                "name": "Eaque Commodi Fugit",
                "slug": "eaque-commodi-fugit",
                "meta_title": "Eaque Commodi Fugit Laravel E-Commerce API",
                "meta_description": "Eaque Commodi Fugit Laravel E-Commerce API",
                "meta_keywords": "Eaque Commodi Fugit Laravel E-Commerce API"
            },
            {
                "id": 9,
                "name": "Molestiae Pariatur Error",
                "slug": "molestiae-pariatur-error",
                "meta_title": "Molestiae Pariatur Error Laravel E-Commerce API",
                "meta_description": "Molestiae Pariatur Error Laravel E-Commerce API",
                "meta_keywords": "Molestiae Pariatur Error Laravel E-Commerce API"
            },
            {
                "id": 10,
                "name": "Odio Omnis Et",
                "slug": "odio-omnis-et",
                "meta_title": "Odio Omnis Et Laravel E-Commerce API",
                "meta_description": "Odio Omnis Et Laravel E-Commerce API",
                "meta_keywords": "Odio Omnis Et Laravel E-Commerce API"
            },
            {
                "id": 11,
                "name": "Totam Perferendis Provident",
                "slug": "totam-perferendis-provident",
                "meta_title": "Totam Perferendis Provident Laravel E-Commerce API",
                "meta_description": "Totam Perferendis Provident Laravel E-Commerce API",
                "meta_keywords": "Totam Perferendis Provident Laravel E-Commerce API"
            },
            {
                "id": 12,
                "name": "Vitae Non Voluptas",
                "slug": "vitae-non-voluptas",
                "meta_title": "Vitae Non Voluptas Laravel E-Commerce API",
                "meta_description": "Vitae Non Voluptas Laravel E-Commerce API",
                "meta_keywords": "Vitae Non Voluptas Laravel E-Commerce API"
            },
            {
                "id": 13,
                "name": "Tempora Et Aut",
                "slug": "tempora-et-aut",
                "meta_title": "Tempora Et Aut Laravel E-Commerce API",
                "meta_description": "Tempora Et Aut Laravel E-Commerce API",
                "meta_keywords": "Tempora Et Aut Laravel E-Commerce API"
            },
            {
                "id": 14,
                "name": "Unde Quis Itaque",
                "slug": "unde-quis-itaque",
                "meta_title": "Unde Quis Itaque Laravel E-Commerce API",
                "meta_description": "Unde Quis Itaque Laravel E-Commerce API",
                "meta_keywords": "Unde Quis Itaque Laravel E-Commerce API"
            },
            {
                "id": 15,
                "name": "Harum Nisi Sed",
                "slug": "harum-nisi-sed",
                "meta_title": "Harum Nisi Sed Laravel E-Commerce API",
                "meta_description": "Harum Nisi Sed Laravel E-Commerce API",
                "meta_keywords": "Harum Nisi Sed Laravel E-Commerce API"
            },
            {
                "id": 16,
                "name": "Dolore Et Aperiam",
                "slug": "dolore-et-aperiam",
                "meta_title": "Dolore Et Aperiam Laravel E-Commerce API",
                "meta_description": "Dolore Et Aperiam Laravel E-Commerce API",
                "meta_keywords": "Dolore Et Aperiam Laravel E-Commerce API"
            }
        ],
        "first_page_url": "http://localhost:8000?page=1",
        "from": 1,
        "last_page": 4,
        "last_page_url": "http://localhost:8000?page=4",
        "links": [
            {
                "url": null,
                "label": "« Previous",
                "active": false
            },
            {
                "url": "http://localhost:8000?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": "http://localhost:8000?page=2",
                "label": "2",
                "active": false
            },
            {
                "url": "http://localhost:8000?page=3",
                "label": "3",
                "active": false
            },
            {
                "url": "http://localhost:8000?page=4",
                "label": "4",
                "active": false
            },
            {
                "url": "http://localhost:8000?page=2",
                "label": "Next »",
                "active": false
            }
        ],
        "next_page_url": "http://localhost:8000?page=2",
        "path": "http://localhost:8000",
        "per_page": 16,
        "prev_page_url": null,
        "to": 16,
        "total": 50
    }
}
 

Request   

GET api/v1/admin/brands

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

The page number. Defaults to 1. Example: 1

Add new Brand

requires authentication

Create a new Brand and store it's details.

Example request:
curl --request POST \
    "https://ecomapi.bmehul.com/api/v1/admin/brands" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"Gucci\",
    \"description\": \"Gucci clothes made of the best quality materials sold all over the world.\",
    \"meta_title\": \"Gucci clothes made of the best quality materials.\",
    \"meta_description\": \"Gucci clothes made of the best quality materials sold all over the world.\",
    \"meta_keywords\": \"T-shirt, Gucci clothes, best quality tshirt for women\"
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/brands"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "Gucci",
    "description": "Gucci clothes made of the best quality materials sold all over the world.",
    "meta_title": "Gucci clothes made of the best quality materials.",
    "meta_description": "Gucci clothes made of the best quality materials sold all over the world.",
    "meta_keywords": "T-shirt, Gucci clothes, best quality tshirt for women"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/brands';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'name' => 'Gucci',
            'description' => 'Gucci clothes made of the best quality materials sold all over the world.',
            'meta_title' => 'Gucci clothes made of the best quality materials.',
            'meta_description' => 'Gucci clothes made of the best quality materials sold all over the world.',
            'meta_keywords' => 'T-shirt, Gucci clothes, best quality tshirt for women',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (201):


{
    "status": "success",
    "message": "Brand added successfully.",
    "data": {
        "name": "Brand 1",
        "description": "Qui aut quia soluta ut et repellendus aut.",
        "meta_title": "jqfpfenwpledzbrovcmnsylb",
        "meta_description": "sdovbzcbfmbwnxpgvrqzdi",
        "meta_keywords": "dvrisbpzc",
        "slug": "qblbi",
        "updated_at": "2023-05-18T00:00:00.000000Z",
        "created_at": "2023-05-18T00:00:00.000000Z",
        "id": 1
    }
}
 

Example response (422):


{
    "message": "The name field is required. (and 3 more errors)",
    "errors": {
        "name": [
            "The name field is required."
        ],
        "description": [
            "The description field is required."
        ],
        "meta_title": [
            "The meta title field is required."
        ],
        "meta_description": [
            "The meta description field is required."
        ]
    }
}
 

Request   

POST api/v1/admin/brands

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

name   string   

Required. The name of the category, should be unique. Must not be greater than 100 characters. Example: Gucci

description   string   

Required. The description of the category. Must not be greater than 255 characters. Example: Gucci clothes made of the best quality materials sold all over the world.

meta_title   string   

Required. The title of the page. Refers to the text that is displayed on search engine result pages and browser tabs to indicate the topic of a webpage. Must not be greater than 80 characters. Example: Gucci clothes made of the best quality materials.

meta_description   string   

Required. This informs and interests users with a short, relevant summary of what a particular page is about. Must not be greater than 180 characters. Example: Gucci clothes made of the best quality materials sold all over the world.

meta_keywords   string  optional  

A comma separated words or phrases related to the category. Must not be greater than 255 characters. Example: T-shirt, Gucci clothes, best quality tshirt for women

Get single Brand

requires authentication

Fetch the details about the given Brand id.

Example request:
curl --request GET \
    --get "https://ecomapi.bmehul.com/api/v1/admin/brands/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/brands/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/brands/1';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "",
    "data": {
        "name": "Brand 1",
        "description": "Qui aut quia soluta ut et repellendus aut.",
        "meta_title": "jqfpfenwpledzbrovcmnsylb",
        "meta_description": "sdovbzcbfmbwnxpgvrqzdi",
        "meta_keywords": "dvrisbpzc",
        "id": 1
    }
}
 

Example response (404):


{
    "status": "failed",
    "message": "Brand not found.",
    "data": []
}
 

Request   

GET api/v1/admin/brands/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The id of the Brand. Example: 1

Update Brand

requires authentication

Update the Brand details of the given id.

Example request:
curl --request PUT \
    "https://ecomapi.bmehul.com/api/v1/admin/brands/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"Gucci\",
    \"description\": \"Gucci clothes made of the best quality materials sold all over the world.\",
    \"meta_title\": \"Gucci clothes made of the best quality materials.\",
    \"meta_description\": \"Gucci clothes made of the best quality materials sold all over the world.\",
    \"meta_keywords\": \"T-shirt, Gucci clothes, best quality tshirt for women\"
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/brands/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "Gucci",
    "description": "Gucci clothes made of the best quality materials sold all over the world.",
    "meta_title": "Gucci clothes made of the best quality materials.",
    "meta_description": "Gucci clothes made of the best quality materials sold all over the world.",
    "meta_keywords": "T-shirt, Gucci clothes, best quality tshirt for women"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/brands/1';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'name' => 'Gucci',
            'description' => 'Gucci clothes made of the best quality materials sold all over the world.',
            'meta_title' => 'Gucci clothes made of the best quality materials.',
            'meta_description' => 'Gucci clothes made of the best quality materials sold all over the world.',
            'meta_keywords' => 'T-shirt, Gucci clothes, best quality tshirt for women',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Brand updated successfully.",
    "data": {
        "name": "Brand 1",
        "description": "Qui aut quia soluta ut et repellendus aut.",
        "meta_title": "jqfpfenwpledzbrovcmnsylb",
        "meta_description": "sdovbzcbfmbwnxpgvrqzdi",
        "meta_keywords": "dvrisbpzc",
        "slug": "qblbi",
        "updated_at": "2023-05-18T00:00:00.000000Z",
        "created_at": "2023-05-18T00:00:00.000000Z",
        "id": 1
    }
}
 

Example response (404):


{
    "status": "failed",
    "message": "Brand not found.",
    "data": []
}
 

Example response (422):


{
    "message": "The name field is required. (and 3 more errors)",
    "errors": {
        "name": [
            "The name field is required."
        ],
        "description": [
            "The description field is required."
        ],
        "meta_title": [
            "The meta title field is required."
        ],
        "meta_description": [
            "The meta description field is required."
        ]
    }
}
 

Request   

PUT api/v1/admin/brands/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The id of the Brand. Example: 1

Body Parameters

name   string   

Required. The name of the category, should be unique. Must not be greater than 100 characters. Example: Gucci

description   string   

Required. The description of the category. Must not be greater than 255 characters. Example: Gucci clothes made of the best quality materials sold all over the world.

meta_title   string   

Required. The title of the page. Refers to the text that is displayed on search engine result pages and browser tabs to indicate the topic of a webpage. Must not be greater than 80 characters. Example: Gucci clothes made of the best quality materials.

meta_description   string   

Required. This informs and interests users with a short, relevant summary of what a particular page is about. Must not be greater than 180 characters. Example: Gucci clothes made of the best quality materials sold all over the world.

meta_keywords   string  optional  

A comma separated words or phrases related to the category. Must not be greater than 255 characters. Example: T-shirt, Gucci clothes, best quality tshirt for women

Delete a Brand

requires authentication

Delete the Brand details of the given id. This will soft delete the Brand. Meaning the record will be present in the database, however, it won't be available to access.

Example request:
curl --request DELETE \
    "https://ecomapi.bmehul.com/api/v1/admin/brands/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/brands/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/brands/1';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Brand deleted successfully.",
    "data": []
}
 

Example response (404):


{
    "status": "failed",
    "message": "Brand not found.",
    "data": []
}
 

Request   

DELETE api/v1/admin/brands/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The id of the Brand. Example: 1

Products

List All products

requires authentication

Display all the products with pagination. At a time, there are total of 16 records that will be displayed.

Example request:
curl --request GET \
    --get "https://ecomapi.bmehul.com/api/v1/admin/products?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/products"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/products';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "",
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "category_id": 52,
                "brand_id": 51,
                "name": "Iusto Occaecati Necessitatibus Non Asperiores",
                "slug": "iusto-occaecati-necessitatibus-non-asperiores",
                "rate": 64.46,
                "quantity": 5,
                "description": "Inventore nihil repellat similique exercitationem. Optio veritatis commodi amet ipsum tempore mollitia. Dolor enim sunt repudiandae nemo eaque suscipit quis. Cum animi quia error vero natus ratione eveniet odio. Est consectetur doloremque qui fugiat recusandae facilis aut reprehenderit.",
                "meta_title": "Iusto Occaecati Necessitatibus Non Asperiores Laravel E-Commerce API",
                "meta_description": "Iusto Occaecati Necessitatibus Non Asperiores Laravel E-Commerce API",
                "meta_keywords": "Iusto Occaecati Necessitatibus Non Asperiores Laravel E-Commerce API",
                "category": {
                    "id": 52,
                    "name": "Natus Beatae Dolorem",
                    "slug": "natus-beatae-dolorem"
                },
                "brand": {
                    "id": 51,
                    "name": "Quidem Natus Laboriosam",
                    "slug": "quidem-natus-laboriosam"
                }
            },
            {
                "id": 2,
                "category_id": 53,
                "brand_id": 52,
                "name": "Cum Sit Consequatur Sit Eum",
                "slug": "cum-sit-consequatur-sit-eum",
                "rate": 469.78,
                "quantity": 7,
                "description": "Tempore voluptatem quia aut asperiores. Sit eos doloribus esse. Deleniti ea quod repellat aut officiis doloremque voluptatem aut. Eos quam omnis culpa ut laudantium sit dolores. Qui reiciendis qui sunt et repudiandae.",
                "meta_title": "Cum Sit Consequatur Sit Eum Laravel E-Commerce API",
                "meta_description": "Cum Sit Consequatur Sit Eum Laravel E-Commerce API",
                "meta_keywords": "Cum Sit Consequatur Sit Eum Laravel E-Commerce API",
                "category": {
                    "id": 53,
                    "name": "Sit Numquam Ducimus",
                    "slug": "sit-numquam-ducimus"
                },
                "brand": {
                    "id": 52,
                    "name": "Provident Totam Quaerat",
                    "slug": "provident-totam-quaerat"
                }
            },
            {
                "id": 3,
                "category_id": 54,
                "brand_id": 53,
                "name": "Veniam Odio Ipsam Enim Quia",
                "slug": "veniam-odio-ipsam-enim-quia",
                "rate": 787.46,
                "quantity": 0,
                "description": "Rerum itaque qui sint quo dolorem. Quis vel necessitatibus cum aliquid ullam fugit. In consequatur et cumque est et voluptas architecto. Dicta impedit velit quia vel neque culpa voluptatem. Adipisci nesciunt maiores cupiditate enim nihil id tenetur.",
                "meta_title": "Veniam Odio Ipsam Enim Quia Laravel E-Commerce API",
                "meta_description": "Veniam Odio Ipsam Enim Quia Laravel E-Commerce API",
                "meta_keywords": "Veniam Odio Ipsam Enim Quia Laravel E-Commerce API",
                "category": {
                    "id": 54,
                    "name": "Animi Fuga Quisquam",
                    "slug": "animi-fuga-quisquam"
                },
                "brand": {
                    "id": 53,
                    "name": "Quia Ut Error",
                    "slug": "quia-ut-error"
                }
            },
            {
                "id": 4,
                "category_id": 55,
                "brand_id": 54,
                "name": "Maxime Repellat Perferendis Corrupti Quae",
                "slug": "maxime-repellat-perferendis-corrupti-quae",
                "rate": 144.82,
                "quantity": 8,
                "description": "Rem ratione qui consectetur non. Velit dolor quia ad omnis consequatur. Velit soluta esse sunt aspernatur. Sed labore aut soluta est iure dicta est. Molestias aut earum quo.",
                "meta_title": "Maxime Repellat Perferendis Corrupti Quae Laravel E-Commerce API",
                "meta_description": "Maxime Repellat Perferendis Corrupti Quae Laravel E-Commerce API",
                "meta_keywords": "Maxime Repellat Perferendis Corrupti Quae Laravel E-Commerce API",
                "category": {
                    "id": 55,
                    "name": "Velit Animi Labore",
                    "slug": "velit-animi-labore"
                },
                "brand": {
                    "id": 54,
                    "name": "Ipsum Libero Tenetur",
                    "slug": "ipsum-libero-tenetur"
                }
            },
            {
                "id": 5,
                "category_id": 56,
                "brand_id": 55,
                "name": "Non Perspiciatis Dignissimos Nesciunt Libero",
                "slug": "non-perspiciatis-dignissimos-nesciunt-libero",
                "rate": 896.54,
                "quantity": 6,
                "description": "Fugit et sed aperiam sit quas libero harum. Quam quae eos quis nobis. Est dignissimos esse in unde ipsum. Sed asperiores rerum reiciendis architecto enim fugiat omnis et. Nihil facilis qui aut culpa.",
                "meta_title": "Non Perspiciatis Dignissimos Nesciunt Libero Laravel E-Commerce API",
                "meta_description": "Non Perspiciatis Dignissimos Nesciunt Libero Laravel E-Commerce API",
                "meta_keywords": "Non Perspiciatis Dignissimos Nesciunt Libero Laravel E-Commerce API",
                "category": {
                    "id": 56,
                    "name": "Consequatur Sapiente Dolores",
                    "slug": "consequatur-sapiente-dolores"
                },
                "brand": {
                    "id": 55,
                    "name": "Voluptatem Ad Dicta",
                    "slug": "voluptatem-ad-dicta"
                }
            },
            {
                "id": 6,
                "category_id": 57,
                "brand_id": 56,
                "name": "Explicabo Impedit Officiis Voluptas Cum",
                "slug": "explicabo-impedit-officiis-voluptas-cum",
                "rate": 832.42,
                "quantity": 8,
                "description": "Nulla ut ab ipsum molestiae dolor sit. Nam esse ab temporibus nam ad. Illo a beatae sequi. Enim similique sit aliquid eum quae omnis adipisci. Cum accusantium vel quam illum voluptates.",
                "meta_title": "Explicabo Impedit Officiis Voluptas Cum Laravel E-Commerce API",
                "meta_description": "Explicabo Impedit Officiis Voluptas Cum Laravel E-Commerce API",
                "meta_keywords": "Explicabo Impedit Officiis Voluptas Cum Laravel E-Commerce API",
                "category": {
                    "id": 57,
                    "name": "Suscipit Exercitationem Accusantium",
                    "slug": "suscipit-exercitationem-accusantium"
                },
                "brand": {
                    "id": 56,
                    "name": "Totam Harum Voluptatem",
                    "slug": "totam-harum-voluptatem"
                }
            },
            {
                "id": 7,
                "category_id": 58,
                "brand_id": 57,
                "name": "Iure Quis Est Repellendus Quia",
                "slug": "iure-quis-est-repellendus-quia",
                "rate": 345.94,
                "quantity": 2,
                "description": "Voluptas omnis incidunt quia nisi dolor quia magnam. Ea qui libero corporis eos. Qui architecto minus dolore quas atque. Adipisci consequuntur et a dolorem alias consequatur quas. Fuga voluptatibus maiores et minima.",
                "meta_title": "Iure Quis Est Repellendus Quia Laravel E-Commerce API",
                "meta_description": "Iure Quis Est Repellendus Quia Laravel E-Commerce API",
                "meta_keywords": "Iure Quis Est Repellendus Quia Laravel E-Commerce API",
                "category": {
                    "id": 58,
                    "name": "Aspernatur Quis Accusantium",
                    "slug": "aspernatur-quis-accusantium"
                },
                "brand": {
                    "id": 57,
                    "name": "Expedita Aut Et",
                    "slug": "expedita-aut-et"
                }
            },
            {
                "id": 8,
                "category_id": 59,
                "brand_id": 58,
                "name": "Omnis Est Quisquam Et Occaecati",
                "slug": "omnis-est-quisquam-et-occaecati",
                "rate": 568.97,
                "quantity": 8,
                "description": "Vero eaque non sint repudiandae ipsum. Vitae culpa quo porro placeat. Amet similique aliquid exercitationem eum. Vero nostrum doloremque occaecati. At ut laudantium quaerat qui exercitationem explicabo dolores.",
                "meta_title": "Omnis Est Quisquam Et Occaecati Laravel E-Commerce API",
                "meta_description": "Omnis Est Quisquam Et Occaecati Laravel E-Commerce API",
                "meta_keywords": "Omnis Est Quisquam Et Occaecati Laravel E-Commerce API",
                "category": {
                    "id": 59,
                    "name": "Nihil Unde Mollitia",
                    "slug": "nihil-unde-mollitia"
                },
                "brand": {
                    "id": 58,
                    "name": "Nihil Praesentium Dicta",
                    "slug": "nihil-praesentium-dicta"
                }
            },
            {
                "id": 9,
                "category_id": 60,
                "brand_id": 59,
                "name": "A Assumenda Eaque Aperiam Omnis",
                "slug": "a-assumenda-eaque-aperiam-omnis",
                "rate": 204.36,
                "quantity": 4,
                "description": "Possimus non ullam fugiat. Error culpa eveniet aut ipsum harum quia voluptate. Perspiciatis consequuntur asperiores magni aspernatur libero. A ut fuga quas iure ab. Recusandae ut ad dolores voluptas cupiditate odio voluptatem.",
                "meta_title": "A Assumenda Eaque Aperiam Omnis Laravel E-Commerce API",
                "meta_description": "A Assumenda Eaque Aperiam Omnis Laravel E-Commerce API",
                "meta_keywords": "A Assumenda Eaque Aperiam Omnis Laravel E-Commerce API",
                "category": {
                    "id": 60,
                    "name": "Error Consectetur Minus",
                    "slug": "error-consectetur-minus"
                },
                "brand": {
                    "id": 59,
                    "name": "Mollitia Nam Quas",
                    "slug": "mollitia-nam-quas"
                }
            },
            {
                "id": 10,
                "category_id": 61,
                "brand_id": 60,
                "name": "Ratione Consequatur At Et Est",
                "slug": "ratione-consequatur-at-et-est",
                "rate": 862.41,
                "quantity": 4,
                "description": "Et laborum repellat ipsam voluptatibus repellendus. Libero deleniti ut impedit ut iusto assumenda aut. Corporis et quia quis officiis. Illo eveniet velit necessitatibus fuga modi velit quo et. Dolores doloremque aut deserunt maiores.",
                "meta_title": "Ratione Consequatur At Et Est Laravel E-Commerce API",
                "meta_description": "Ratione Consequatur At Et Est Laravel E-Commerce API",
                "meta_keywords": "Ratione Consequatur At Et Est Laravel E-Commerce API",
                "category": {
                    "id": 61,
                    "name": "Fugit Facere Dolore",
                    "slug": "fugit-facere-dolore"
                },
                "brand": {
                    "id": 60,
                    "name": "Qui Vel Ipsam",
                    "slug": "qui-vel-ipsam"
                }
            },
            {
                "id": 11,
                "category_id": 62,
                "brand_id": 61,
                "name": "Qui Doloremque Nulla Voluptatem Sequi",
                "slug": "qui-doloremque-nulla-voluptatem-sequi",
                "rate": 177.09,
                "quantity": 7,
                "description": "Amet consequatur vel dolor quas quibusdam. Officiis repudiandae reprehenderit et voluptatem perspiciatis impedit. Quasi omnis ipsam eos. Eum sit earum incidunt. Est quod nisi quidem magnam aut quia.",
                "meta_title": "Qui Doloremque Nulla Voluptatem Sequi Laravel E-Commerce API",
                "meta_description": "Qui Doloremque Nulla Voluptatem Sequi Laravel E-Commerce API",
                "meta_keywords": "Qui Doloremque Nulla Voluptatem Sequi Laravel E-Commerce API",
                "category": {
                    "id": 62,
                    "name": "Sint Qui Est",
                    "slug": "sint-qui-est"
                },
                "brand": {
                    "id": 61,
                    "name": "Ut Ut Tempore",
                    "slug": "ut-ut-tempore"
                }
            },
            {
                "id": 12,
                "category_id": 63,
                "brand_id": 62,
                "name": "Earum Impedit Illo Illum Beatae",
                "slug": "earum-impedit-illo-illum-beatae",
                "rate": 742.87,
                "quantity": 7,
                "description": "Tempore quos consequatur nam unde sed ex quisquam. Asperiores cumque quo explicabo id mollitia ut accusamus. Aut ut aspernatur veritatis excepturi ex veniam. Fugit dolore quod est necessitatibus in tempora quo. Autem et tempora culpa sunt.",
                "meta_title": "Earum Impedit Illo Illum Beatae Laravel E-Commerce API",
                "meta_description": "Earum Impedit Illo Illum Beatae Laravel E-Commerce API",
                "meta_keywords": "Earum Impedit Illo Illum Beatae Laravel E-Commerce API",
                "category": {
                    "id": 63,
                    "name": "Error Pariatur Ut",
                    "slug": "error-pariatur-ut"
                },
                "brand": {
                    "id": 62,
                    "name": "Qui Fuga Iste",
                    "slug": "qui-fuga-iste"
                }
            },
            {
                "id": 13,
                "category_id": 64,
                "brand_id": 63,
                "name": "Eum Culpa Ab Sunt Quo",
                "slug": "eum-culpa-ab-sunt-quo",
                "rate": 964.1,
                "quantity": 6,
                "description": "Sit reprehenderit quasi aperiam aliquid est. Provident aut consequatur dolore quia eum et aut. Sit incidunt reprehenderit dolorum quisquam voluptatem. Officiis soluta aliquam quos deleniti. Qui labore doloribus dolores culpa.",
                "meta_title": "Eum Culpa Ab Sunt Quo Laravel E-Commerce API",
                "meta_description": "Eum Culpa Ab Sunt Quo Laravel E-Commerce API",
                "meta_keywords": "Eum Culpa Ab Sunt Quo Laravel E-Commerce API",
                "category": {
                    "id": 64,
                    "name": "Velit Eos Esse",
                    "slug": "velit-eos-esse"
                },
                "brand": {
                    "id": 63,
                    "name": "Dolorem Cum Culpa",
                    "slug": "dolorem-cum-culpa"
                }
            },
            {
                "id": 14,
                "category_id": 65,
                "brand_id": 64,
                "name": "Non Sed Consectetur Molestiae Qui",
                "slug": "non-sed-consectetur-molestiae-qui",
                "rate": 756.76,
                "quantity": 5,
                "description": "Impedit laboriosam dignissimos tenetur qui. Ut at sunt cum consequatur. Nisi quo quibusdam quo quo. Ut harum qui accusamus vel unde quia. Laboriosam cum repellat est magnam numquam voluptatem consequatur labore.",
                "meta_title": "Non Sed Consectetur Molestiae Qui Laravel E-Commerce API",
                "meta_description": "Non Sed Consectetur Molestiae Qui Laravel E-Commerce API",
                "meta_keywords": "Non Sed Consectetur Molestiae Qui Laravel E-Commerce API",
                "category": {
                    "id": 65,
                    "name": "Est Voluptatibus Nobis",
                    "slug": "est-voluptatibus-nobis"
                },
                "brand": {
                    "id": 64,
                    "name": "Et Voluptatibus Molestiae",
                    "slug": "et-voluptatibus-molestiae"
                }
            },
            {
                "id": 15,
                "category_id": 66,
                "brand_id": 65,
                "name": "Tempora Voluptas Asperiores Ut Quis",
                "slug": "tempora-voluptas-asperiores-ut-quis",
                "rate": 212.04,
                "quantity": 1,
                "description": "Debitis harum ullam suscipit ullam ut eum sint neque. Omnis aliquid natus voluptatem explicabo. Nam velit id eos fugiat. Fuga debitis voluptate necessitatibus vel repudiandae. Asperiores debitis quia dolor molestiae.",
                "meta_title": "Tempora Voluptas Asperiores Ut Quis Laravel E-Commerce API",
                "meta_description": "Tempora Voluptas Asperiores Ut Quis Laravel E-Commerce API",
                "meta_keywords": "Tempora Voluptas Asperiores Ut Quis Laravel E-Commerce API",
                "category": {
                    "id": 66,
                    "name": "Officia Eligendi Officia",
                    "slug": "officia-eligendi-officia"
                },
                "brand": {
                    "id": 65,
                    "name": "Enim Ad Et",
                    "slug": "enim-ad-et"
                }
            },
            {
                "id": 16,
                "category_id": 67,
                "brand_id": 66,
                "name": "Ea Repellendus Autem Culpa Quasi",
                "slug": "ea-repellendus-autem-culpa-quasi",
                "rate": 417.03,
                "quantity": 1,
                "description": "Illo ea voluptate est. Soluta et mollitia repellendus ut. Sapiente tempore quo quia tempora. Aperiam consectetur aut aut sint veritatis atque. Aliquid et qui quas repellendus.",
                "meta_title": "Ea Repellendus Autem Culpa Quasi Laravel E-Commerce API",
                "meta_description": "Ea Repellendus Autem Culpa Quasi Laravel E-Commerce API",
                "meta_keywords": "Ea Repellendus Autem Culpa Quasi Laravel E-Commerce API",
                "category": {
                    "id": 67,
                    "name": "Exercitationem Voluptatem Rerum",
                    "slug": "exercitationem-voluptatem-rerum"
                },
                "brand": {
                    "id": 66,
                    "name": "Iste Molestias Earum",
                    "slug": "iste-molestias-earum"
                }
            }
        ],
        "first_page_url": "http://localhost:8000?page=1",
        "from": 1,
        "last_page": 4,
        "last_page_url": "http://localhost:8000?page=4",
        "links": [
            {
                "url": null,
                "label": "« Previous",
                "active": false
            },
            {
                "url": "http://localhost:8000?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": "http://localhost:8000?page=2",
                "label": "2",
                "active": false
            },
            {
                "url": "http://localhost:8000?page=3",
                "label": "3",
                "active": false
            },
            {
                "url": "http://localhost:8000?page=4",
                "label": "4",
                "active": false
            },
            {
                "url": "http://localhost:8000?page=2",
                "label": "Next »",
                "active": false
            }
        ],
        "next_page_url": "http://localhost:8000?page=2",
        "path": "http://localhost:8000",
        "per_page": 16,
        "prev_page_url": null,
        "to": 16,
        "total": 50
    }
}
 

Request   

GET api/v1/admin/products

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

The page number. Defaults to 1. Example: 1

Add new Product

requires authentication

Create a new Product and store it's details.

Example request:
curl --request POST \
    "https://ecomapi.bmehul.com/api/v1/admin/products" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: multipart/form-data" \
    --header "Accept: application/json" \
    --form "name=Gucci"\
    --form "description=Gucci clothes made of the best quality materials sold all over the world."\
    --form "category_id=1"\
    --form "brand_id=1"\
    --form "rate=119"\
    --form "quantity=10"\
    --form "meta_title=Gucci clothes made of the best quality materials."\
    --form "meta_description=Gucci clothes made of the best quality materials sold all over the world."\
    --form "meta_keywords=T-shirt, Gucci clothes, best quality tshirt for women"\
    --form "image=@/tmp/php8u1paki687lnapIR4eH" 
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/products"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "multipart/form-data",
    "Accept": "application/json",
};

const body = new FormData();
body.append('name', 'Gucci');
body.append('description', 'Gucci clothes made of the best quality materials sold all over the world.');
body.append('category_id', '1');
body.append('brand_id', '1');
body.append('rate', '119');
body.append('quantity', '10');
body.append('meta_title', 'Gucci clothes made of the best quality materials.');
body.append('meta_description', 'Gucci clothes made of the best quality materials sold all over the world.');
body.append('meta_keywords', 'T-shirt, Gucci clothes, best quality tshirt for women');
body.append('image', document.querySelector('input[name="image"]').files[0]);

fetch(url, {
    method: "POST",
    headers,
    body,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/products';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'multipart/form-data',
            'Accept' => 'application/json',
        ],
        'multipart' => [
            [
                'name' => 'name',
                'contents' => 'Gucci'
            ],
            [
                'name' => 'description',
                'contents' => 'Gucci clothes made of the best quality materials sold all over the world.'
            ],
            [
                'name' => 'category_id',
                'contents' => '1'
            ],
            [
                'name' => 'brand_id',
                'contents' => '1'
            ],
            [
                'name' => 'rate',
                'contents' => '119'
            ],
            [
                'name' => 'quantity',
                'contents' => '10'
            ],
            [
                'name' => 'meta_title',
                'contents' => 'Gucci clothes made of the best quality materials.'
            ],
            [
                'name' => 'meta_description',
                'contents' => 'Gucci clothes made of the best quality materials sold all over the world.'
            ],
            [
                'name' => 'meta_keywords',
                'contents' => 'T-shirt, Gucci clothes, best quality tshirt for women'
            ],
            [
                'name' => 'image',
                'contents' => fopen('/tmp/php8u1paki687lnapIR4eH', 'r')
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (201):


{
    "status": "success",
    "message": "Product added successfully.",
    "data": {
        "name": "Product 1",
        "rate": 10,
        "quantity": 10,
        "category_id": 1,
        "brand_id": 1,
        "description": "Qui aut quia soluta ut et repellendus aut.",
        "meta_title": "jqfpfenwpledzbrovcmnsylb",
        "meta_description": "sdovbzcbfmbwnxpgvrqzdi",
        "meta_keywords": "dvrisbpzc",
        "slug": "product-1",
        "updated_at": "2023-05-18T00:00:00.000000Z",
        "created_at": "2023-05-18T00:00:00.000000Z",
        "id": 1
    }
}
 

Example response (422):


{
    "message": "The name field is required. (and 3 more errors)",
    "errors": {
        "name": [
            "The name field is required."
        ],
        "category_id": [
            "The category field is required."
        ],
        "description": [
            "The description field is required."
        ],
        "meta_title": [
            "The meta title field is required."
        ],
        "meta_description": [
            "The meta description field is required."
        ]
    }
}
 

Request   

POST api/v1/admin/products

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: multipart/form-data

Accept      

Example: application/json

Body Parameters

name   string   

Required. The name of the product. Must not be greater than 100 characters. Example: Gucci

description   string   

Required. The description of the product. Example: Gucci clothes made of the best quality materials sold all over the world.

category_id   integer   

Required. The id of category that this product is being added in. Should be positive integer, and should exist in categories table. The id of an existing record in the categories table. Example: 1

brand_id   integer   

Required. The id of brand that this product is being added in. Should be positive integer, and should exist in brands table. The id of an existing record in the brands table. Example: 1

rate   number   

Required. The amount of the product that it will be sold to the customers. Should be positive integer, greater than 0. Must be at least 0.0. Example: 119

quantity   number   

Required. The quantity of the product. Should be positive integer, greater than 0. Must be at least 0. Example: 10

image   file   

Required. The image of the product. Should be a valid file with a valid extension of either jpg, jpeg, or png. No other image file types are supported at the moment. Must be a file. Must not be greater than 1024 kilobytes. Example: /tmp/php8u1paki687lnapIR4eH

meta_title   string   

Required. The title of the page. Refers to the text that is displayed on search engine result pages and browser tabs to indicate the topic of a webpage. Must not be greater than 80 characters. Example: Gucci clothes made of the best quality materials.

meta_description   string   

Required. This informs and interests users with a short, relevant summary of what a particular page is about. Must not be greater than 180 characters. Example: Gucci clothes made of the best quality materials sold all over the world.

meta_keywords   string  optional  

A comma separated words or phrases related to the product. Must not be greater than 255 characters. Example: T-shirt, Gucci clothes, best quality tshirt for women

Get single Product

requires authentication

Fetch the details about the given Product id.

Example request:
curl --request GET \
    --get "https://ecomapi.bmehul.com/api/v1/admin/products/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/products/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/products/1';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "",
    "data": {
        "name": "Product 1",
        "rate": 10,
        "quantity": 10,
        "category_id": 1,
        "brand_id": 1,
        "description": "Qui aut quia soluta ut et repellendus aut.",
        "meta_title": "jqfpfenwpledzbrovcmnsylb",
        "meta_description": "sdovbzcbfmbwnxpgvrqzdi",
        "meta_keywords": "dvrisbpzc",
        "slug": "product-1",
        "updated_at": "2023-05-18T00:00:00.000000Z",
        "created_at": "2023-05-18T00:00:00.000000Z",
        "id": 1
    }
}
 

Example response (404):


{
    "status": "failed",
    "message": "Product not found.",
    "data": []
}
 

Request   

GET api/v1/admin/products/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The id of the Product. Example: 1

Update Product

requires authentication

Update the Product details of the given id.

Example request:
curl --request PUT \
    "https://ecomapi.bmehul.com/api/v1/admin/products/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: multipart/form-data" \
    --header "Accept: application/json" \
    --form "name=Gucci"\
    --form "description=Gucci clothes made of the best quality materials sold all over the world."\
    --form "category_id=1"\
    --form "brand_id=1"\
    --form "rate=119"\
    --form "quantity=10"\
    --form "meta_title=Gucci clothes made of the best quality materials."\
    --form "meta_description=Gucci clothes made of the best quality materials sold all over the world."\
    --form "meta_keywords=T-shirt, Gucci clothes, best quality tshirt for women"\
    --form "image=@/tmp/php4r52iuj4um2g9C0oRQp" 
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/products/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "multipart/form-data",
    "Accept": "application/json",
};

const body = new FormData();
body.append('name', 'Gucci');
body.append('description', 'Gucci clothes made of the best quality materials sold all over the world.');
body.append('category_id', '1');
body.append('brand_id', '1');
body.append('rate', '119');
body.append('quantity', '10');
body.append('meta_title', 'Gucci clothes made of the best quality materials.');
body.append('meta_description', 'Gucci clothes made of the best quality materials sold all over the world.');
body.append('meta_keywords', 'T-shirt, Gucci clothes, best quality tshirt for women');
body.append('image', document.querySelector('input[name="image"]').files[0]);

fetch(url, {
    method: "PUT",
    headers,
    body,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/products/1';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'multipart/form-data',
            'Accept' => 'application/json',
        ],
        'multipart' => [
            [
                'name' => 'name',
                'contents' => 'Gucci'
            ],
            [
                'name' => 'description',
                'contents' => 'Gucci clothes made of the best quality materials sold all over the world.'
            ],
            [
                'name' => 'category_id',
                'contents' => '1'
            ],
            [
                'name' => 'brand_id',
                'contents' => '1'
            ],
            [
                'name' => 'rate',
                'contents' => '119'
            ],
            [
                'name' => 'quantity',
                'contents' => '10'
            ],
            [
                'name' => 'meta_title',
                'contents' => 'Gucci clothes made of the best quality materials.'
            ],
            [
                'name' => 'meta_description',
                'contents' => 'Gucci clothes made of the best quality materials sold all over the world.'
            ],
            [
                'name' => 'meta_keywords',
                'contents' => 'T-shirt, Gucci clothes, best quality tshirt for women'
            ],
            [
                'name' => 'image',
                'contents' => fopen('/tmp/php4r52iuj4um2g9C0oRQp', 'r')
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Product updated successfully.",
    "data": {
        "name": "Product 1",
        "description": "Qui aut quia soluta ut et repellendus aut.",
        "meta_title": "jqfpfenwpledzbrovcmnsylb",
        "meta_description": "sdovbzcbfmbwnxpgvrqzdi",
        "meta_keywords": "dvrisbpzc",
        "slug": "product-1",
        "updated_at": "2023-05-18T00:00:00.000000Z",
        "created_at": "2023-05-18T00:00:00.000000Z",
        "id": 1
    }
}
 

Example response (404):


{
    "status": "failed",
    "message": "Product not found.",
    "data": []
}
 

Example response (422):


{
    "message": "The name field is required. (and 3 more errors)",
    "errors": {
        "name": [
            "The name field is required."
        ],
        "category_id": [
            "The category field is required."
        ],
        "description": [
            "The description field is required."
        ],
        "meta_title": [
            "The meta title field is required."
        ],
        "meta_description": [
            "The meta description field is required."
        ]
    }
}
 

Request   

PUT api/v1/admin/products/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: multipart/form-data

Accept      

Example: application/json

URL Parameters

id   integer   

The id of the Product. Example: 1

Body Parameters

name   string   

Required. The name of the product. Must not be greater than 100 characters. Example: Gucci

description   string   

Required. The description of the product. Example: Gucci clothes made of the best quality materials sold all over the world.

category_id   integer   

Required. The id of category that this product is being added in. Should be positive integer, and should exist in categories table. The id of an existing record in the categories table. Example: 1

brand_id   integer   

Required. The id of brand that this product is being added in. Should be positive integer, and should exist in brands table. The id of an existing record in the brands table. Example: 1

rate   number   

Required. The amount of the product that it will be sold to the customers. Should be positive integer, greater than 0. Must be at least 0.0. Example: 119

quantity   number   

Required. The quantity of the product. Should be positive integer, greater than 0. Must be at least 0. Example: 10

image   file  optional  

Optional. The image of the product. Should be a valid file with a valid extension of either jpg, jpeg, or png. No other image file types are supported at the moment. Must be a file. Must not be greater than 1024 kilobytes. Example: /tmp/php4r52iuj4um2g9C0oRQp

meta_title   string   

Required. The title of the page. Refers to the text that is displayed on search engine result pages and browser tabs to indicate the topic of a webpage. Must not be greater than 80 characters. Example: Gucci clothes made of the best quality materials.

meta_description   string   

Required. This informs and interests users with a short, relevant summary of what a particular page is about. Must not be greater than 180 characters. Example: Gucci clothes made of the best quality materials sold all over the world.

meta_keywords   string  optional  

A comma separated words or phrases related to the product. Must not be greater than 255 characters. Example: T-shirt, Gucci clothes, best quality tshirt for women

Delete a Product

requires authentication

Delete the Product details of the given id. This will soft delete the Product. Meaning the record will be present in the database, however, it won't be available to access.

Example request:
curl --request DELETE \
    "https://ecomapi.bmehul.com/api/v1/admin/products/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/v1/admin/products/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/v1/admin/products/1';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Product deleted successfully.",
    "data": []
}
 

Example response (404):


{
    "status": "failed",
    "message": "Product not found.",
    "data": []
}
 

Request   

DELETE api/v1/admin/products/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The id of the Product. Example: 1

User Endpoints

Billing Address

The billing addresses of the user.

List all billing addresses

requires authentication

Displays all the billing addresses that are added by the user.

Example request:
curl --request GET \
    --get "https://ecomapi.bmehul.com/api/user/billing-address" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/billing-address"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/billing-address';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request   

GET api/user/billing-address

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Add new billing address

requires authentication

Store the new billing address with the provided details.

Example request:
curl --request POST \
    "https://ecomapi.bmehul.com/api/user/billing-address/store" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"first_name\": \"John\",
    \"last_name\": \"Doe\",
    \"email\": \"johndoe@example.com\",
    \"contact\": \"9876543210\",
    \"address_line_1\": \"24, Building Name\",
    \"address_line_2\": \"Some street name\",
    \"area\": \"St. Peters Stn\",
    \"landmark\": \"Chill StarBucks Cafe\",
    \"city\": \"Mumbai\",
    \"postal_code\": \"123456\",
    \"state_province\": \"Mahrashtra\",
    \"country\": \"India\"
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/billing-address/store"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "first_name": "John",
    "last_name": "Doe",
    "email": "johndoe@example.com",
    "contact": "9876543210",
    "address_line_1": "24, Building Name",
    "address_line_2": "Some street name",
    "area": "St. Peters Stn",
    "landmark": "Chill StarBucks Cafe",
    "city": "Mumbai",
    "postal_code": "123456",
    "state_province": "Mahrashtra",
    "country": "India"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/billing-address/store';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'first_name' => 'John',
            'last_name' => 'Doe',
            'email' => 'johndoe@example.com',
            'contact' => '9876543210',
            'address_line_1' => '24, Building Name',
            'address_line_2' => 'Some street name',
            'area' => 'St. Peters Stn',
            'landmark' => 'Chill StarBucks Cafe',
            'city' => 'Mumbai',
            'postal_code' => '123456',
            'state_province' => 'Mahrashtra',
            'country' => 'India',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Billing address created successfully.",
    "data": {
        "id": 1,
        "user_id": 2,
        "type": 1,
        "first_name": "John",
        "last_name": "Doe",
        "email": "johndoe@example.com",
        "contact": "9876543210",
        "address_line_1": "24, Building Name",
        "address_line_2": "Some street name",
        "area": "St. Peters Stn",
        "landmark": "Chill StarBucks Cafe",
        "city": "Mumbai",
        "postal_code": "400001",
        "state_province": "Maharashtra",
        "country": "India",
        "created_at": "2023-06-20T16:11:57.000000Z",
        "updated_at": "2023-06-20T16:11:57.000000Z"
    }
}
 

Example response (422):


{
    "message": "The first name field is required. (and 9 more errors)",
    "errors": {
        "first_name": [
            "The first name field is required."
        ],
        "last_name": [
            "The last name field is required."
        ],
        "email": [
            "The email field is required."
        ],
        "contact": [
            "The contact field is required."
        ],
        "address_line_1": [
            "The address line 1 field is required."
        ],
        "area": [
            "The area field is required."
        ],
        "city": [
            "The city field is required."
        ],
        "postal_code": [
            "The postal code field is required."
        ],
        "state_province": [
            "The state province field is required."
        ],
        "country": [
            "The country field is required."
        ]
    }
}
 

Request   

POST api/user/billing-address/store

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

first_name   string   

Required. The first name of the user on whom the invoice will be generated. Generally, it is the first name of the authenticated user. Must not be greater than 100 characters. Example: John

last_name   string   

Required. The last name of the user on whom the invoice will be generated. Generally, it is the last name of the authenticated user. Must not be greater than 100 characters. Example: Doe

email   string   

Required. The email of the user of whom the invoice will be generated. Generally, it is the email of the authenticated user. Must be a valid email address. Must not be greater than 100 characters. Example: johndoe@example.com

contact   string   

Required. The contact number of the user of whom the invoice will be generated. Generally, it is the contact number of the authenticated user. Must not be greater than 20 characters. Example: 9876543210

address_line_1   string   

Required. The first line of the address. Generally, this is the room/flat/apartment number of the user. Must not be greater than 100 characters. Example: 24, Building Name

address_line_2   string  optional  

Optional. The second line of the address. Generally, this is the street name and/or number where the user lives. Must not be greater than 100 characters. Example: Some street name

area   string   

Required. Generally, it is the nearest railway station name. But you can give it anything of your choice. Must not be greater than 100 characters. Example: St. Peters Stn

landmark   string  optional  

Optional. The famous landmark nearby to your house. Must not be greater than 100 characters. Example: Chill StarBucks Cafe

city   string   

Required. The city in which the user resides. Must not be greater than 100 characters. Example: Mumbai

postal_code   string   

Required. The postal or zip or ping code. Must contain only letters and numbers. Must not be greater than 20 characters. Example: 123456

state_province   string   

Required. The state or province in which your city is. Must not be greater than 100 characters. Example: Mahrashtra

country   string   

Required. The name of the country. Must not be greater than 100 characters. Example: India

Update billing address

requires authentication

Updates the existing billing address of the provided id with the provided details.

Example request:
curl --request PUT \
    "https://ecomapi.bmehul.com/api/user/billing-address/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"first_name\": \"John\",
    \"last_name\": \"Doe\",
    \"email\": \"johndoe@example.com\",
    \"contact\": \"9876543210\",
    \"address_line_1\": \"24, Building Name\",
    \"address_line_2\": \"Some street name\",
    \"area\": \"St. Peters Stn\",
    \"landmark\": \"Chill StarBucks Cafe\",
    \"city\": \"Mumbai\",
    \"postal_code\": \"123456\",
    \"state_province\": \"Mahrashtra\",
    \"country\": \"India\"
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/billing-address/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "first_name": "John",
    "last_name": "Doe",
    "email": "johndoe@example.com",
    "contact": "9876543210",
    "address_line_1": "24, Building Name",
    "address_line_2": "Some street name",
    "area": "St. Peters Stn",
    "landmark": "Chill StarBucks Cafe",
    "city": "Mumbai",
    "postal_code": "123456",
    "state_province": "Mahrashtra",
    "country": "India"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/billing-address/1';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'first_name' => 'John',
            'last_name' => 'Doe',
            'email' => 'johndoe@example.com',
            'contact' => '9876543210',
            'address_line_1' => '24, Building Name',
            'address_line_2' => 'Some street name',
            'area' => 'St. Peters Stn',
            'landmark' => 'Chill StarBucks Cafe',
            'city' => 'Mumbai',
            'postal_code' => '123456',
            'state_province' => 'Mahrashtra',
            'country' => 'India',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Billing address updated successfully.",
    "data": {
        "id": 1,
        "user_id": 2,
        "type": 1,
        "first_name": "John",
        "last_name": "Doe",
        "email": "johndoe@example.com",
        "contact": "9876543210",
        "address_line_1": "24, Building Name",
        "address_line_2": "Some street name",
        "area": "St. Peters Stn",
        "landmark": "Chill StarBucks Cafe",
        "city": "Mumbai",
        "postal_code": "400001",
        "state_province": "Maharashtra",
        "country": "India",
        "created_at": "2023-06-20T16:11:57.000000Z",
        "updated_at": "2023-06-20T16:11:57.000000Z"
    }
}
 

Example response (422):


{
    "message": "The first name field is required. (and 9 more errors)",
    "errors": {
        "first_name": [
            "The first name field is required."
        ],
        "last_name": [
            "The last name field is required."
        ],
        "email": [
            "The email field is required."
        ],
        "contact": [
            "The contact field is required."
        ],
        "address_line_1": [
            "The address line 1 field is required."
        ],
        "area": [
            "The area field is required."
        ],
        "city": [
            "The city field is required."
        ],
        "postal_code": [
            "The postal code field is required."
        ],
        "state_province": [
            "The state province field is required."
        ],
        "country": [
            "The country field is required."
        ]
    }
}
 

Request   

PUT api/user/billing-address/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The id of the billing address. Example: 1

Body Parameters

first_name   string   

Required. The first name of the user on whom the invoice will be generated. Generally, it is the first name of the authenticated user. Must not be greater than 100 characters. Example: John

last_name   string   

Required. The last name of the user on whom the invoice will be generated. Generally, it is the last name of the authenticated user. Must not be greater than 100 characters. Example: Doe

email   string   

Required. The email of the user of whom the invoice will be generated. Generally, it is the email of the authenticated user. Must be a valid email address. Must not be greater than 100 characters. Example: johndoe@example.com

contact   string   

Required. The contact number of the user of whom the invoice will be generated. Generally, it is the contact number of the authenticated user. Must not be greater than 20 characters. Example: 9876543210

address_line_1   string   

Required. The first line of the address. Generally, this is the room/flat/apartment number of the user. Must not be greater than 100 characters. Example: 24, Building Name

address_line_2   string  optional  

Optional. The second line of the address. Generally, this is the street name and/or number where the user lives. Must not be greater than 100 characters. Example: Some street name

area   string   

Required. Generally, it is the nearest railway station name. But you can give it anything of your choice. Must not be greater than 100 characters. Example: St. Peters Stn

landmark   string  optional  

Optional. The famous landmark nearby to your house. Must not be greater than 100 characters. Example: Chill StarBucks Cafe

city   string   

Required. The city in which the user resides. Must not be greater than 100 characters. Example: Mumbai

postal_code   string   

Required. The postal or zip or ping code. Must contain only letters and numbers. Must not be greater than 20 characters. Example: 123456

state_province   string   

Required. The state or province in which your city is. Must not be greater than 100 characters. Example: Mahrashtra

country   string   

Required. The name of the country. Must not be greater than 100 characters. Example: India

Delete billing address

requires authentication

Deletes the existing billing address of the provided id.

Example request:
curl --request DELETE \
    "https://ecomapi.bmehul.com/api/user/billing-address/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/billing-address/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/billing-address/1';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Billing address deleted successfully.",
    "data": []
}
 

Example response (404):


{
    "status": "failed",
    "message": "Billing address not found.",
    "data": []
}
 

Request   

DELETE api/user/billing-address/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The id of the billing address. Example: 1

Shipping Address

The shipping addresses of the user.

List all shipping addresses

requires authentication

Displays all the shipping addresses that are added by the user.

Example request:
curl --request GET \
    --get "https://ecomapi.bmehul.com/api/user/shipping-address" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/shipping-address"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/shipping-address';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request   

GET api/user/shipping-address

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Add new shipping address

requires authentication

Store the new shipping address with the provided details.

Example request:
curl --request POST \
    "https://ecomapi.bmehul.com/api/user/shipping-address/store" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"first_name\": \"John\",
    \"last_name\": \"Doe\",
    \"email\": \"johndoe@example.com\",
    \"contact\": \"9876543210\",
    \"address_line_1\": \"24, Building Name\",
    \"address_line_2\": \"Some street name\",
    \"area\": \"St. Peters Stn\",
    \"landmark\": \"Chill StarBucks Cafe\",
    \"city\": \"Mumbai\",
    \"postal_code\": \"123456\",
    \"state_province\": \"Mahrashtra\",
    \"country\": \"India\"
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/shipping-address/store"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "first_name": "John",
    "last_name": "Doe",
    "email": "johndoe@example.com",
    "contact": "9876543210",
    "address_line_1": "24, Building Name",
    "address_line_2": "Some street name",
    "area": "St. Peters Stn",
    "landmark": "Chill StarBucks Cafe",
    "city": "Mumbai",
    "postal_code": "123456",
    "state_province": "Mahrashtra",
    "country": "India"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/shipping-address/store';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'first_name' => 'John',
            'last_name' => 'Doe',
            'email' => 'johndoe@example.com',
            'contact' => '9876543210',
            'address_line_1' => '24, Building Name',
            'address_line_2' => 'Some street name',
            'area' => 'St. Peters Stn',
            'landmark' => 'Chill StarBucks Cafe',
            'city' => 'Mumbai',
            'postal_code' => '123456',
            'state_province' => 'Mahrashtra',
            'country' => 'India',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Shipping address created successfully.",
    "data": {
        "id": 1,
        "user_id": 2,
        "type": 2,
        "first_name": "John",
        "last_name": "Doe",
        "email": "johndoe@example.com",
        "contact": "9876543210",
        "address_line_1": "24, Building Name",
        "address_line_2": "Some street name",
        "area": "St. Peters Stn",
        "landmark": "Chill StarBucks Cafe",
        "city": "Mumbai",
        "postal_code": "400001",
        "state_province": "Maharashtra",
        "country": "India",
        "created_at": "2023-06-20T16:11:57.000000Z",
        "updated_at": "2023-06-20T16:11:57.000000Z"
    }
}
 

Example response (422):


{
    "message": "The first name field is required. (and 9 more errors)",
    "errors": {
        "first_name": [
            "The first name field is required."
        ],
        "last_name": [
            "The last name field is required."
        ],
        "email": [
            "The email field is required."
        ],
        "contact": [
            "The contact field is required."
        ],
        "address_line_1": [
            "The address line 1 field is required."
        ],
        "area": [
            "The area field is required."
        ],
        "city": [
            "The city field is required."
        ],
        "postal_code": [
            "The postal code field is required."
        ],
        "state_province": [
            "The state province field is required."
        ],
        "country": [
            "The country field is required."
        ]
    }
}
 

Request   

POST api/user/shipping-address/store

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

first_name   string   

Required. The first name of the user on whom the invoice will be generated. Generally, it is the first name of the authenticated user. Must not be greater than 100 characters. Example: John

last_name   string   

Required. The last name of the user on whom the invoice will be generated. Generally, it is the last name of the authenticated user. Must not be greater than 100 characters. Example: Doe

email   string   

Required. The email of the user of whom the invoice will be generated. Generally, it is the email of the authenticated user. Must be a valid email address. Must not be greater than 100 characters. Example: johndoe@example.com

contact   string   

Required. The contact number of the user of whom the invoice will be generated. Generally, it is the contact number of the authenticated user. Must not be greater than 20 characters. Example: 9876543210

address_line_1   string   

Required. The first line of the address. Generally, this is the room/flat/apartment number of the user. Must not be greater than 100 characters. Example: 24, Building Name

address_line_2   string  optional  

Optional. The second line of the address. Generally, this is the street name and/or number where the user lives. Must not be greater than 100 characters. Example: Some street name

area   string   

Required. Generally, it is the nearest railway station name. But you can give it anything of your choice. Must not be greater than 100 characters. Example: St. Peters Stn

landmark   string  optional  

Optional. The famous landmark nearby to your house. Must not be greater than 100 characters. Example: Chill StarBucks Cafe

city   string   

Required. The city in which the user resides. Must not be greater than 100 characters. Example: Mumbai

postal_code   string   

Required. The postal or zip or ping code. Must contain only letters and numbers. Must not be greater than 20 characters. Example: 123456

state_province   string   

Required. The state or province in which your city is. Must not be greater than 100 characters. Example: Mahrashtra

country   string   

Required. The name of the country. Must not be greater than 100 characters. Example: India

Update shipping address

requires authentication

Updates the existing shipping address of the provided id with the provided details.

Example request:
curl --request PUT \
    "https://ecomapi.bmehul.com/api/user/shipping-address/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"first_name\": \"John\",
    \"last_name\": \"Doe\",
    \"email\": \"johndoe@example.com\",
    \"contact\": \"9876543210\",
    \"address_line_1\": \"24, Building Name\",
    \"address_line_2\": \"Some street name\",
    \"area\": \"St. Peters Stn\",
    \"landmark\": \"Chill StarBucks Cafe\",
    \"city\": \"Mumbai\",
    \"postal_code\": \"123456\",
    \"state_province\": \"Mahrashtra\",
    \"country\": \"India\"
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/shipping-address/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "first_name": "John",
    "last_name": "Doe",
    "email": "johndoe@example.com",
    "contact": "9876543210",
    "address_line_1": "24, Building Name",
    "address_line_2": "Some street name",
    "area": "St. Peters Stn",
    "landmark": "Chill StarBucks Cafe",
    "city": "Mumbai",
    "postal_code": "123456",
    "state_province": "Mahrashtra",
    "country": "India"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/shipping-address/1';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'first_name' => 'John',
            'last_name' => 'Doe',
            'email' => 'johndoe@example.com',
            'contact' => '9876543210',
            'address_line_1' => '24, Building Name',
            'address_line_2' => 'Some street name',
            'area' => 'St. Peters Stn',
            'landmark' => 'Chill StarBucks Cafe',
            'city' => 'Mumbai',
            'postal_code' => '123456',
            'state_province' => 'Mahrashtra',
            'country' => 'India',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Shipping address updated successfully.",
    "data": {
        "id": 1,
        "user_id": 2,
        "type": 2,
        "first_name": "John",
        "last_name": "Doe",
        "email": "johndoe@example.com",
        "contact": "9876543210",
        "address_line_1": "24, Building Name",
        "address_line_2": "Some street name",
        "area": "St. Peters Stn",
        "landmark": "Chill StarBucks Cafe",
        "city": "Mumbai",
        "postal_code": "400001",
        "state_province": "Maharashtra",
        "country": "India",
        "created_at": "2023-06-20T16:11:57.000000Z",
        "updated_at": "2023-06-20T16:11:57.000000Z"
    }
}
 

Example response (422):


{
    "message": "The first name field is required. (and 9 more errors)",
    "errors": {
        "first_name": [
            "The first name field is required."
        ],
        "last_name": [
            "The last name field is required."
        ],
        "email": [
            "The email field is required."
        ],
        "contact": [
            "The contact field is required."
        ],
        "address_line_1": [
            "The address line 1 field is required."
        ],
        "area": [
            "The area field is required."
        ],
        "city": [
            "The city field is required."
        ],
        "postal_code": [
            "The postal code field is required."
        ],
        "state_province": [
            "The state province field is required."
        ],
        "country": [
            "The country field is required."
        ]
    }
}
 

Request   

PUT api/user/shipping-address/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The id of the shipping address. Example: 1

Body Parameters

first_name   string   

Required. The first name of the user on whom the invoice will be generated. Generally, it is the first name of the authenticated user. Must not be greater than 100 characters. Example: John

last_name   string   

Required. The last name of the user on whom the invoice will be generated. Generally, it is the last name of the authenticated user. Must not be greater than 100 characters. Example: Doe

email   string   

Required. The email of the user of whom the invoice will be generated. Generally, it is the email of the authenticated user. Must be a valid email address. Must not be greater than 100 characters. Example: johndoe@example.com

contact   string   

Required. The contact number of the user of whom the invoice will be generated. Generally, it is the contact number of the authenticated user. Must not be greater than 20 characters. Example: 9876543210

address_line_1   string   

Required. The first line of the address. Generally, this is the room/flat/apartment number of the user. Must not be greater than 100 characters. Example: 24, Building Name

address_line_2   string  optional  

Optional. The second line of the address. Generally, this is the street name and/or number where the user lives. Must not be greater than 100 characters. Example: Some street name

area   string   

Required. Generally, it is the nearest railway station name. But you can give it anything of your choice. Must not be greater than 100 characters. Example: St. Peters Stn

landmark   string  optional  

Optional. The famous landmark nearby to your house. Must not be greater than 100 characters. Example: Chill StarBucks Cafe

city   string   

Required. The city in which the user resides. Must not be greater than 100 characters. Example: Mumbai

postal_code   string   

Required. The postal or zip or ping code. Must contain only letters and numbers. Must not be greater than 20 characters. Example: 123456

state_province   string   

Required. The state or province in which your city is. Must not be greater than 100 characters. Example: Mahrashtra

country   string   

Required. The name of the country. Must not be greater than 100 characters. Example: India

Delete shipping address

requires authentication

Deletes the existing shipping address of the provided id.

Example request:
curl --request DELETE \
    "https://ecomapi.bmehul.com/api/user/shipping-address/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/shipping-address/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/shipping-address/1';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Shipping address deleted successfully.",
    "data": []
}
 

Example response (404):


{
    "status": "failed",
    "message": "Shipping address not found.",
    "data": []
}
 

Request   

DELETE api/user/shipping-address/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The id of the shipping address. Example: 1

Wishlist

The wishlist of the user. They can add or remove the product to and from wishlist.

List all products

requires authentication

Displays all the products that are added by the user in their wishlist.

Example request:
curl --request GET \
    --get "https://ecomapi.bmehul.com/api/user/wishlist" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/wishlist"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/wishlist';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request   

GET api/user/wishlist

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Add product

requires authentication

Store an existing product in their wishlist.

Example request:
curl --request POST \
    "https://ecomapi.bmehul.com/api/user/wishlist" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"product_id\": 1
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/wishlist"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "product_id": 1
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/wishlist';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'product_id' => 1,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Product has been successfully added.",
    "data": {
        "id": 1,
        "user_id": 2,
        "product_id": 1,
        "created_at": "2023-06-20T16:11:57.000000Z",
        "updated_at": "2023-06-20T16:11:57.000000Z"
    }
}
 

Example response (422):


{
    "message": "The product is required.",
    "errors": {
        "product_id": [
            "The product is required."
        ]
    }
}
 

Request   

POST api/user/wishlist

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

product_id   string   

Required. The id of the product. The id of an existing record in the products table. Example: 1

Remove a product

requires authentication

Removes the product of the provided id from the user's wishlist.

Example request:
curl --request DELETE \
    "https://ecomapi.bmehul.com/api/user/wishlist/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/wishlist/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/wishlist/1';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Product has been successfully removed.",
    "data": []
}
 

Example response (404):


{
    "status": "failed",
    "message": "Product not found with the provided id.",
    "data": []
}
 

Request   

DELETE api/user/wishlist/{productId}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

productId   integer   

The id of the product. Example: 1

Cart

The endpoints related to Cart

All products

requires authentication

Lists all the products that are added in the cart. Also, it will calculate the total amount of the cart.

Example request:
curl --request GET \
    --get "https://ecomapi.bmehul.com/api/user/cart" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/cart"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/cart';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request   

GET api/user/cart

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Add a product

requires authentication

Adds the product of the given id in to the cart. The product is then stored in the database. If the product is not found, 404 error will be returned.

Example request:
curl --request POST \
    "https://ecomapi.bmehul.com/api/user/cart/add" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/cart/add"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/cart/add';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (201):


{
    "status": "success",
    "message": "Product successfully added.",
    "data": {
        "id": 1,
        "user_id": 2,
        "product_id": 6,
        "product_name": "Harum Recusandae Qui Voluptas Incidunt",
        "product_slug": "harum-recusandae-qui-voluptas-incidunt",
        "rate": 100,
        "quantity": 3,
        "amount": 300,
        "created_at": "2023-11-29T12:47:57.000000Z",
        "updated_at": "2023-11-29T12:47:57.000000Z"
    }
}
 

Example response (404):


{
    "status": "success",
    "message": "Product with the provided id not found.",
    "data": null
}
 

Request   

POST api/user/cart/add

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Update product quantity

requires authentication

Update the product's quantity of the given cartProduct id. If the record is not found, 404 error will be returned.

Example request:
curl --request PUT \
    "https://ecomapi.bmehul.com/api/user/cart/update/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/cart/update/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "PUT",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/cart/update/1';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Product successfully updated.",
    "data": {
        "id": 1,
        "user_id": 2,
        "product_id": 6,
        "product_name": "Harum Recusandae Qui Voluptas Incidunt",
        "product_slug": "harum-recusandae-qui-voluptas-incidunt",
        "rate": 100,
        "quantity": 2,
        "amount": 200,
        "created_at": "2023-11-29T12:47:57.000000Z",
        "updated_at": "2023-11-29T12:50:13.000000Z"
    }
}
 

Example response (404):


{
    "status": "success",
    "message": "Product with the provided id not found.",
    "data": null
}
 

Request   

PUT api/user/cart/update/{cartProductId}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

cartProductId   integer   

The id of the cartProduct that you want to update the quantity of. Example: 1

Remove product

requires authentication

Removes the product of the given id from the cart. If the product is not found, 404 error will be returned.

Example request:
curl --request DELETE \
    "https://ecomapi.bmehul.com/api/user/cart/delete/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/cart/delete/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/cart/delete/1';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Product successfully removed.",
    "data": null
}
 

Example response (404):


{
    "status": "success",
    "message": "Product with the provided id not found.",
    "data": null
}
 

Request   

DELETE api/user/cart/delete/{cartProductId}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

cartProductId   integer   

The id of the product that you want to update the quantity of. Example: 1

Empty cart

requires authentication

Empties the cart entirely.

Example request:
curl --request DELETE \
    "https://ecomapi.bmehul.com/api/user/cart/empty" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/cart/empty"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/cart/empty';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Cart emptied successfully.",
    "data": null
}
 

Request   

DELETE api/user/cart/empty

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Checkout

The checkout order process. The values are stored in the session.

Both addresses

requires authentication

Fetch all the billing and shipping addresses.

Example request:
curl --request GET \
    --get "https://ecomapi.bmehul.com/api/user/checkout/addresses" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/checkout/addresses"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/checkout/addresses';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request   

GET api/user/checkout/addresses

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Billing Address

requires authentication

Store the billing address in the session.

Example request:
curl --request POST \
    "https://ecomapi.bmehul.com/api/user/checkout/billing-address" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"billing_address_id\": 1
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/checkout/billing-address"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "billing_address_id": 1
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/checkout/billing-address';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'billing_address_id' => 1,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Billing address successfully selected.",
    "data": []
}
 

Request   

POST api/user/checkout/billing-address

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

billing_address_id   integer   

Required. The id of the billing address that the invoice will be sent to. The id of an existing record in the user_addresses table. Example: 1

Shipping Address

requires authentication

Store the shipping address in the session.

Example request:
curl --request POST \
    "https://ecomapi.bmehul.com/api/user/checkout/shipping-address" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"shipping_address_id\": 1
}"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/checkout/shipping-address"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "shipping_address_id": 1
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/checkout/shipping-address';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'shipping_address_id' => 1,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Shipping address successfully selected.",
    "data": []
}
 

Request   

POST api/user/checkout/shipping-address

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

shipping_address_id   integer   

Required. The id of the shipping address that the invoice will be sent to. The id of an existing record in the user_addresses table. Example: 1

Place Order

requires authentication

Create a new order

Example request:
curl --request POST \
    "https://ecomapi.bmehul.com/api/user/checkout/place-order" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://ecomapi.bmehul.com/api/user/checkout/place-order"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ecomapi.bmehul.com/api/user/checkout/place-order';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "success",
    "message": "Order successfully placed.",
    "data": {
        "id": 1,
        "code": "ORD-BWUmJ",
        "stripe_customer_id": null,
        "user_id": 2,
        "user_details": {
            "full_name": "Letitia Glover",
            "email": "userone@example.com"
        },
        "billing_address": {
            "id": 3,
            "user_id": 2,
            "type": 1,
            "first_name": null,
            "last_name": null,
            "email": null,
            "contact": null,
            "address_line_1": null,
            "address_line_2": null,
            "area": null,
            "landmark": null,
            "city": null,
            "postal_code": null,
            "state_province": null,
            "country": null,
            "created_at": "2023-11-29T10:36:27.000000Z",
            "updated_at": "2023-11-29T10:36:27.000000Z"
        },
        "shipping_address": {
            "id": 4,
            "user_id": 2,
            "type": 2,
            "first_name": null,
            "last_name": null,
            "email": null,
            "contact": null,
            "address_line_1": null,
            "address_line_2": null,
            "area": null,
            "landmark": null,
            "city": null,
            "postal_code": null,
            "state_province": null,
            "country": null,
            "created_at": "2023-11-29T10:36:27.000000Z",
            "updated_at": "2023-11-29T10:36:27.000000Z"
        },
        "total_amount": 333.75,
        "updated_at": "2023-11-29T10:36:27.000000Z",
        "created_at": "2023-11-29T10:36:27.000000Z"
    }
}
 

Request   

POST api/user/checkout/place-order

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json