This document outlines the procedure for making API calls to retrieve stock transfer data from https://easycms.fi/public_api/get_stock_transfers/. Utilize various parameters to filter and customize your data retrieval.
Fetch stock transfer data effectively using the below API call. Apply different parameters to filter results according to your specific needs.
https://easycms.fi/public_api/get_stock_transfers/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 transfers.limit - Control the number of transfers 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, apply these filters to refine your data retrieval. Each filter parameter is optional and designed to help you find specific transfers:
id: To filter by a single transfer ID. The value needs to be an integer. Returns a single transfer.reference: To filter by transfer reference number. The value needs to be an integer. Returns a single transfer.from_location_id: To filter by source location ID. The value needs to be an integer. Returns all transfers originating from this location.to_location_id: To filter by destination location ID. The value needs to be an integer. Returns all transfers going to this location.status: To filter by transfer status. The value needs to be an integer. Available status codes:
1 = Draft100 = Sent110 = Preparing120 = Shipped200 = Received-1 = Cancelleddate_from: To filter transfers from a specific date. The value needs to be in YYYY-MM-DD format.date_to: To filter transfers up to a specific date. The value needs to be in YYYY-MM-DD format.include_lines: To include or exclude transfer line items in the response. The value needs to be an integer:
1 = Include transfer lines (default)0 = Exclude transfer lines (returns only transfer header data)
All filters can be combined in a single API call to narrow down your search results. When multiple filters are used together, they are applied with AND logic, meaning transfers must match all specified criteria.
Here's an example of combining multiple filters in a single request:
# Filter by from_location_id AND status AND date range
curl -X POST 'https://easycms.fi/public_api/get_stock_transfers' \
-H 'Authorization1: TOKEN' \
-d 'username=USERNAME&password=PASSWORD&account=ACCOUNT_ID&from_location_id=1&status=100&date_from=2024-01-01&date_to=2024-12-31'
from_location_id + status=100to_location_id + status=200date_from + date_tofrom_location_id + to_location_id + status=120include_lines=0
curl -X POST 'https://easycms.fi/public_api/get_stock_transfers' \
-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_stock_transfers",
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_stock_transfers"
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_stock_transfers"))
.headers("Authorization1", "TOKEN")
.POST(HttpRequest.BodyPublishers.ofString("username=USERNAME&password=PASSWORD&account=ACCOUNT_ID"))
.build();
HttpResponse<String> 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_stock_transfers',
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 [transferData, setTransferData] = useState('');
useEffect(() => {
const fetchData = async () => {
try {
const response = await fetch('https://easycms.fi/public_api/get_stock_transfers', {
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();
setTransferData(data);
} catch (error) {
console.error(error);
}
};
fetchData();
}, []);
return (<div>{transferData}</div>);
}
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_stock_transfers")
.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<string, string>("username", "USERNAME"),
new KeyValuePair<string, string>("password", "PASSWORD"),
new KeyValuePair<string, string>("account", "ACCOUNT_ID")
});
using (var httpClient = new HttpClient())
{
httpClient.DefaultRequestHeaders.Add("Authorization1", token);
var response = await httpClient.PostAsync("https://easycms.fi/public_api/get_stock_transfers", 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.
- `total_count`: The total count of items available in the dataset.
- `WHERE`: This field specifies the filter conditions applied to the data. It shows which filters were used in the request.
- `id`: Transfer ID - This is a unique identifier for the stock transfer.
- `reference`: Transfer reference number - A reference number for the transfer.
- `from_location_id`: Source Location ID - The ID of the location where the stock is being transferred from.
- `from_location_name`: Source Location Name - The name of the source location.
- `to_location_id`: Destination Location ID - The ID of the location where the stock is being transferred to.
- `to_location_name`: Destination Location Name - The name of the destination location.
- `status`: Transfer status code - Numeric status indicator:
- 1 = Draft
- 100 = Sent
- 110 = Preparing
- 120 = Shipped
- 200 = Received
- -1 = Cancelled
- `status_title`: Transfer status title - Human-readable status text.
- `transfer_date`: Transfer date - The date when the transfer was created/scheduled.
- `delivery_date`: Delivery date - The expected or actual delivery date.
- `total`: Total value - The total value of items in the transfer.
- `discount`: Discount - Any discount applied to the transfer.
- `note`: Note - General notes about the transfer.
- `admin_note`: Admin note - Internal administrative notes.
- `delivery_instructions`: Delivery instructions - Special delivery instructions.
- `title`: Transfer title - A title/name for the transfer.
- `deleted`: Deletion status - 0 or 1 indicating if the transfer is deleted.
- `transfer_lines`: Array of transfer line items (when include_lines=1):
- `transfer_line_id`: Unique identifier for the line item.
- `pid`: Product ID - The product being transferred.
- `product_name`: Product name - The name of the product.
- `product_title`: Product title - Additional product title.
- `quantity`: Quantity - The quantity being transferred.
- `received_quantity`: Received quantity - The quantity actually received.
- `unit_price`: Unit price - Net price per unit.
- `unit_price_buy`: Unit buy price - Purchase price per unit.
- `vat_percent`: VAT percentage for selling.
- `vat_percent_buy`: VAT percentage for buying.
- `discount`: Line discount percentage.
- `best_before_date`: Best before date for the product.
- `barcode`: Product barcode.
- `line_note`: Notes specific to this line item.
- `stock_type_id`: Stock type ID.
- `weight`: Weight of the product.
- `weight_type`: Weight unit (e.g., kg).
- `received_confirmed`: Received Confirmed - `0` = pending confirmation, `1` = confirmed and stock moved. Audit trail is logged via KLogger.
These key-value pairs provide comprehensive information about stock transfers and can be used for various purposes in your application.
{
"INFO": {
"start": 0,
"limit": 50,
"count": 1,
"total_count": 1,
"WHERE": "id = 123"
},
"OUTPUT": [
{
"id": 123,
"reference": 1001,
"from_location_id": 1,
"from_location_name": "Main Warehouse",
"to_location_id": 4,
"to_location_name": "Retail Store",
"status": 200,
"status_title": "transfer_received",
"transfer_date": "2024-03-15 10:30:00",
"delivery_date": "2024-03-16 14:00:00",
"total": 1500.00,
"discount": 0,
"note": "Regular stock replenishment",
"admin_note": "",
"delivery_instructions": "Deliver to loading dock B",
"title": "Weekly Stock Transfer",
"deleted": 0,
"transfer_lines": [
{
"transfer_line_id": "abc123-uuid",
"pid": 1001,
"product_name": "Product A",
"product_title": "",
"quantity": 50,
"received_quantity": 50,
"unit_price": 10.00,
"unit_price_buy": 8.00,
"vat_percent": 24.00,
"vat_percent_buy": 24.00,
"discount": 0,
"best_before_date": "2025-12-31",
"barcode": "6410123456789",
"line_note": "",
"stock_type_id": 1,
"weight": 0.5,
"weight_type": "kg"
},
{
"transfer_line_id": "def456-uuid",
"pid": 1002,
"product_name": "Product B",
"product_title": "",
"quantity": 100,
"received_quantity": 98,
"unit_price": 5.00,
"unit_price_buy": 4.00,
"vat_percent": 14.00,
"vat_percent_buy": 14.00,
"discount": 0,
"best_before_date": "2025-06-30",
"barcode": "6410123456790",
"line_note": "2 items damaged during transport",
"stock_type_id": 1,
"weight": 0.25,
"weight_type": "kg"
}
]
}
]
}
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.id_must_be_a_valid_positive_integer: The id parameter must be a positive integer.reference_must_be_a_valid_positive_integer: The reference parameter must be a positive integer.from_location_id_must_be_a_valid_positive_integer: The from_location_id parameter must be a positive integer.to_location_id_must_be_a_valid_positive_integer: The to_location_id parameter must be a positive integer.status_must_be_a_valid_integer: The status parameter must be a valid status code (1, 100, 110, 120, 200, or -1).invalid_date_format_for_date_from: The date_from parameter must be in YYYY-MM-DD format.invalid_date_format_for_date_to: The date_to parameter must be in YYYY-MM-DD format.stock_transfer_not_found: No transfer found matching the specified id or reference.