Customers | Get Customers

Getting Customers Data

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

Currency Data Retrieval

Fetch city data effectively using the below API call. Apply the IN or NOT_IN parameters as an array or a single integer to filter results according to your specific needs.

Endpoint and Method

  • Endpoint: https://easycms.fi/public_api/get_customers/
  • 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 products at a time.
  • Parameters:
    • start - Specify the starting point of the row from which to begin fetching products.
    • limit - Control the number of products returned in a single request. The maximum limit is 50, but you can opt for a smaller number based on your needs.


Filters

IN / NOT_IN Filter

  • Endpoint: /get_customers
  • Description: Use this endpoint to filter customers based on specific Customer IDs. It supports both inclusion (IN) and exclusion (NOT_IN) filters for Customer IDs.
  • Parameters:
    • IN - Specify the Customer IDs to find specific customers.
    • NOT_IN - Specify the Customer IDs to find all customers excluded these IDs.
    • You can use these parameters as arrays or single integers for more flexibility.

Filter By `email`

  • Endpoint: /get_customers
  • Description: Use this filter using this endpoint to filter customers based on specific Customers filtered by email adderss.
  • Parameters:
    • email - Specify the email address to find specific customer.

Filter By `customer_id`

  • Endpoint: /get_customers
  • Description: Use this filter using this endpoint to filter customers based on specific Customers filtered by customer_id.
  • Parameters:
    • customer_id - [integer] Specify the Customer ID to find specific customer.
    • You can use these parameters as arrays or single integers for more flexibility.



Call Examples in Different Languages


curl -X POST 'https://easycms.fi/public_api/get_customers' \
-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_customers",
  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_customers"
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_customers"))
    .headers("Authorization1", "TOKEN")
    .POST(HttpRequest.BodyPublishers.ofString("username=USERNAME&password=PASSWORD&account=ACCOUNT_ID"))
    .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'
}).toString();
const options = {
  hostname: 'prolasku.fi',
  path: '/public_api/get_customers',
  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 [categoryData, setCategoryData] = useState('');
  useEffect(() => {
    const fetchData = async () => {
      try {
        const response = await fetch('https://easycms.fi/public_api/get_customers', {
          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();
        setCategoryData(data);
      } catch (error) {
        console.error(error);
      }
    };
    fetchData();
  }, []);
  return (
{categoryData}
); } 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_customers")
        .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")
        });
        using (var httpClient = new HttpClient())
        {
            httpClient.DefaultRequestHeaders.Add("Authorization1", token);
            var response = await httpClient.PostAsync("https://easycms.fi/public_api/get_customers", 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:


# Customer Data API Response Output Object Breakdown

This document details the breakdown of the customer data output object received from the API server. Each field in the JSON response is explained for a comprehensive understanding.

## Fields Overview

The response object includes various fields that provide detailed information about a customer. Here are the descriptions of each field:

### `customer_id`
- **Type:** String
- **Description:** Unique identifier for the customer.
- **Example:** `"361"`

### `parent_id`
- **Type:** Integer
- **Description:** Identifier for the parent entity of the customer, if applicable. Zero often indicates no parent entity.
- **Example:** `0`

### `number`
- **Type:** Integer
- **Description:** A numerical identifier or code for the customer. Often used for internal purposes.
- **Example:** `0`

### `visible`
- **Type:** String
- **Description:** Indicates if the customer is visible in the system. "1" for visible, "0" for not visible.
- **Example:** `"1"`

### `language`
- **Type:** String
- **Description:** Preferred language of the customer, represented by a language code.
- **Example:** `"en_gb"`

### `language_id`
- **Type:** String
- **Description:** Identifier for the customer's preferred language.
- **Example:** `"2"`

### `firstname`
- **Type:** String
- **Description:** Full name of the customer. It has been adapted to include the full name instead of the traditional first name.
- **Example:** `"Full name"`

### `lastname`
- **Type:** String
- **Description:** Trade name of the customer. This field has evolved to represent the customer's trade name.
- **Example:** `"Trade name"`

### `phone_prefix`
- **Type:** String
- **Description:** Country or area code for the primary phone number.
- **Example:** `"358"`

### `phone_full`
- **Type:** String
- **Description:** Full primary phone number including the prefix.
- **Example:** `"0931588830"`

### `phone`
- **Type:** String
- **Description:** Primary phone number without the prefix.
- **Example:** `"0931588830"`

### `phone2_prefix`
- **Type:** String
- **Description:** Country or area code for the secondary phone number.
- **Example:** `"0"`

### `phone2_full`
- **Type:** String
- **Description:** Full secondary phone number including the prefix.
- **Example:** `"0"`

### `phone2`
- **Type:** String
- **Description:** Secondary phone number without the prefix.
- **Example:** `"0"`

### `email`
- **Type:** String
- **Description:** Email address of the customer.
- **Example:** `"customer@mail.com"`

### `password`
- **Type:** String
- **Description:** Encrypted password for the customer's account.
- **Example:** Encrypted string

### `company`
- **Type:** String
- **Description:** Name of the company associated with the customer.
- **Example:** `"Company Oy"`

### `business_id`
- **Type:** String
- **Description:** Business identifier or registration number of the company.
- **Example:** `"1234567-8"`

### `address`
- **Type:** String
- **Description:** Primary address of the customer.
- **Example:** `"Tataritsu 26"`

### `address2`
- **Type:** String
- **Description:** Secondary address of the customer.
- **Example:** `"0"`

### `city_id`
- **Type:** String
- **Description:** Identifier for the city associated with the primary address.
- **Example:** `"1"`

### `postal`
- **Type:** String
- **Description:** Postal or ZIP code for the primary address.
- **Example:** `"00510"`

### `state`
- **Type:** Boolean/String
- **Description:** State or region for the primary address. Returns `false` if not applicable.
- **Example:** `false`

### `country_id`
- **Type:** String
- **Description:** Identifier for the country of the primary address.
- **Example:** `"40"`

### `different_shipping_address`
- **Type:** String
- **Description:** Indicates if the shipping address is different from the primary address. "1" for yes, "0" for no.
- **Example:** `"1"`

### `shipping_address`
- **Type:** String
- **Description:** Shipping address, if different from the primary address.
- **Example:** `"Tataritsu 26"`

### `shipping_postal`
- **Type:** String
- **Description:** Postal or ZIP code for the shipping address.
- **Example:** `"00510"`

### `shipping_city_id`
- **Type:** String
- **Description:** Identifier for the city of the shipping address.
- **Example:** `"1"`

### `shipping_country_id`
- **Type:** String
- **Description:** Identifier for the country of the shipping address.
- **Example:** `"40"`

### `shipping_state`
- **Type:** String
- **Description:** State or region for the shipping address.
- **Example:** `"0"`

### `delivery_contact_person`
- **Type:** String
- **Description:** Name of the contact person for delivery purposes.
- **Example:** `"Delivery person's name"`

### `phone3_prefix`
- **Type:** String
- **Description:** Country or area code for an alternative phone number.
- **Example:** `"358"`

### `phone3`
- **Type:** String
- **Description:** Alternative phone number without the prefix.
- **Example:** `"0"`

### `phone3_full`
- **Type:** String
- **Description:** Full alternative phone number including the prefix.
- **Example:** `"0"`

### `ordering_email`
- **Type:** String
- **Description:** Email address for ordering purposes.
- **Example:** `"ordering@mail.com"`

### `ordering_phone_prefix`
- **Type:** String
- **Description:** Country or area code for the ordering phone number.
- **Example:** `"0"`

### `ordering_phone`
- **Type:** String
- **Description:** Ordering phone number without the prefix.
- **Example:** `"0931588830"`

### `ordering_phone_full`
- **Type:** String
- **Description:** Full ordering phone number including the prefix.
- **Example:** `"0931588830"`

### `billing_email`
- **Type:** String
- **Description:** Email address for billing purposes.
- **Example:** `"billing@mail.com"`

### `billing_phone_prefix`
- **Type:** String
- **Description:** Country or area code for the billing phone number.
- **Example:** `"0"`

### `billing_phone`
- **Type:** String
- **Description:** Billing phone number without the prefix.
- **Example:** `"0931588830"`

### `billing_phone_full`
- **Type:** String
- **Description:** Full billing phone number including the prefix.
- **Example:** `"0931588830"`

### `newsletter`
- **Type:** Integer
- **Description:** Indicates if the customer is subscribed to newsletters. "1" for subscribed, "0" for not subscribed.
- **Example:** `0`

### `agreement`
- **Type:** String
- **Description:** Indicates if the customer has agreed to terms, conditions, or agreements. "1" for agreed, "0" for not agreed.
- **Example:** `"0"`

### `login_ip`
- **Type:** Array
- **Description:** List of IP addresses used by the customer for login. Empty if not available.
- **Example:** `[]`

### `vouchers_used`
- **Type:** Array
- **Description:** List of voucher codes used by the customer. Empty if not available.
- **Example:** `[]`

### `registration_date`
- **Type:** String
- **Description:** Date and time when the customer registered.
- **Example:** `"2024-01-01 12:14:22"`

### `maxdebt`
- **Type:** Integer
- **Description:** Maximum debt limit for the customer. "0" often indicates no limit or not applicable.
- **Example:** `0`

### `fax`
- **Type:** String
- **Description:** Fax number of the customer. "0" often indicates no fax number.
- **Example:** `"0"`

### `notes`
- **Type:** String
- **Description:** Notes or comments about the customer.
- **Example:** `"WooCommerce website signup"`

### `curdebt`
- **Type:** Integer
- **Description:** Current debt amount of the customer, if applicable. "0" often indicates no debt.
- **Example:** `0`

### `isvip`
- **Type:** Integer
- **Description:** Indicates if the customer is classified as a VIP. "1" for yes, "0" for no.
- **Example:** `0`

### `discount`
- **Type:** Integer
- **Description:** Discount rate (in percentage) applicable to the customer.
- **Example:** `30`

### `payment_period`
- **Type:** Integer
- **Description:** Payment period term for the customer, typically expressed in days.
- **Example:** `"14"`

### `available_payment_methods`
- **Type:** Array
- **Description:** List of available payment methods for the customer. "0" can indicate default or unspecified method.
- **Example:** `["0"]`
- **List of available Payment Methods** You can fetch a list of available payment methods available using end point [/get_payment_methods](get_payment_methods.php).

### `note`
- **Type:** String
- **Description:** Additional note regarding the customer.
- **Example:** `"WooCommerce website signup"`

### `website`
- **Type:** String
- **Description:** Website associated with the customer or their company.
- **Example:** `"www.customerdomain.tld"`

### `identifier`
- **Type:** String
- **Description:** An e-invoice unique identifier for the customer, often used for internal invoicing. "" can indicate a default or unspecified value.
- **Example:** `"0"`

### `intermediator`
- **Type:** String
- **Description:** An e-invoice intermediator or agent involved with the customer's e-invoicing. "" can signify no intermediator.
- **Example:** `"0"`

### `crcustomer_id`
- **Type:** String
- **Description:** A unique customer relationship identifier, possibly used for linking with external systems such as cashregisters.
- **Example:** `"b9c61156-0156-443b-9b33-c958f876faab"`

### `image`
- **Type:** String
- **Description:** Link or reference to the customer's image. "null" indicates no image is associated.
- **Example:** `"null"`

### `firebase_token`
- **Type:** String
- **Description:** Firebase token associated with the customer's mobile app notifications, typically for push notifications or authentication purposes.
- **Example:** `"0"`

    

{
    "INFO": {
        "start": 0,
        "limit": 50,
        "count": 1,
        "total_count": "1",
        "tip": "You may pass the table's main column identifier ex: city_id for tbl_cities, pid for tbl_products, cid for tbl_categories etc... to make a request for a single specific id from your query. EXAMPLE PARAM: city_id = 2 when sending the request for \"get_cities\" ",
        "WHERE": "email = (daniel%40swh.fi)"
    },
    "OUTPUT": {
        "0": {
            "customer_id": "361",
            "parent_id": 0,
            "number": 0,
            "visible": "1",
            "language": "en_gb",
            "language_id": "2",
            "firstname": "Full name",
            "lastname": "Trade name", // this has been changed during time to customer's trade name and firstname parameter is used as fullname
            "phone_prefix": "358",
            "phone_full": "0931588830",
            "phone": "0931588830",
            "phone2_prefix": "0",
            "phone2_full": "0",
            "phone2": "0",
            "email": "customer@mail.com",
            "password": "$6$rounds=10000$easyCMS$sbLcp5XiDUazMLbtUoZtb1rXzl3T6/eMtY4qiG1oT9fnkvrre8AKHpWp9u/bq2Cz5h.5XX2XA/AAz784VunFN.",
            "company": "Company Oy",
            "business_id": "1234567-8",
            "address": "Tataritsu 26",
            "address2": "0",
            "city_id": "1",
            "postal": "00510",
            "state": false,
            "country_id": "40",
            "different_shipping_address": "1",
            "shipping_address": "Tataritsu 26",
            "shipping_postal": "00510",
            "shipping_city_id": "1",
            "shipping_country_id": "40",
            "shipping_state": "0",
            "delivery_contact_person": "Delivery person's name",
            "phone3_prefix": "358",
            "phone3": "0",
            "phone3_full": "0",
            "ordering_email": "ordering@mail.com",
            "ordering_phone_prefix": "0",
            "ordering_phone": "0931588830",
            "ordering_phone_full": "0931588830",
            "billing_email": "billing@mail.com",
            "billing_phone_prefix": "0",
            "billing_phone": "0931588830",
            "billing_phone_full": "0931588830",
            "newsletter": 0,
            "agreement": "0",
            "login_ip": [],
            "vouchers_used": [],
            "registration_date": "2024-01-01 12:14:22",
            "maxdebt": 0,
            "fax": "0",
            "notes": "WooCommerce website signup",
            "curdebt": 0,
            "isvip": 0,
            "discount": 30,
            "payment_period": "14",
            "available_payment_methods": [
                "0"
            ],
            "note": "WooCommerce website signup",
            "website": "www.customerdomain.tld",
            "identifier": "0",
            "intermediator": "0",
            "crcustomer_id": "b9c61156-0156-443b-9b33-c958f876faab",
            "image": "null",
            "firebase_token": "0"
        },
        "response_type": "success",
        "message": "Data returned successfully"
    }
}
    

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.