Suppliers | Get Suppliers

Getting Supplier Data

This document outlines the procedure for making API calls to retrieve supplier data from https://easycms.fi/public_api/get_suppliers/. Utilize various parameters to filter and customize your data retrieval.

Suppliers Data Retrieval

Fetch supplier data effectively using the below API call. Use optional parameters to filter results according to your specific needs.

Endpoint and Method

  • Endpoint: https://easycms.fi/public_api/get_suppliers/
  • Method: POST

Parameters | Payload

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.

  • Pagination: To manage data effectively, this endpoint supports fetching up to 50 suppliers at a time.

  • Parameters:

    • start - Specify the starting point (offset) of the row from which to begin fetching suppliers.
    • limit - Control the number of suppliers returned in a single request. The maximum limit is 50, but you can opt for a smaller number based on your needs.

  • Filters:

  • supplier_id - Filter by a specific supplier ID (optional, integer). When provided, pagination parameters (start/limit) are ignored and a single supplier is returned.

  • search - Search keyword (optional, string). Performs a partial (LIKE) match across multiple supplier columns. Supports multi-word queries separated by spaces or + — each word must match at least one column (AND logic between words). Case-insensitive.

    • Searchable columns: name, firstname, lastname, email, phone, phone2, fax, address, address2, postal, region, crsupplier_id, taxid, vatid, notes
  • show_invisible: Set to 1 to include suppliers with visible=0 (hidden) in the response. By default, only visible suppliers (visible=1) are returned.

  • return_image_base64: Set to 1 to include the full base64-encoded image data in the image field. By default (0), the image field returns false and the image column is not fetched from the database for better performance. Use image_url instead for displaying images.



Understanding Supplier Search

The search parameter enables broad keyword matching across all relevant text columns of the supplier record. This is useful for:

  • Quick lookup: Find a supplier by partial name, phone number, or email.
  • Address search: Find suppliers in a specific city, postal code, or region.
  • Business ID search: Look up suppliers by tax ID or VAT ID.
  • Multi-word search: Use spaces to narrow results — e.g., search=Acme+Oy will only return suppliers where one word matches "Acme" AND another matches "Oy" across any searchable columns.

Each word in the search query is matched independently across all searchable columns using OR within a word, and AND between words.



Call Examples in Different Languages


# Get all suppliers (default: first 50, visible only)
curl -X POST 'https://easycms.fi/public_api/get_suppliers' \
-H 'Authorization1: TOKEN' \
-d 'username=USERNAME&password=PASSWORD&account=ACCOUNT_ID'

# Get a specific supplier by ID
curl -X POST 'https://easycms.fi/public_api/get_suppliers' \
-H 'Authorization1: TOKEN' \
-d 'username=USERNAME&password=PASSWORD&account=ACCOUNT_ID&supplier_id=1'

# Search suppliers by keyword (matches name, phone, email, address, etc.)
curl -X POST 'https://easycms.fi/public_api/get_suppliers' \
-H 'Authorization1: TOKEN' \
-d 'username=USERNAME&password=PASSWORD&account=ACCOUNT_ID&search=Acme'

# Search suppliers by multiple keywords (AND logic)
curl -X POST 'https://easycms.fi/public_api/get_suppliers' \
-H 'Authorization1: TOKEN' \
-d 'username=USERNAME&password=PASSWORD&account=ACCOUNT_ID&search=Acme+Oy'

# Get suppliers including hidden ones
curl -X POST 'https://easycms.fi/public_api/get_suppliers' \
-H 'Authorization1: TOKEN' \
-d 'username=USERNAME&password=PASSWORD&account=ACCOUNT_ID&show_invisible=1'

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "https://easycms.fi/public_api/get_suppliers",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_POST => true,
  CURLOPT_POSTFIELDS => http_build_query(['username' => 'USERNAME', 'password' => 'PASSWORD', 'account' => 'ACCOUNT_ID', 'search' => 'Acme']),
  CURLOPT_HTTPHEADER => array("Authorization1: TOKEN"),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

import requests
url = "https://easycms.fi/public_api/get_suppliers"
headers = {"Authorization1": "TOKEN"}
payload = {'username': 'USERNAME', 'password': 'PASSWORD', 'account': 'ACCOUNT_ID', 'search': 'Acme'}
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_suppliers"))
    .headers("Authorization1", "TOKEN")
    .POST(HttpRequest.BodyPublishers.ofString("username=USERNAME&password=PASSWORD&account=ACCOUNT_ID&search=Acme"))
    .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',
  search: 'Acme'
}).toString();
const options = {
  hostname: 'prolasku.fi',
  path: '/public_api/get_suppliers',
  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 [supplierData, setSupplierData] = useState('');
  useEffect(() => {
    const fetchData = async () => {
      try {
        const response = await fetch('https://easycms.fi/public_api/get_suppliers', {
          method: 'POST',
          headers: {'Authorization1': 'TOKEN', 'Content-Type': 'application/x-www-form-urlencoded'},
          body: new URLSearchParams({username: 'USERNAME', password: 'PASSWORD', account: 'ACCOUNT_ID', search: 'Acme'}).toString()
        });
        const data = await response.text();
        setSupplierData(data);
      } catch (error) {
        console.error(error);
      }
    };
    fetchData();
  }, []);
  return (<div>{supplierData}</div>);
}
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("search", "Acme")
        .build()

    val request = Request.Builder()
        .url("https://easycms.fi/public_api/get_suppliers")
        .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("search", "Acme")
        });
        using (var httpClient = new HttpClient())
        {
            httpClient.DefaultRequestHeaders.Add("Authorization1", token);
            var response = await httpClient.PostAsync("https://easycms.fi/public_api/get_suppliers", content);
            if (response.IsSuccessStatusCode)
            {
                var responseData = await response.Content.ReadAsStringAsync();
                Console.WriteLine(responseData);
            }
            else
            {
                Console.WriteLine($"Error: {response.StatusCode}");
            }
        }
    }
}




Handling Endpoint Results

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:


- `supplier_id`: Supplier ID - Unique identifier for the supplier (auto-increment).
- `crsupplier_id`: Cash register supplier ID - External supplier reference code.
- `taxid`: Tax ID - The supplier's tax identification number.
- `name`: Supplier Name - The name of the supplier.
- `image_name`: Image Filename - The filename of the uploaded supplier image. Returns `false` if no image is uploaded.
- `image`: Image Data - By default returns `false` (the base64 data is **not fetched** for performance). Pass `return_image_base64=1` to get the full base64-encoded image data URI (e.g. `data:image/jpeg;base64,...`). Returns `false` if no image is uploaded.
- `image_url`: Image URL - The full URL to the supplier image file on the server (e.g. `https://example.com/uploads/supplier/logo_123456-2026-04-14.jpg`). Returns an empty string if no image is uploaded. Use this for displaying images directly without embedding base64 data.
- `maxdebt`: Maximum Debt - The maximum allowed debt for this supplier (double).
- `address`: Primary address of the supplier.
- `address2`: Secondary address line (optional).
- `postal`: Postal/ZIP code.
- `city_id`: City ID reference (links to cities table).
- `region`: Region/State.
- `country_id`: Country ID reference (links to countries table).
- `firstname`: Contact person's first name.
- `lastname`: Contact person's last name.
- `email`: Supplier email address.
- `phone`: Primary phone number.
- `phone2`: Secondary phone number.
- `fax`: Fax number.
- `notes`: Additional notes about the supplier.
- `visible`: Visibility flag - `1` = visible (default), `0` = hidden.
- `supplierNumber`: Supplier number - External reference number.
- `parent_id`: Parent supplier ID for hierarchical supplier grouping (0 = top-level).
- `curdate`: Creation date (datetime).
- `curdebt`: Current debt amount (double).
- `vatid`: VAT identification number.
- `language`: Language code for the supplier.
- `language_id`: Language ID reference.

These key-value pairs provide comprehensive information about the suppliers and can be used for various purposes in your application.
    


{
    "INFO": {
        "start": 0,
        "limit": 50,
        "count": 2,
        "total_count": "2"
    },
    "OUTPUT": {
        "0": {
            "supplier_id": "1",
            "crsupplier_id": null,
            "taxid": "FI12345678",
            "name": "Acme Supplies Oy",
            "image_name": null,
            "image": null,
            "image_url": "",
            "maxdebt": "10000",
            "address": "123 Industrial Road",
            "address2": null,
            "postal": "00100",
            "city_id": "1",
            "region": "Uusimaa",
            "country_id": "73",
            "firstname": "John",
            "lastname": "Doe",
            "email": "[email protected]",
            "phone": "+358401234567",
            "phone2": null,
            "fax": null,
            "notes": null,
            "visible": "1",
            "supplierNumber": "1001",
            "parent_id": "0",
            "curdate": "2024-01-15 10:30:00",
            "curdebt": "0",
            "vatid": "FI12345678",
            "language": null,
            "language_id": "2"
        },
        "1": {
            "supplier_id": "2",
            "crsupplier_id": null,
            "taxid": null,
            "name": "Global Parts Ltd",
            "image_name": null,
            "image": null,
            "image_url": "",
            "maxdebt": "0",
            "address": "456 Commerce Blvd",
            "address2": null,
            "postal": "20100",
            "city_id": "3",
            "region": null,
            "country_id": "73",
            "firstname": null,
            "lastname": null,
            "email": "[email protected]",
            "phone": "+358509876543",
            "phone2": null,
            "fax": null,
            "notes": null,
            "visible": "1",
            "supplierNumber": "1002",
            "parent_id": "0",
            "curdate": "2024-03-20 14:00:00",
            "curdebt": "0",
            "vatid": null,
            "language": null,
            "language_id": "2"
        }
    }
}
    

Image Data and Performance

By default, the image field returns false because the base64 image data is not fetched from the database — this significantly reduces response size and improves performance. Use image_url to display supplier images instead.

Default response (return_image_base64 not set or =0):

"image_name": null,
"image": false,
"image_url": ""

With base64 data (pass return_image_base64=1):

"image_name": "logo-2026-04-14-140555839.jpg",
"image": "data:image/jpeg;base64,/9j/4AAQ...",
"image_url": "https://example.com/uploads/supplier/logo-2026-04-14-140555839.jpg"

Error Handling

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.