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));
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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.",
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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));
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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));
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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));
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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));
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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": []
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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": []
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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": []
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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.
Add new tag
requires authentication
Create a new tag and store it's details.
Get single tag
requires authentication
Fetch the details about the given tag id.
Update tag
requires authentication
Update the tag details of the given id.
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.
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
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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": []
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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": []
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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": []
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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": []
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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": []
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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": []
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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": []
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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": []
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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": []
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.