This document outlines the procedure for making API calls to set supplier data through https://easycms.fi/public_api/set_supplier/. Utilize various parameters to customize your data insertion.
Setter API calls are limited and not available for public API calls, these calls are only available for resellers or certain software providers and developers upon request.
Insert supplier data effectively using the below API call. Apply the required parameters in the request payload to insert supplier information.
To update an existing supplier, you should include the supplier_id parameter in the payload with the value set to the unique identifier of the supplier you want to update. The supplier_id parameter tells the API which supplier to modify based on its identifier. If the supplier_id matches an existing supplier in the system, the API will update the supplier's information with the new data provided in the payload.
For example:
{
"supplier_id": "EXISTING_SUPPLIER_ID", // Specify the existing supplier's ID to update it
// Other supplier data parameters that are intended to be updated...
}
https://easycms.fi/public_api/set_supplier/The following parameters are required for inserting supplier data:
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.Required field for creation:
name: The supplier company name (string).Optional fields:
firstname (string): Supplier contact first name.lastname (string): Supplier contact last name.email (string): Supplier email address.phone (string): Supplier primary phone number.phone2 (string): Supplier secondary phone number.fax (string): Supplier fax number.address (string): Supplier street address.address2 (string): Supplier street address line 2.postal (string): Supplier postal code.city_id (int): City identifier.region (string): Supplier region/state.country_id (int): Country identifier.taxid (string): Supplier tax ID.vatid (string): Supplier VAT ID.notes (string): Additional notes.maxdebt (float, default 0): Maximum allowed debt.visible (int, default 1): Visibility flag.parent_id (int, default 0): Parent supplier ID.language (string): Supplier language code.language_id (int): Supplier language ID.Auto-generated fields:
supplier_id: Auto-increment unique identifier.supplierNumber: Automatically set to MAX+1 of existing suppliers.Protected fields (cannot update): supplier_id, crsupplier_id, curdebt, curdate.
Here's an example payload:
{
"TOKEN": "YOUR_API_KEY",
"username": "YOUR_USERNAME",
"password": "YOUR_PASSWORD",
"account": "YOUR_ACCOUNT_ID",
"name": "Acme Supplies Ltd",
"firstname": "John",
"lastname": "Doe",
"email": "[email protected]",
"phone": "+358401234567",
"address": "123 Industrial Park",
"postal": "00100",
"city_id": 1,
"region": "Uusimaa",
"country_id": 1,
"taxid": "FI12345678",
"vatid": "FI12345678",
"notes": "Preferred supplier for raw materials",
"maxdebt": 10000.00,
"visible": 1,
"parent_id": 0,
"language": "fi",
"language_id": 1
}
curl -X POST 'https://easycms.fi/public_api/set_supplier' \
-H 'Authorization1: TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"username": "USERNAME",
"password": "PASSWORD",
"account": "ACCOUNT_ID",
"name": "Acme Supplies Ltd",
"email": "[email protected]",
"phone": "+358401234567"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://easycms.fi/public_api/set_supplier",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
'username' => 'USERNAME',
'password' => 'PASSWORD',
'account' => 'ACCOUNT_ID',
'name' => 'Acme Supplies Ltd',
'email' => '[email protected]',
'phone' => '+358401234567'
]),
CURLOPT_HTTPHEADER => array(
"Authorization1: TOKEN",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
import json
url = "https://easycms.fi/public_api/set_supplier"
headers = {"Authorization1": "TOKEN", "Content-Type": "application/json"}
payload = {
'username': 'USERNAME',
'password': 'PASSWORD',
'account': 'ACCOUNT_ID',
'name': 'Acme Supplies Ltd',
'email': '[email protected]',
'phone': '+358401234567'
}
response = requests.post(url, headers=headers, json=payload)
print(response.text)
HttpClient client = HttpClient.newHttpClient();
String jsonBody = "{\"username\":\"USERNAME\",\"password\":\"PASSWORD\",\"account\":\"ACCOUNT_ID\",\"name\":\"Acme Supplies Ltd\",\"email\":\"[email protected]\",\"phone\":\"+358401234567\"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://easycms.fi/public_api/set_supplier"))
.headers("Authorization1", "TOKEN", "Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonBody))
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
const https = require('https');
const data = JSON.stringify({
username: 'USERNAME',
password: 'PASSWORD',
account: 'ACCOUNT_ID',
name: 'Acme Supplies Ltd',
email: '[email protected]',
phone: '+358401234567'
});
const options = {
hostname: 'easycms.fi',
path: '/public_api/set_supplier',
method: 'POST',
headers: {
'Authorization1': 'TOKEN',
'Content-Type': 'application/json',
'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/set_supplier', {
method: 'POST',
headers: {'Authorization1': 'TOKEN', 'Content-Type': 'application/json'},
body: JSON.stringify({
username: 'USERNAME',
password: 'PASSWORD',
account: 'ACCOUNT_ID',
name: 'Acme Supplies Ltd',
email: '[email protected]',
phone: '+358401234567'
})
});
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.MediaType.Companion.toMediaType
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.Request
fun main() {
val client = OkHttpClient()
val json = """{"username":"USERNAME","password":"PASSWORD","account":"ACCOUNT_ID","name":"Acme Supplies Ltd","email":"[email protected]","phone":"+358401234567"}"""
val body = json.toRequestBody("application/json".toMediaType())
val request = Request.Builder()
.url("https://easycms.fi/public_api/set_supplier")
.post(body)
.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.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var token = "TOKEN";
var jsonPayload = "{\"username\":\"USERNAME\",\"password\":\"PASSWORD\",\"account\":\"ACCOUNT_ID\",\"name\":\"Acme Supplies Ltd\",\"email\":\"[email protected]\",\"phone\":\"+358401234567\"}";
var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json");
using (var httpClient = new HttpClient())
{
httpClient.DefaultRequestHeaders.Add("Authorization1", token);
var response = await httpClient.PostAsync("https://easycms.fi/public_api/set_supplier", 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:
- `status`: Response status - Indicates the result status ("success" or "error").
- `message`: Response message - A human-readable description of the result.
- `data`: Response data object containing the created/updated supplier details.
- `supplier_id`: Supplier ID - The unique auto-increment identifier for the supplier.
- `supplierNumber`: Supplier Number - Auto-generated number (MAX+1).
- `name`: Supplier company name.
- `firstname`: Supplier contact first name.
- `lastname`: Supplier contact last name.
- `email`: Supplier email address.
- `phone`: Supplier primary phone number.
- `phone2`: Supplier secondary phone number.
- `fax`: Supplier fax number.
- `address`: Supplier street address.
- `address2`: Supplier street address line 2.
- `postal`: Supplier postal code.
- `city_id`: City identifier.
- `region`: Supplier region/state.
- `country_id`: Country identifier.
- `taxid`: Supplier tax ID.
- `vatid`: Supplier VAT ID.
- `notes`: Additional notes.
- `maxdebt`: Maximum allowed debt.
- `visible`: Visibility flag (1 = visible, 0 = hidden).
- `parent_id`: Parent supplier ID.
- `language`: Supplier language code.
- `language_id`: Supplier language ID.
- `crsupplier_id`: Created supplier ID (internal).
- `curdebt`: Current debt amount.
- `curdate`: Current date.
- `changes`: List of fields that were modified during an update operation.
These key-value pairs provide comprehensive information about the suppliers and can be used for various purposes in your application.
{
"OUTPUT": {
"status": "success",
"message": "Supplier created successfully",
"data": {
"supplier_id": "12",
"supplierNumber": "12",
"name": "Acme Supplies Ltd",
"firstname": "John",
"lastname": "Doe",
"email": "[email protected]",
"phone": "+358401234567",
"phone2": "",
"fax": "",
"address": "123 Industrial Park",
"address2": "",
"postal": "00100",
"city_id": "1",
"region": "Uusimaa",
"country_id": "1",
"taxid": "FI12345678",
"vatid": "FI12345678",
"notes": "Preferred supplier for raw materials",
"maxdebt": "10000.00",
"visible": "1",
"parent_id": "0",
"language": "fi",
"language_id": "1",
"crsupplier_id": "0",
"curdebt": "0.00",
"curdate": "2026-04-13"
},
"changes": []
}
}
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.Supplier name is required: The required name field was not provided for creation.Supplier not found: The supplier_id provided does not match any existing supplier.Maximum query size is 1 rows per query: Exceeded maximum limit of 1 rows per query.