Introduction
Evertreen provides businesses with the ability to plant trees through an API service. After registering on the platform, you will receive an authentication token that you can use to place orders.
Currently, we offer the following API routes:
A free API route to verify the types of trees that can be planted through the API and obtain details about each tree.
A protected API route for placing orders.
A protected API route for receiving information about previously placed orders.
All prices are to be intended in GBP
Base Route
api.evertreen.com/wp-json/data/v1
Products
Free API route that doesn't require authentication
GETapi.evertreen.com/wp-json/data/v1/products
Query Params
Name | Type | Description |
---|---|---|
offset | number | Number of posts to skip from start |
Response
It returns a JSON file with the current products, following the pattern below:
{
"products": [
{
"id": "1",
"name": "Product Name",
"price": "00.00",
"country": "country",
"latitude": "0",
"longitude": "0",
"trees_number": "0",
"co2": "0"
}
],
"totalProducts": 0,
"currentPage": 0,
"totalPages": 0,
"perPage": 0
}
Orders
The API routes for creating and viewing require authentication.
Header
Name | Type | Description |
---|---|---|
Authorization | Bearer Token | Token assigned to your company |
Create Orders
POSTapi.evertreen.com/wp-json/data/v1/orders/create
Body Request
Name | Type | Description |
---|---|---|
identifier | string | Sends an unique random string for single order to be sure it's not a duplicate. One string corresponds to one order. |
products | array[object] | products as array of object that have id_prod (same of in list from GET products route) and qty |
{
"products": [
{"id_prod": 7, "qty": 2},
{"id_prod": 1, "qty": 2}
],
"identifier": "453011" // Be careful to use unique string to avoid duplicate orders
}
Response
{
"orderPublished": {
"id": 48,
"payment_verified": "0",
"identifier": "453011",
"order_date": "2023-02-28 09:00:38",
"products": [
{
"product": "Product 2",
"qty": "2",
"price_qty": "24.00",
"price_single": "12.00",
"country": "Italy",
"latitude": "0",
"longitude": "0",
"trees_number": "2",
"co2": "2.00"
},
{
"product": "Product Test",
"qty": "2",
"price_qty": "21.80",
"price_single": "10.90",
"country": "England",
"latitude": "10.50",
"longitude": "50.40",
"trees_number": "1",
"co2": "1.00"
}
],
"total": "45.80"
}
}
View Orders
GETapi.evertreen.com/wp-json/data/v1/orders/view
Query Params
Name | Type | Description |
---|---|---|
offset | number | Number of posts to skip from start |
dateFrom | yyyy-mm-dd | Retrieve orders from specific data (es. dateFrom=2023-02-10) |
dateTo | yyyy-mm-dd | Use with dateFrom to establish a range to get orders (es. dateFrom=2023-02-01&dateTo=2023-02-10) |
Response
It returns a JSON file with the orders, following the pattern below
{
"Orders":[
{
"id": "1",
"payment_verified": "0",
"identifier": "453011",
"order_date": "2023-02-15 11:14:03",
"products":[
{
"product": "Prodct Name",
"qty": "1",
"price_qty": "0.00",
"price_single": "0.00",
"country": "Italy",
"latitude": "0",
"longitude": "0",
"trees_number": "0",
"co2": "0"
}
]
},
{…}
],
"total": "0.00",
"totalOrders": 2
}