Introduction
This documentation will provide all the information you need to work with our API
This documentation aims to provide all the information you need to work with our API.
Authenticating requests
This API is not authenticated.
AdminPortal Management
Store a newly created administrator Creates a new administrator account, validates the input data, generates a random password, sends a confirmation email, and returns the created user details along with a success message.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/add-admin" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"full_name\": \"John Doe\",
\"email\": \"admin@example.com\"
}"
const url = new URL(
"farmsell.org/api/v2/admin/add-admin"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"full_name": "John Doe",
"email": "admin@example.com"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (201):
{
"status": "SUCCESS",
"message": "Registration successful. Please check your email for verification.",
"user": {
"id": 1,
"full_name": "John Doe",
"email": "admin@example.com",
"created_at": "2025-01-30T12:00:00Z",
"updated_at": "2025-01-30T12:00:00Z"
}
}
Example response (400):
{
"status": "FAILED",
"error": "This email address is already associated with another account. Please use a different email."
}
Example response (500):
{
"status": "FAILED",
"result": "Database error: <error_message>"
}
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 an administrator Authenticates an administrator by verifying their email and password, and returns a generated token for access to other API routes.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/login" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"email\": \"admin@example.com\",
\"password\": \"password123\"
}"
const url = new URL(
"farmsell.org/api/v2/admin/login"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "admin@example.com",
"password": "password123"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"data": {
"token": "generated_token_here",
"user": {
"id": 1,
"full_name": "John Doe",
"email": "admin@example.com",
"created_at": "2025-01-30T12:00:00Z",
"updated_at": "2025-01-30T12:00:00Z"
}
}
}
Example response (401):
{
"status": "FAILED",
"message": "Invalid credentials"
}
Example response (404):
{
"status": "FAILED",
"message": "User not found"
}
Example response (422):
{
"errors": {
"email": [
"The email field is required."
],
"password": [
"The password field is required."
]
}
}
Example response (500):
{
"status": "FAILED",
"message": "Database error: <error_message>"
}
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.
Verify OTP and login Verifies the OTP entered by the user and logs the user in if the OTP is valid and not expired. Upon successful verification, a token is generated for the user.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/verify_otp" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"email\": \"\\\"admin@example.com\\\"\",
\"otp\": \"\\\"123456\\\"\"
}"
const url = new URL(
"farmsell.org/api/v2/admin/verify_otp"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "\"admin@example.com\"",
"otp": "\"123456\""
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"user": {
"id": 1,
"full_name": "John Doe",
"email": "admin@example.com",
// other user details
},
"token": "access_token_here",
"message": "Login successful"
}
Example response (422):
{
"status": "FAILED",
"message": "Invalid or expired OTP"
}
Example response (422):
{
"errors": {
"email": [
"The email field is required."
],
"otp": [
"The otp field is required."
]
}
}
Example response (500):
{
"status": "FAILED",
"message": "An error occurred: <error_message>"
}
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.
Resend OTP verification code Resends the OTP verification code to the user's email address. This is useful if the user didn't receive the OTP or it has expired.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/resend-verify-code" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"email\": \"\\\"admin@example.com\\\"\"
}"
const url = new URL(
"farmsell.org/api/v2/admin/resend-verify-code"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "\"admin@example.com\""
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"message": "OTP sent successfully"
}
Example response (422):
{
"errors": {
"email": [
"The email field is required."
]
}
}
Example response (500):
{
"status": "FAILED",
"message": "An error occurred: <error_message>"
}
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.
Verify an administrator's email Verifies the administrator's email using a unique verification link with a user ID and hash. Marks the email as verified if the link is valid.
Example request:
curl --request GET \
--get "farmsell.org/api/v2/admin/email/verify/1/abcdef12345" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"farmsell.org/api/v2/admin/email/verify/1/abcdef12345"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"message": "Email verified successfully"
}
Example response (400):
{
"status": "FAILED",
"message": "Invalid verification link"
}
Example response (500):
{
"status": "FAILED",
"message": "An error occurred: <error_message>"
}
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.
Resend email verification link Resends the email verification link to an administrator who has not yet verified their email address. Returns a success message if the email has been sent, or an error message if the email is already verified.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/resend" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"id\": 1
}"
const url = new URL(
"farmsell.org/api/v2/admin/resend"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"id": 1
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"message": "Verification link sent!"
}
Example response (400):
{
"status": "FAILED",
"message": "Email is already verified."
}
Example response (500):
{
"status": "FAILED",
"message": "An error occurred: <error_message>"
}
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 the admin profile This endpoint returns the profile information of the authenticated admin. It fetches the current admin's data using the authentication token.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/admin-profile" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"farmsell.org/api/v2/admin/admin-profile"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"data": {
"id": 1,
"full_name": "John Doe",
"email": "admin@example.com",
"created_at": "2025-01-30T10:00:00.000000Z",
"updated_at": "2025-01-30T10:00:00.000000Z"
}
}
Example response (500):
{
"status": "FAILED",
"message": "An error occurred: <error_message>"
}
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 the authenticated admin's profile. This endpoint allows an authenticated admin to update their profile details. You can update optional fields like full name, email, profile picture, location, and more.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/admin-update-profile" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"full_name\": \"John Doe\",
\"email\": \"admin@example.com\",
\"user_name\": \"johndoe\",
\"picture\": \"http:\\/\\/example.com\\/picture.jpg\",
\"avatar_google\": \"http:\\/\\/example.com\\/avatar.jpg\",
\"about_user\": \"I am a software developer.\",
\"location\": \"New York\",
\"language\": \"English\",
\"gender\": \"Male\",
\"image_cover\": \"http:\\/\\/example.com\\/cover.jpg\",
\"country\": \"USA\",
\"date_of_birth\": \"1985-10-10\",
\"physical_address\": \"123 Street, City\",
\"country_code\": \"+1\",
\"phone\": \"+1234567890\"
}"
const url = new URL(
"farmsell.org/api/v2/admin/admin-update-profile"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"full_name": "John Doe",
"email": "admin@example.com",
"user_name": "johndoe",
"picture": "http:\/\/example.com\/picture.jpg",
"avatar_google": "http:\/\/example.com\/avatar.jpg",
"about_user": "I am a software developer.",
"location": "New York",
"language": "English",
"gender": "Male",
"image_cover": "http:\/\/example.com\/cover.jpg",
"country": "USA",
"date_of_birth": "1985-10-10",
"physical_address": "123 Street, City",
"country_code": "+1",
"phone": "+1234567890"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"message": "Profile updated successfully.",
"data": {
"id": 1,
"full_name": "John Doe",
"email": "admin@example.com",
"user_name": "johndoe",
"picture": "http://example.com/picture.jpg",
"avatar_google": "http://example.com/avatar.jpg",
"about_user": "I am a software developer.",
"location": "New York",
"language": "English",
"gender": "Male",
"image_cover": "http://example.com/cover.jpg",
"country": "USA",
"date_of_birth": "1985-10-10",
"physical_address": "123 Street, City",
"country_code": "+1",
"phone": "+1234567890",
"created_at": "2025-01-30T10:00:00.000000Z",
"updated_at": "2025-01-30T10:30:00.000000Z"
}
}
Example response (404):
{
"message": "Administor not found."
}
Example response (500):
{
"message": "An error occurred while updating the profile.",
"error": "<error_message>"
}
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 the authenticated admin. This endpoint allows the authenticated admin to log out by revoking and deleting their access token. After logging out, the admin will no longer be able to make authenticated requests until they log in again.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/admin_logout" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"farmsell.org/api/v2/admin/admin_logout"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());Example response (200):
{
"result": true,
"message": "Successfully logged out"
}
Example response (401):
{
"message": "Unauthorized"
}
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.
Category Management
Create a Category Creates a new product category with an optional banner image.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/category/add-category" \
--header "Content-Type: multipart/form-data" \
--header "Accept: application/json" \
--form "category_name=sint"\
--form "description=Officiis rerum quo eligendi ut laudantium est cum alias."\
--form "image=@/tmp/phpHiPMV4" const url = new URL(
"farmsell.org/api/v2/admin/category/add-category"
);
const headers = {
"Content-Type": "multipart/form-data",
"Accept": "application/json",
};
const body = new FormData();
body.append('category_name', 'sint');
body.append('description', 'Officiis rerum quo eligendi ut laudantium est cum alias.');
body.append('image', document.querySelector('input[name="image"]').files[0]);
fetch(url, {
method: "POST",
headers,
body,
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"data": "Category created successfully"
}
Example response (400):
{
"error": {
"category_name": [
"The category name field is required."
]
}
}
Example response (500):
{
"status": "FAILED",
"data": "Error message"
}
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 a Category Updates the details of an existing category, including an optional category banner image.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/category/update-category" \
--header "Content-Type: multipart/form-data" \
--header "Accept: application/json" \
--form "category_id=9"\
--form "category_name=sapiente"\
--form "description=Dolor sunt non laborum ut."\
--form "image=@/tmp/phpN3WdiI" const url = new URL(
"farmsell.org/api/v2/admin/category/update-category"
);
const headers = {
"Content-Type": "multipart/form-data",
"Accept": "application/json",
};
const body = new FormData();
body.append('category_id', '9');
body.append('category_name', 'sapiente');
body.append('description', 'Dolor sunt non laborum ut.');
body.append('image', document.querySelector('input[name="image"]').files[0]);
fetch(url, {
method: "POST",
headers,
body,
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"data": "Category updated successfully"
}
Example response (400):
{
"error": {
"category_id": [
"The category_id field is required."
]
}
}
Example response (404):
{
"status": "FAILED",
"data": "Category not found"
}
Example response (500):
{
"status": "FAILED",
"data": "Error message"
}
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.
List Categories Retrieves a list of categories with optional filters and pagination.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/category/all-category" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"search\": \"sunt\",
\"category_id\": 19
}"
const url = new URL(
"farmsell.org/api/v2/admin/category/all-category"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"search": "sunt",
"category_id": 19
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"data": {
"current_page": 1,
"data": [
{
"id": 1,
"category_name": "Electronics",
"banner": {
"picture_url": "electronics_banner.jpg"
},
"subcategory": [
{
"subcat_name": "Mobile Phones"
},
{
"subcat_name": "Laptops"
}
]
},
...
],
"last_page": 5
}
}
Example response (400):
{
"status": "FAILED",
"data": "Invalid request"
}
Example response (500):
{
"status": "FAILED",
"data": "Error message"
}
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 Deletes a category from the system.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/category/delete-category" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"category_id\": 18
}"
const url = new URL(
"farmsell.org/api/v2/admin/category/delete-category"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"category_id": 18
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"data": "Category deleted successfully"
}
Example response (400):
{
"error": {
"category_id": [
"The category_id field is required."
]
}
}
Example response (404):
{
"status": "FAILED",
"data": "Category not found"
}
Example response (500):
{
"status": "FAILED",
"data": "Error message"
}
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.
Endpoints
POST api/v2/admin/product/update-stock-level
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/product/update-stock-level" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"farmsell.org/api/v2/admin/product/update-stock-level"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());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.
POST api/v2/admin/product/adjust-price
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/product/adjust-price" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"farmsell.org/api/v2/admin/product/adjust-price"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());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.
POST api/v2/admin/product/mark-product
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/product/mark-product" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"farmsell.org/api/v2/admin/product/mark-product"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());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.
Inventory Management
Get Product Analytics Retrieves various analytics related to product performance, including total products, low-stock items, top-performing products, and slow-moving products.
Example request:
curl --request GET \
--get "farmsell.org/api/v2/admin/inventory/analytics" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"farmsell.org/api/v2/admin/inventory/analytics"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
{
"total_products": 150,
"low_stock_items": 10,
"top_performing_products": 5,
"slow_moving_products": 8
}
Example response (500):
{
"status": "FAILED",
"message": "An error occurred while fetching analytics."
}
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 All Stock Retrieves a paginated list of all stock products with optional filtering by status, category, subcategory, and product title.
Example request:
curl --request GET \
--get "farmsell.org/api/v2/admin/inventory/all-stock?status=active&category_id=2&sub_category_id=5&product_title=Laptop" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"farmsell.org/api/v2/admin/inventory/all-stock"
);
const params = {
"status": "active",
"category_id": "2",
"sub_category_id": "5",
"product_title": "Laptop",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"payload": {
"current_page": 1,
"data": [
{
"id": 1,
"product_title": "Laptop",
"category": {
"id": 2,
"name": "Electronics"
},
"subCategory": {
"id": 5,
"name": "Computers"
},
"status": "active",
"images": [
{
"id": 10,
"url": "https://example.com/image.jpg"
}
]
}
],
"per_page": 20,
"total": 100
}
}
Example response (500):
{
"status": "FAILED",
"message": "Failed to fetch products",
"error": "Internal server error message"
}
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.
Order Management
List All Orders Retrieves all orders with optional filters for status and date sorting.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/order/all-orders" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"status\": \"sed\",
\"sort_date\": \"ratione\"
}"
const url = new URL(
"farmsell.org/api/v2/admin/order/all-orders"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"status": "sed",
"sort_date": "ratione"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"current_page": 1,
"data": [
{
"id": 1,
"customer": {
"id": 123,
"full_name": "John Doe",
"phone": "123-456-7890",
"email": "john.doe@example.com"
},
"items": [
{
"id": 1,
"product": {
"id": 10,
"product_title": "Product Title"
},
"quantity": 2,
"price": 25
}
],
"status": "pending",
"created_at": "2025-01-29T12:00:00Z"
}
],
"total": 100,
"per_page": 20,
"last_page": 5,
"from": 1,
"to": 20
}
Example response (500):
{
"status": "FAILED",
"message": "Failed to fetch products",
"error": "Error message"
}
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.
Cancel an Order Cancels an existing order by updating its status to 'canceled'.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/order/cancel-order" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"orderId\": 6
}"
const url = new URL(
"farmsell.org/api/v2/admin/order/cancel-order"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"orderId": 6
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"message": "Order has been cancelled"
}
Example response (404):
{
"message": "Order not found"
}
Example response (500):
{
"status": "FAILED",
"message": "Order has been cancelled"
}
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.
Mark an Order as Shipped Marks an existing order as shipped by updating its status to 'shipped'. Optionally, this could also update the shipment timestamp and notify the customer.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/order/shipped-order" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"orderId\": 3
}"
const url = new URL(
"farmsell.org/api/v2/admin/order/shipped-order"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"orderId": 3
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"message": "Order has been shipped"
}
Example response (404):
{
"message": "Order not found"
}
Example response (500):
{
"status": "FAILED",
"message": "Order has failed to be shipped"
}
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.
Bulk Update Orders to Shipped Status This endpoint allows you to bulk update the status of multiple orders to 'shipped'. It accepts an array of order IDs and processes them to set their status to 'shipped'.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/order/bulk_shipping" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"order_Ids\": [
\"rerum\"
]
}"
const url = new URL(
"farmsell.org/api/v2/admin/order/bulk_shipping"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"order_Ids": [
"rerum"
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"message": "Bulk operation for 'shipped' completed",
"results": {
"shipped": [
1,
2,
3
],
"failed": [
{
"id": 4,
"message": "Order not found"
},
{
"id": 5,
"message": "Status update failed"
}
]
}
}
Example response (500):
{
"status": "FAILED",
"message": "Something went wrong",
"error": "Exception message here"
}
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.
Mark an Order as Delivered Marks an existing order as delivered by updating its status to 'delivered'. Optionally, it records the delivery time and notifies the customer about the delivery.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/order/delivered-order" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"orderId\": 17
}"
const url = new URL(
"farmsell.org/api/v2/admin/order/delivered-order"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"orderId": 17
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"message": "Order has been delivered"
}
Example response (404):
{
"message": "Order not found"
}
Example response (500):
{
"status": "FAILED",
"message": "Order has failed to be delivered"
}
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.
Bulk Update Orders to Delivered Status This endpoint allows you to bulk update the status of multiple orders to 'delivered'. It accepts an array of order IDs and processes them to set their status to 'delivered'.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/order/bulk-delivered" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"order_Ids\": [
\"distinctio\"
]
}"
const url = new URL(
"farmsell.org/api/v2/admin/order/bulk-delivered"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"order_Ids": [
"distinctio"
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"message": "Bulk operation for 'delivered' completed",
"results": {
"delivered": [
1,
2,
3
],
"failed": [
{
"id": 4,
"message": "Order not found"
},
{
"id": 5,
"message": "Status update failed"
}
]
}
}
Example response (500):
{
"status": "FAILED",
"message": "Something went wrong",
"error": "Exception message here"
}
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.
Mark an Order as Completed Marks an existing order as completed by updating its status to 'completed'.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/order/completed-order" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"orderId\": 6
}"
const url = new URL(
"farmsell.org/api/v2/admin/order/completed-order"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"orderId": 6
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"message": "Order has been completed"
}
Example response (404):
{
"message": "Order not found"
}
Example response (500):
{
"status": "FAILED",
"message": "Order has failed been completed"
}
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.
Bulk Update Orders to Canceled Status This endpoint allows you to bulk update the status of multiple orders to 'canceled'. It accepts an array of order IDs and processes them to set their status to 'canceled'.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/order/bulk-canceled" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"order_Ids\": [
\"reprehenderit\"
]
}"
const url = new URL(
"farmsell.org/api/v2/admin/order/bulk-canceled"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"order_Ids": [
"reprehenderit"
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"message": "Bulk operation for 'canceled' completed",
"results": {
"canceled": [
1,
2,
3
],
"failed": [
{
"id": 4,
"message": "Order not found"
},
{
"id": 5,
"message": "Status update failed"
}
]
}
}
Example response (500):
{
"status": "FAILED",
"message": "Something went wrong",
"error": "Exception message here"
}
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.
Bulk Update Orders to Completed Status This endpoint allows you to bulk update the status of multiple orders to 'completed'. It accepts an array of order IDs and processes them to set their status to 'completed'.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/order/bulk-completed" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"order_Ids\": [
\"provident\"
]
}"
const url = new URL(
"farmsell.org/api/v2/admin/order/bulk-completed"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"order_Ids": [
"provident"
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"message": "Bulk operation for 'completed' completed",
"results": {
"completed": [
1,
2,
3
],
"failed": [
{
"id": 4,
"message": "Order not found"
},
{
"id": 5,
"message": "Status update failed"
}
]
}
}
Example response (500):
{
"status": "FAILED",
"message": "Something went wrong",
"error": "Exception message here"
}
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 the Order Status Analysis Retrieves the count of orders by their status (pending, completed, canceled, delivered, and shipped). This is helpful for analyzing the distribution of orders across various statuses.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/order/order-status-analysis" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"farmsell.org/api/v2/admin/order/order-status-analysis"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"payload": {
"pending": 10,
"completed": 25,
"canceled": 5,
"delivered": 30,
"shipped": 20
}
}
Example response (500):
{
"status": "ERROR",
"message": "Internal Server Error"
}
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.
Export Orders Exports a list of orders with optional filters for status and sorting by date.
Example request:
curl --request GET \
--get "farmsell.org/api/v2/admin/order/export-order?status=pending&sort_date=desc" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"farmsell.org/api/v2/admin/order/export-order"
);
const params = {
"status": "pending",
"sort_date": "desc",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
{
"file": "orders.csv"
}
Example response (404):
{
"message": "No orders found to export."
}
Example response (500):
{
"status": "FAILED",
"message": "An error occurred while exporting orders."
}
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.
Product Management
Get All Products
Example request:
curl --request GET \
--get "farmsell.org/api/v2/admin/product/all-product" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"farmsell.org/api/v2/admin/product/all-product"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"message": "Products retrieved successfully",
"data": [
{
"id": 1,
"product_title": "Sample Product",
"status": "Active"
}
]
}
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.
Review Product
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/product/view-product" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"id\": 11
}"
const url = new URL(
"farmsell.org/api/v2/admin/product/view-product"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"id": 11
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"message": "Product reviewed successfully",
"data": {
"id": 11,
"product_title": "Sample Product",
"status": "Reviewed"
}
}
Example response (400):
{
"status": "FAILED",
"message": "Invalid Product ID"
}
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.
Approve a Product This endpoint approves a product by changing its status.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/product/approve-product" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"id\": 3
}"
const url = new URL(
"farmsell.org/api/v2/admin/product/approve-product"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"id": 3
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"message": "Product approved successfully."
}
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.
Bulk Approve Products Approve multiple products in bulk.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/product/bulk-approve" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"product_Ids\": [
1,
2,
3
]
}"
const url = new URL(
"farmsell.org/api/v2/admin/product/bulk-approve"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"product_Ids": [
1,
2,
3
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"message": "Bulk operation completed",
"results": {
"approved": [
1,
2
],
"failed": [
{
"id": 3,
"message": "Invalid status"
}
]
}
}
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.
Reject a Product Rejects a product with a given reason.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/product/reject-product" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"id\": 18,
\"reason\": \"et\"
}"
const url = new URL(
"farmsell.org/api/v2/admin/product/reject-product"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"id": 18,
"reason": "et"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"message": "Product rejected successfully."
}
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.
Bulk reject Products Reject multiple products in bulk.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/product/bulk-reject" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"product_Ids\": [
1,
2,
3
]
}"
const url = new URL(
"farmsell.org/api/v2/admin/product/bulk-reject"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"product_Ids": [
1,
2,
3
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"message": "Bulk operation completed",
"results": {
"rejected": [
1,
2
],
"failed": [
{
"id": 3,
"message": "Invalid status"
}
]
}
}
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 a Product Updates product details.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/product/update-product" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"id\": 14,
\"product_title\": \"repellat\",
\"price\": 687913.761,
\"quantity_available\": 8
}"
const url = new URL(
"farmsell.org/api/v2/admin/product/update-product"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"id": 14,
"product_title": "repellat",
"price": 687913.761,
"quantity_available": 8
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "success",
"edit_product": {
"id": 1,
"product_title": "New Title",
"price": 50,
"quantity_available": 100
}
}
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 Product Analytics Retrieves the count of products in different statuses.
Example request:
curl --request GET \
--get "farmsell.org/api/v2/admin/product/product-analytics" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"farmsell.org/api/v2/admin/product/product-analytics"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"payload": {
"pending_count": 5,
"approved_count": 10,
"rejected_count": 2
}
}
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 api/v2/admin/product/export-products
Example request:
curl --request GET \
--get "farmsell.org/api/v2/admin/product/export-products" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"farmsell.org/api/v2/admin/product/export-products"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (401):
Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 120
x-ratelimit-remaining: 119
{
"error": "Unauthorized"
}
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.
SubCategory Management
Add SubCategories Adds one or more subcategories to a category.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/category/add-subcategory" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"category_id\": 7,
\"sub_categories\": [
\"omnis\"
]
}"
const url = new URL(
"farmsell.org/api/v2/admin/category/add-subcategory"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"category_id": 7,
"sub_categories": [
"omnis"
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"result": true,
"success": "subcategory created successfully"
}
Example response (422):
{
"status": "ERROR",
"errors": {
"category_id": [
"The category id must be a valid integer."
],
"sub_categories.*.name": [
"The subcategory name is required."
]
}
}
Example response (500):
{
"status": "FAILED",
"data": "Error message"
}
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 SubCategories Updates existing subcategories or creates new ones within a category.
Example request:
curl --request POST \
"farmsell.org/api/v2/admin/category/update-subcategory" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"category_id\": 17,
\"sub_categories\": [
\"totam\"
]
}"
const url = new URL(
"farmsell.org/api/v2/admin/category/update-subcategory"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"category_id": 17,
"sub_categories": [
"totam"
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"status": "SUCCESS",
"message": "Subcategories updated successfully."
}
Example response (422):
{
"status": "ERROR",
"errors": {
"category_id": [
"The category id must be a valid integer."
],
"sub_categories.*.sub_id": [
"The subcategory id is required."
],
"sub_categories.*.name": [
"The subcategory name is required."
]
}
}
Example response (500):
{
"status": "FAILED",
"error": "Error message"
}
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.