This document outlines the procedure for making API calls to retrieve receipt data from the https://prolasku.fi/public_api/
. There are two main endpoints: get_receipts
for fetching multiple receipts and get_receipt
for fetching a single receipt.
Fetch receipt data effectively using the below API calls. Utilize various parameters to filter and customize your data retrieval.
https://easycms.fi/public_api/get_receipts/
get_receipts
Each parameter can be used to refine your data retrieval for multiple receipts:
customer_id
: Your unique customer identifier.customer_password
: Your customer account password.email
: Your registered email address.TOKEN (api_key)
: Your unique API key for authentication. How to Create API Credentials.username
: Your login username.password
: Your login password.year
: The year for which you want to retrieve receipts.month
: The month for which you want to retrieve receipts.account
: Your specific account ID.start
- Specify the starting point of the row from which to begin fetching receipts.limit
- Control the number of receipts returned in a single request. The maximum limit is 50.To get details of a single receipt, use the get_receipt
endpoint. This can be particularly useful for fetching detailed information about a specific receipt.
https://easycms.fi/public_api/get_receipt/
get_receipt
customer_id
: Your customer ID.customer_password
: Your account password.email
: Your email address.TOKEN (api_key)
: Your API key.username
: Username.password
: Password.receipt
: The unique ID of the receipt you want to retrieve.return_html
: Set to 1
if you want the receipt data in HTML format. Default is JSON format.Note: For the get_receipt
call, the month
and year
parameters are not necessary. When return_html
is set to 1
, the API will return the receipt in HTML format.
curl -X POST 'https://easycms.fi/public_api/get_receipts' \
-H 'Authorization1: TOKEN' \
-d 'username=USERNAME&password=PASSWORD&account=ACCOUNT_ID&email=customer@mail.com&customer_password=YOUR_CUSTOMER_PASSWORD&year=2024&month=01'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://easycms.fi/public_api/get_receipts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query(['username' => 'USERNAME', 'password' => 'PASSWORD', 'account' => 'ACCOUNT_ID', 'email' => 'customer@mail.com', 'customer_password' => 'YOUR_CUSTOMER_PASSWORD', 'year' => '2024', 'month' => '01']),
CURLOPT_HTTPHEADER => array("Authorization1: TOKEN"),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://easycms.fi/public_api/get_receipts"
headers = {"Authorization1": "TOKEN"}
payload = {'username': 'USERNAME', 'password': 'PASSWORD', 'account': 'ACCOUNT_ID', 'email': 'customer@mail.com', 'customer_password': 'YOUR_CUSTOMER_PASSWORD', 'year': '2024', 'month': '01'}
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_receipts"))
.headers("Authorization1", "TOKEN")
.POST(HttpRequest.BodyPublishers.ofString("username=USERNAME&password=PASSWORD&account=ACCOUNT_ID&email=customer@mail.com&customer_password=YOUR_CUSTOMER_PASSWORD&year=2024&month=01"))
.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',
email: 'customer@mail.com',
customer_password: 'YOUR_CUSTOMER_PASSWORD',
year: '2024',
month: '01'
}).toString();
const options = {
hostname: 'prolasku.fi',
path: '/public_api/get_receipts',
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 [responseText, setResponseText] = useState('');
useEffect(() => {
const fetchData = async () => {
try {
const response = await fetch('https://easycms.fi/public_api/get_receipts', {
method: 'POST',
headers: {'Authorization1': 'TOKEN', 'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({username: 'USERNAME', password: 'PASSWORD', account: 'ACCOUNT_ID', email: 'customer@mail.com', customer_password: 'YOUR_CUSTOMER_PASSWORD', year: '2024', month: '01'}).toString()
});
const data = await response.text();
setResponseText(data);
} catch (error) {
console.error(error);
}
};
fetchData();
}, []);
return ({responseText});
}
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")
.add("email", "customer@mail.com")
.add("customer_password", "YOUR_CUSTOMER_PASSWORD")
.add("year", "2024")
.add("month", "01")
.build()
val request = Request.Builder()
.url("https://easycms.fi/public_api/get_receipts")
.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("email", "customer@mail.com"),
new KeyValuePair("customer_password", "YOUR_CUSTOMER_PASSWORD"),
new KeyValuePair("year", "2024"),
new KeyValuePair("month", "01")
});
using (var httpClient = new HttpClient())
{
httpClient.DefaultRequestHeaders.Add("Authorization1", token);
var response = await httpClient.PostAsync("https://easycms.fi/public_api/get_receipts", content);
if (response.IsSuccessStatusCode)
{
var responseData = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseData);
}
else
{
Console.WriteLine($"Error: {response.StatusCode}");
}
}
}
}
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.