Managing Vendors in Venddor IO
Venddor IO offers an efficient system to oversee and manage vendors in an e-commerce setting. By utilizing a series of API endpoints, administrators can effortlessly list, create, modify, or delete vendors. Let's delve into how this can be done.
Fetching Vendor Lists
To retrieve a comprehensive list of all vendors:
GET /api/vendors/
This returns a detailed list of vendors. The number of vendors displayed can be adjusted through pagination parameters or be dependent on Venddor IO's default settings.
Pagination, Sorting, and Filtering
You can refine the list of vendors using these parameters:
- page: Defines which set of vendors to view, based on pagination.
- items_per_page: Controls the number of vendors displayed on each page.
- sort_by: Dictates the attribute to sort vendors by, e.g., name, email, or status.
- sort_order: Specifies the order, either ascending (asc) or descending (desc).
Filter options include:
- email: Filter vendors by their email address.
- timestamp: Locate vendors based on their creation time.
- status: Refine by vendor status - New, Active, Pending, or Disabled.
- company: Search using the vendor's company name.
Sample Requests:
To view the second page of vendors, two at a time:
GET /api/vendors/?page=2&items_per_page=2
To search for a vendor by their email:
GET /api/vendors/?email=vendor@example.com
Accessing Specific Vendors:
For details about a specific vendor:
GET /api/vendors/<company_id>/
This returns all available data about the chosen vendor.
Vendor Attributes
Each vendor is described using various attributes:
- company_id: A unique identification number.
- lang_code: Language preference (e.g., "en").
- email: Vendor's contact email.
- company: The official name of the vendor.
- ... and many more.
Creating a New Vendor
To introduce a new vendor into the system:
POST /api/vendors/
Ensure to provide necessary details, including the company name, email, and others in the request body.
Updating Vendor Information
To modify details of an existing vendor:
PUT /api/vendors/<company_id>/
Update only the fields you want to change.
Removing a Vendor
To permanently delete a vendor:
DELETE /api/vendors/<company_id>
Responses
- Success: For successful vendor creation, you'll receive HTTP/1.1 201 Created, alongside the ID of the new vendor.
- Modification: Successful updates return HTTP/1.1 200 OK with the vendor's ID.
- Deletion: A successful delete action provides HTTP/1.1 204 No Content.
- Errors: Failures are indicated by responses like HTTP/1.1 400 Bad Request or HTTP/1.1 404 Not Found for non-existing entities.