The purpose of this guide is to explain the usage of the Ordering API in a straightforward manner. We will delve into the key usage points of the API along with some illustrative examples.
For more detailed information, the complete API documentation can be found at: https://get.ordering.help/reference/welcome-to-our-ordering-api
What is the Ordering API?
Ordering.co is the best and easiest way to build any kind of Ordering Solution. You can even create your Online Ordering Marketplace; our APIs include all the power of our backend, so you don't need to build one to create amazing Apps or Ordering Solutions.
Like any API, certain functions are defined that can be used to interact with your Ordering project and utilize its resources.
Requirements for using the Ordering API
- Ordering Project ID: The identifier should not contain spaces and must be in lowercase.
- X-API-KEY: This key is used as authentication for requests made to the API. You can obtain it in your dashboard under the Settings/Developers/API Keys section https://support.ordering.co/hc/en-us/articles/4880394944781-API-Keys
- API Request Testing Tool: In this guide, we will use "Postman," but you can use any other similar tool.
- Endpoint URL: In this guide, we will explain how to use the main endpoints.
- Web browser with developer tools, such as Google Chrome
Get Order List
You can obtain the list of orders that belong to your project and apply filters to them
Usage example
Image link: https://d.pr/i/jnphHc
Filters for Orders list
It's possible to retrieve the list of orders using specific filters. This allows for more specific order retrieval. Some of the filters that can be used include:
- Status
- Range date
- Customer email
Get Businesses List
You can obtain the complete list of your businesses from your project. This section of the documentation provides more detailed information about the attributes contained in the business: https://get.ordering.help/reference/business-model
Usage example:
The easiest way to request the list of businesses is through the following endpoint: https://apiv4.ordering.co/v400/<langue_code>/<project_id>/business?mode=dashboard
NOTE: Don't forget to replace "<project_id>" with your project's identifier and <language_code> with “en” or with the code of your language.
Now, you simply need to use the endpoint using the "GET" request type and add your "x-api-key" as the "Authorization" of the request.
When attempting this, you may encounter an error due to the potentially high payload of requested data in JSON format. To address this, parameters should be used.
For example, if we only want to request the "name" value of the business, we can add these parameters to the request. Additionally, we include "page=1&page_size=10" to limit the result per page:
Image link: https://d.pr/i/qkSXD9
The API will return reduced information, including only some minimal data. If you want to add additional data, you just need to include it, for example, the external_id.
Image link: https://d.pr/i/XEpz4F
We can also observe that the same endpoint is used in the dashboard but with additional parameters added. This can be useful for comparing information regarding the usage of certain endpoints:
Imagen link: https://d.pr/i/nEPzWa
Image link: https://d.pr/i/dHUslt
Some parameters compatible with the business endpoint are:
- external_id
- featured
-
enabled
reviews - delivery_price
- delivery_time
- slug
- pickup_time
- Categories: This parameter may increase the request load; we do not recommend using it for this endpoint.
Get Categories and Products from the Store
To get categories and product info, the following endpoint can be used:
To send this request, a "GET" method is used, and it requires using the Authorization with an x-api-key, as you can see in the following image:
Image link: https://d.pr/i/9KfZh1
You can view the products within each category.
Create Orders
To create orders using the API, this currently involves two steps:
1. First, create the cart or add the products.
2. Second, Place or complete the cart.
Please see the following steps as an example to achieve this:
1. In Postman, when the request is sent, the response returns a cart identifier (UUID), which should be used in step 2: https://d.pr/i/NynuCo
-
Endpoint: https://apiv4.ordering.co/v400/en/demosv5/carts/add_product
- Example payload: https://d.pr/f/UWdNHB
- Example video: https://d.pr/v/xhHVvM
2. Use the cart identifier to send the request and complete the order: https://d.pr/i/eed6tf
-
Endpoint (It changes according to the cart's UUID): https://apiv4.ordering.co/v400/en/demosv5/carts/acd3d0ea-2ee6-4e92-bf5d-423eb3061d35/place
- Example payload: https://d.pr/f/SkrP0t
- Example video: https://d.pr/v/dXTrGl
Update products
-
Updating pricing
To update prices, the following endpoint can be used:
This will directly update the product price. It is necessary to know the business ID, category, and product.
Body - Payload
{"price":{{price}}}
Example
In this example, the price was updated to “17”
Image link: https://d.pr/i/mPpbTs
Updating quantities
The following endpoint can be used to update product quantities:
This will directly update the product quantity. It is necessary to know the business ID, category, and product.
Body - Payload
{"quantity":{{quantity}}}
Example
Image link: https://d.pr/i/y82Esd
In this example, the price was updated to “25”
NOTE: To use the product inventory, the "inventoried" attribute must be enabled.
{"inventoried":true}
Ordering always involves thinking about what you need most.
As Always, Happy Ordering.
www.ordering.co
Comments
0 comments
Please sign in to leave a comment.