Venddor IO offers an extensive API for managing orders on the platform. This is crucial for businesses to seamlessly integrate with their existing systems and ensure smooth operations. Here's a comprehensive guide on how to utilize this feature.
To retrieve a list of orders:
Endpoint: /api/orders/
Method: GET
This retrieves a list of 10 orders by default, with essential details for each.
The API allows you to customize the order data retrieved:
page: Specifies the page number (default is 1).items_per_page: Determines the number of orders per page (default is 10).sort_by: Sets the order sorting parameter (default is by date).sort_order: Establishes the sorting order - ascending (asc) or descending (desc).Additionally, there are specific parameters like status, user_id, company_id, email, and many more, allowing you to filter the results further.
For instance, a GET request to /api/orders/?page=5&items_per_page=5&status=C would fetch five orders from the fifth page that have the status 'C' (complete).
Making a GET request like /api/orders/?items_per_page=2 would result in a JSON response containing details such as order ID, issuer ID, user ID, timestamp, customer details, order status, total price, and more.
You can obtain detailed information about a specific order using its unique order ID:
Endpoint: /api/orders/<order_id>/
Method: GET
A successful request would provide extensive details of the order, from its ID to the products included in it.
Make a POST request to /api/orders/ and provide essential data like user ID, payment method, shipping method, and products in the request body.
This action creates an order with the specified properties.
Similar to the registered user method, but you would need to provide additional user data since there's no associated user ID.
Remember, the order total is always fetched from the platform's settings and not directly from the request.
To make changes to an existing order:
Endpoint: /api/orders/<order_id>/
Method: PUT
You can modify multiple attributes of the order, from products and quantities to customer details. When updating, remember to include all products if you're altering the product data, as any product not specified will be removed from the order.
Additionally, you can alter order status and even notify relevant parties (like the customer or vendor) about status changes via email.
If required, you can remove an order from Venddor IO:
Endpoint: /api/orders/<order_id>/
Method: DELETE
On successful deletion, you'll receive a HTTP/1.1 204 No Content response.
Venddor IO's modular API ensures that businesses can maintain and manage orders efficiently. With a wide range of functionalities, from fetching and updating to creating and deleting, the system ensures smooth integrations and operations for e-commerce platforms.