This document outlines the procedure for making API calls to retrieve product data from https://easycms.fi/public_api/get_products/
. Utilize various parameters to filter and customize your data retrieval.
Fetch product data effectively using the below API call. Apply different parameters to filter results according to your specific needs.
https://easycms.fi/public_api/get_products/
Each parameter can be used individually or in combination to refine your data retrieval:
TOKEN (api_key)
: Your unique API key for authentication. How to Create API Credentials.username
: Your login username. password
: Your login password. account
: Your specific account ID. start
- Specify the starting point of the row from which to begin fetching products.limit
- Control the number of products returned in a single request. The maximum limit is 50, but you can opt for a smaller number based on your needs.
To manage data effectively, this endpoint supports fetching up to 50 products at a time. Each filter parameter is optional and designed to refine your search for products.
pid
: To filter by a single product ID. The value needs to be an integer.cid
: To filter products by category ID. The value needs to be an integer. Filter By Category ID Documentation.bid
: To filter products by brand ID. The value needs to be an integer. Filter By Brand ID Documentation.IN[]
: For filtering by multiple product IDs. The values need to be an array of integers (pids). Filter By Product IDs Documentation.NOT_IN[]
: To exclude products with specific IDs. The values need to be an array of integers (pids).location_id
: To filter by location ID. Filter By Location ID Documentation.product_name
: To filter by product name. Filter By Product Name Documentation.cid[]
: For filtering by multiple category IDs. The values need to be an array of integers (cids). Filter By Multiple Category IDs Array Documentation.bid[]
: For filtering by multiple brand IDs. The values need to be an array of integers (bids). Filter By Multiple Brand IDs Array Documentation.only_return_discounted_items
: To filter only discounted items. The value needs to be boolean. Filter By Discounted Items Documentation.min_price
: To filter products by minimum price. The value needs to be a double value with 2 decimal numbers, representing the gross value (price including VAT).max_price
: To filter products by maximum price. The value needs to be a double value with 2 decimal numbers, representing the gross value (price including VAT).
curl -X POST 'https://easycms.fi/public_api/get_products' \
-H 'Authorization1: TOKEN' \
-d 'username=USERNAME&password=PASSWORD&account=ACCOUNT_ID'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://easycms.fi/public_api/get_products",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query(['username' => 'USERNAME', 'password' => 'PASSWORD', 'account' => 'ACCOUNT_ID']),
CURLOPT_HTTPHEADER => array("Authorization1: TOKEN"),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://easycms.fi/public_api/get_products"
headers = {"Authorization1": "TOKEN"}
payload = {'username': 'USERNAME', 'password': 'PASSWORD', 'account': 'ACCOUNT_ID'}
response = requests.post(url, headers=headers, data=payload)
print(response.text)
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://easycms.fi/public_api/get_products"))
.headers("Authorization1", "TOKEN")
.POST(HttpRequest.BodyPublishers.ofString("username=USERNAME&password=PASSWORD&account=ACCOUNT_ID"))
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
const https = require('https');
const data = new URLSearchParams({
username: 'USERNAME',
password: 'PASSWORD',
account: 'ACCOUNT_ID'
}).toString();
const options = {
hostname: 'prolasku.fi',
path: '/public_api/get_products',
method: 'POST',
headers: {
'Authorization1': 'TOKEN',
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': data.length
}
};
const req = https.request(options, (res) => {
let data = '';
res.on('data', (chunk) => { data += chunk; });
res.on('end', () => { console.log(data); });
});
req.on('error', (e) => { console.error(e); });
req.write(data);
req.end();
import React, { useEffect, useState } from 'react';
function App() {
const [productData, setProductData] = useState('');
useEffect(() => {
const fetchData = async () => {
try {
const response = await fetch('https://easycms.fi/public_api/get_products', {
method: 'POST',
headers: {'Authorization1': 'TOKEN', 'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({username: 'USERNAME', password: 'PASSWORD', account: 'ACCOUNT_ID'}).toString()
});
const data = await response.text();
setProductData(data);
} catch (error) {
console.error(error);
}
};
fetchData();
}, []);
return ({productData});
}
export default App;
// Kotlin example requires using a third-party library like OkHttp for POST requests with a body
// Kotlin Example using OkHttp for POST request
import okhttp3.OkHttpClient
import okhttp3.FormBody
import okhttp3.Request
fun main() {
val client = OkHttpClient()
val formBody = FormBody.Builder()
.add("username", "USERNAME")
.add("password", "PASSWORD")
.add("account", "ACCOUNT_ID")
.build()
val request = Request.Builder()
.url("https://easycms.fi/public_api/get_products")
.post(formBody)
.addHeader("Authorization1", "TOKEN")
.build()
client.newCall(request).execute().use { response ->
if (!response.isSuccessful) throw IOException("Unexpected code $response")
println(response.body?.string())
}
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var token = "TOKEN";
var content = new FormUrlEncodedContent(new[]
{
new KeyValuePair("username", "USERNAME"),
new KeyValuePair("password", "PASSWORD"),
new KeyValuePair("account", "ACCOUNT_ID")
});
using (var httpClient = new HttpClient())
{
httpClient.DefaultRequestHeaders.Add("Authorization1", token);
var response = await httpClient.PostAsync("https://easycms.fi/public_api/get_products", content);
if (response.IsSuccessStatusCode)
{
var responseData = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseData);
}
else
{
Console.WriteLine($"Error: {response.StatusCode}");
}
}
}
}
When you make a request to the endpoint, you receive a JSON response containing various keys and values. Here's an explanation of the response keys and their meanings:
- `start`: This represents the starting index for the data. In this case, it's set to 0, indicating that the data starts from the first item.
- `limit`: The maximum number of items returned in the response. In this example, the limit is set to 50, meaning that the response will include up to 50 items.
- `count`: The number of items included in the current response. In this case, there is 1 item in the response.
- `total_count`: The total count of items available in the dataset. In this response, there is a total of 1 item available.
- `tip`: This is a helpful tip or instruction related to making requests. It suggests that you can use the table's main column identifier (e.g., city_id, pid, cid) to request specific data. It provides an example parameter, `city_id = 2`, when sending a request for 'get_cities'. This tip guides how to refine your queries.
- `WHERE`: This field specifies a condition for filtering the data. In this case, it indicates a condition where "pid" equals "11292". This condition can be used to filter and retrieve specific data based on the "pid" value.
- `min_price` and `max_price`: These fields represent the minimum and maximum price range for the products. In this response, both are set to 0 and 500000, respectively, indicating the price range within which the products fall.
- `pid`: Product ID - This is a unique identifier for the product.
- `barcode`: Product Barcode - This represents the product's barcode or Stock Keeping Unit (SKU).
- `product_desc`: Array of Product Descriptions - This object contains product descriptions in various languages, such as Finnish (`fi`), English (`en_gb`), Swedish (`sv`), Thai (`th`), Spanish (`es`), Chinese (`zh`), Vietnamese (`vi`), and Persian (`fa_ir`).
- `fi`: Description in Finnish.
- `en_gb`: Description in English (Great Britain).
- `sv`: Description in Swedish.
- `th`: Description in Thai.
- `es`: Description in Spanish.
- `zh`: Description in Chinese.
- `vi`: Description in Vietnamese.
- `fa_ir`: Description in Persian (Iran).
- `price_gross`: Gross Price - The product's gross price before any discounts or taxes.
- `price_net_after_discount`: Price Net After Discount - The product's price after applying any discounts.
- `price_gross_after_discount`: Gross Price After Discount - The product's gross price after applying any discounts.
- `crp_id`: ID for the product.
- `cid`: Category ID - This represents the category to which the product belongs.
- `prd_start_display`: Start date for displaying the product.
- `prd_end_display`: End date for displaying the product.
- `bid`: Bid ID for the product.
- `price`: Price of the product.
- `price_buy`: Buy Price - The price at which the product was bought.
- `min_order`: Minimum order quantity for the product.
- `btn_id`: Button ID.
- `productDelivery`: Array of product delivery information.
- `productDelivery_on_off`: Product delivery status (0 or 1).
- `discount`: Discount applied to the product.
- `vat`: Value Added Tax (VAT) rate.
- `vat_buy`: VAT for buying the product.
- `productDetails`: Array of additional product details.
- `prdStatus`: Product status (1 or 0).
- `prdNumber`: Product number.
- `onsale`: Product on sale status (0 or 1).
- `buy_x`: Buy X.
- `get_x`: Get X.
- `stock_type_id`: Stock type ID.
- `stock_type_measure`: Stock type measure.
- `stock_alert_qty`: Stock alert quantity.
- `stock_alert_bbd`: Stock alert best-before date.
- `supplier_id`: Supplier ID.
- `supplier_reference`: Supplier reference.
- `width`: Width of the product.
- `height`: Height of the product.
- `length`: Length of the product.
- `weight`: Weight of the product.
- `weight_type`: Weight type (e.g., kg).
- `box_qty`: Box quantity.
- `box_code`: Box code status (true or false).
- `pallet_qty`: Pallet quantity.
- `pallet_qty_type`: Pallet quantity type (e.g., box).
- `relation_qty`: Relation quantity.
- `relation_qty_type`: Relation quantity type (e.g., unit).
- `images`: Array of product images.
- `videos`: Array of product videos.
- `update_date`: Date of the last update for the product.
- `deleted`: Deletion status (0 or 1).
These key-value pairs provide comprehensive information about the product and can be used for various purposes in your application.
{
"INFO": {
"start": 0,
"limit": 50,
"count": 1,
"total_count": 1,
"tip": "You may pass the table's main column identifier ex: city_id for tbl_cities, pid for tbl_products, cid for tbl_categories etc... to make a request for a single specific id from your query. EXAMPLE PARAM: city_id = 2 when sending the request for 'get_cities'",
"WHERE": "pid equals11292",
"min_price": 0,
"max_price": 500000
},
"OUTPUT": [
{
"stock_data": [
{
"stock": 9998,
"location_id": 9,
"shelf_id": 65,
"best_before_date": "0000-00-00",
"default_location": 1
}
],
"price_gross": 25.2,
"price_net_after_discount": 22.105,
"price_gross_after_discount": 25.2,
"pid": "11292",
"crp_id": "e33d9175-4351-4281-bb13-5689e2da2ec3",
"cid": "150",
"product_name": {
"fi": "Robert kanan makk. oliiveilla 12x340g",
"en_gb": "Robert kanan makk. oliiveilla 12x340g",
"sv": "Robert kanan makk. oliiveilla 12x340g",
"th": "Robert kanan makk. oliiveilla 12x340g",
"es": "Robert kanan makk. oliiveilla 12x340g",
"zh": "Robert kanan makk. oliiveilla 12x340g",
"vi": "Robert kanan makk. oliiveilla 12x340g",
"fa_ir": "Robert kanan makk. oliiveilla 12x340g"
},
"product_desc": {
"fi": "Untitled",
"en_gb": "Untitled",
"sv": "Untitled",
"th": "Untitled",
"es": "Untitled",
"zh": "Untitled",
"vi": "Untitled"
},
"prd_start_display": "1652043600",
"prd_end_display": "1890511200",
"bid": "1",
"price": 22.105,
"price_buy": 0,
"min_order": 0,
"btn_id": "17",
"productDelivery": [],
"productDelivery_on_off": 0,
"discount": 0,
"vat": "2",
"vat_buy": "2",
"productDetails": [],
"prdStatus": "1",
"prdNumber": "1052793",
"barcode": "010570525500511815240520",
"barcode_id": "6",
"onsale": 0,
"buy_x": 0,
"get_x": 0,
"stock_type_id": "64",
"stock_type_measure": 0,
"stock_alert_qty": "10",
"stock_alert_bbd": "3",
"supplier_id": "24",
"supplier_reference": "0",
"width": 0,
"height": 0,
"length": 0,
"weight": 0,
"weight_type": "kg",
"box_qty": 0,
"box_code": false,
"pallet_qty": 0,
"pallet_qty_type": "box",
"relation_qty": 1,
"relation_qty_type": "unit",
"images": [],
"videos": [],
"update_date": "2023-08-28 03:50:14",
"deleted": 0
}
]
}
Here are the possible error messages and their meanings:
UN-AUTHORIZED - _user_name_password_is_set_but_wrong_value!
: Incorrect username or password.this_account_does_not_exist_or_your_credentials_do_not_match_this_account
: The account doesn't exist or mismatched credentials.UN-AUTHORIZED - header is set but the header value is not correct!
: Incorrect authorization header value.Maximum query size is 50 rows per query
: Exceeded maximum limit of 50 rows per query.