Inventory & Products | Products | Product Data | Get Products | Filters | by Price Range

API Guide: Filtering Products by Price Range

This document provides the details for making an API call to retrieve product data filtered by a price range.

Get Products by Price Range

This API call fetches product data filtered by a minimum and/or maximum net price. It can be filtered by setting the min_price and max_price parameters.

Understanding Price Range Filtering

This feature allows you to retrieve products within a specific price bracket. Using the min_price and max_price parameters, you can filter the API response to include only products whose net price falls within the specified range.

  • Default range: 0 to 500000 — if no price parameters are provided, all products within this default range are returned.
  • min_price only: Returns products with a net price greater than or equal to the specified value.
  • max_price only: Returns products with a net price less than or equal to the specified value.
  • Both parameters: Returns products whose net price is between min_price and max_price (inclusive).
  • Values are rounded to the account's decimal precision setting (typically 2 decimals).

How to Use the Price Range Filter

Include the min_price and/or max_price parameter in your API call. The values should be doubles (e.g., 10.00, 99.99).

Use Cases for Price Range Filtering

  • Product Catalog Browsing: Display products within a customer's budget range.
  • Promotional Pages: Show products on sale within a specific price bracket.
  • Category Filtering: Combine with cid to show products in a category within a price range.
  • Mobile App Filters: Implement price slider filters in e-commerce applications.

Combining with Other Filters

The price range filter can be combined with any other filter. For example:

  • min_price + max_price + cid — Products in a category within a price range.
  • min_price + max_price + bid — Products from a brand within a price range.
  • min_price + max_price + product_name — Named products within a price range.

Call Examples in Different Languages, min_price=10.00 and max_price=50.00


curl -X POST 'https://easycms.fi/public_api/get_products' \
-H 'Authorization1: TOKEN' \
-d 'username=USERNAME&password=PASSWORD&account=ACCOUNT_ID&min_price=10.00&max_price=50.00'

$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', 'min_price' => 10.00, 'max_price' => 50.00]),
  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', 'min_price': 10.00, 'max_price': 50.00}
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&min_price=10.00&max_price=50.00"))
    .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',
  min_price: '10.00',
  max_price: '50.00'
}).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', min_price: '10.00', max_price: '50.00'}).toString()
        });
        const data = await response.text();
        setProductData(data);
      } catch (error) {
        console.error(error);
      }
    };
    fetchData();
  }, []);
  return (
{productData}
); } export default App;

// 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")
        .add("min_price", "10.00")
        .add("max_price", "50.00")
        .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"),
            new KeyValuePair("min_price", "10.00"),
            new KeyValuePair("max_price", "50.00")
        });
        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}");
            }
        }
    }
}