API: Customers

POST /customer_api/addCreate a new customer using FORM DATA.
PUT /customer_api/customer_noUpdate customer using JSON
GET /customer_api/get/customer_no/customer_noFetch one customer
GET /customer_api/idFetch one customer
GET /customer_api/Fetch all customers

POST /customer_api/add

Create a new customer using FORM DATA.

Request parameters
Name Description Data type Req’d Example
customer_no Customer number string 1234 If empty Fennoa generates it
name Name of the customer string YES Example customer
name2 Name2 of the customer string Example 2 customer
address Address of the customer string YES Busy street 12
postalcode Postal code of the customer string YES 00120
city City of the customer string YES Helsinki
country_id Country of the customer as ISO 3166-1 alpha-2 fromat string YES FI
description Description of the customer string This is a great customer
email Email of the customer string (email) hello@example.com
phone Phone number of the customer string 040123456789
fax Fax number of the customer string +1-212-9876543
website Website of the customer string www.example.com
business_id Business id of the customer string 1234567-8
vat_number VAT number of the customer string FI12345678
identity_number Consumer customer´s ID stiring 010180-123T
account_type_id Type of account int 1=company, 2= consumer
contact_person Contact person string John Doe
einvoice_address Einvoice address (or email address if sales_invoice_delivery_method is email) string 00371234567
or
customer@company.com
einvoice_operator_id Einvoice operator ID or Fennoa´s internal ID string HELSFIHH *
sales_invoice_delivery_method Sales invoice delivery method string email=email
finvoice=eInvoice
postal=postal
consumerfinvoice= consumer eInvoice
consumerdirect= consumer eInvoice, direct
manual= manual delivery
customer_group_ids[] Customer group id. Could be multiple rows. int 1
locale_id Language of the customer and invoice, use ID or ISO 639-1 language code** 1= FI, 2= EN, 4= SV
locale_code Language of the customer and invoice, ISO 639-1 language code** FI, EN, SV
** locale_id is dominate if both are used

* https://tieke.fi/palvelut/liiketoimintapalvelut/verkkolaskuosoitteisto/valittajatunnukset/

Response
Response code Description
200 Ok, adding a customer was successfull
400 Unable to add a customer. Further information can be found from the errors array in response JSON
401 API key / company code is invalid or the user does not have permission to add customers
405 Invalid method, double check you are sending ”POST” and not ”GET” etc
503 Service Unavailable


PUT /customer_api/{customer_no}

Update customer using JSON. Send only updatable info.

Name Description Data type Req’d Example
name Name of the customer string Example customer
address Address of the customer string Busy street 12
postalcode Postal code of the customer string 00120
city City of the customer string Helsinki
country_id Country of the customer as ISO 3166-1 alpha-2 fromat string FI
name2 Name2 of the customer string Example 2 customer
description Description of the customer string This is a great customer
email Email of the customer string (email) hello@example.com
phone Phone number of the customer string 040123456789
fax Fax number of the customer string +1-212-9876543
website Website of the customer string www.example.com
business_id Business id of the customer string 1234567-8
vat_number VAT number of the customer string FI12345678
sales_invoice_delivery_method Sales invoice delivery method string email=email
finvoice=eInvoice
postal= postal
consumerfinvoice= consumer eInvoice
consumerdirect= consumer eInvoice, direct
manual= manual
einvoice_address Customer e-invoice address or email address for invoicing string
einvoice_operator_id e-invoice operator address string OKOYFIHH
customer_group_ids Customer group id. You can add multiple customer group [1,2]
locale_id Language of the customer and invoice, use ID or ISO 639-1 language code** 1= FI, 2= EN, 4= SV
locale_code Language of the customer and invoice, ISO 639-1 language code** FI, EN,SV
** locale_id is dominate if both are used

GET /customer_api/{id}

Fetch one customer. See the response below.

Example:

  • /customer_api/2
Name Description Data type Req’d Example
id Unique identifier of the customer int YES 2

GET /customer_api/get/customer_no/{customer_no}

Fetch one customer. See the response below.

Example:

  • /customer_api/get/customer_no/F123

GET /customer_api/

Fetch all customers. Returns array of customers on format shown below.

Example:

  • /customer_api/

Possible query parameters:

  • modifiedAfter, shows customers that is modified after given date
  • Example: /customer_api/?modifiedAfter=2020-01-01

Response
Response code Description
200 Ok, fetching a customer was successfull
401 API key / company code is invalid or the user does not have permission to get customers
404 Customer not found
405 Invalid method, double check you are sending ”GET” and not ”POST” etc
503 Service Unavailable
Response format of one customer
Name Description Data type Possible values / Examples
id ID of the customer int 2
name Name of the customer string My Customer
name2 Name 2 of the customer string My Customer
contact_person Contact person of the customer string John Doe
customer_no Customer number string F100
owner_user_id ID of the fennoa user that created this customer int 4
address Address of the customer string Busy street 2
postalcode Postal code of the customer string 00120
city City of the customer string Helsinki
country_id Country of the customer string FI
email Email of the customer string (email) hello@example.com
fax Fax number of the customer string +1-212-9876543
website Website of the customer string www.example.com
business_id Business id of the customer string 1234567-8
vat_number VAT number of the customer string FI12345678
identity_number Identity number of the consumer customer string 010190-1234
einvoice_address Einvoice address of the customer string 000123456789
einvoice_operator_id Einvoice operator id of the customer string 1
einvoice_unit_number Einvoice unit number of the customer int 1
payment_terms_id Default payment terms id of the customer int 1
auxliary_name_id Auxilarity name id of the customer int 1
locale_id Language of invoice int 1=finnish, 2=english, 4=swedish
locale_code Language of invoice FI, EN, SV
sales_pricelist_id Default pricelist of the customer int 1
description Description of the customer string This is a great customer
sales_factoring_partner_id Sales factoring parter id of the customer int
sales_invoice_taxclass_id Default taxclass id of the customer int 1= domestic sales (S) default
2= EU-sales services (K)
3= EU-sales goods (k)
4= Construction services (AE)
5= Scap metal sales (AE)
6= Foreign sales, outside of EU (G)
7= Domestic sales, VAT-free (Z)
8= Triangulation (K)
sales_invoice_incl_vat The customers invoice rows includes vat 0/1 int 0
auto_reminder_override Reminder settings of the customer 0/1 int 0
auto_reminder_setting Reminder setting to send automatically or not 0/1 int 0
auto_reminder_count Amount of reminders send int 1
auto_reminder_interval Interval of days between reminders int 12
auto_reminder_last_step Setting to decide what to do with the last reminder int 2
our_reference Our reference string 13504687
your_reference Your reference string 13504687
shipping_name Shipping name string Example customer
shipping_name2 Shipping 2 name string Example 2 customer
shipping_address Shipping address string Busy street 2
shipping_postalcode Shipping postalcode string 00120
shipping_city Shipping city string Helsinki
shipping_country_id Shipping country id int 1
currency_id Currency id int 1
sales_is_refused Sales is refused to this cusomer int 0
modified Last time modified string (date) 2020-07-22 13:18:15
title Title of the customer string F0015 – Example customer
sales_invoice_delivery_method Sales invoice delivery method string email, finvoice, postal, consumerfinvoice, consumerdirect, manual