Support for

FLAPI: Customers

Alistair Wilson
by Alistair Wilson 7 years ago
 

Quick Reference

Available to: FLAPI, M-FLAPI

Paths for Customers

GET /customers/<customer.code>/
POST /customers/<customer.code>/
name=<name>
PUT /customers/<customer.code>/

Paths for Customer Addresses

GET /customers/<customer.code>/addresses
POST /customers/<customer.code>/addresses
PUT /customers/<customer.code>/addresses

Paths for Customer contacts

GET /customers/<customer.code>/contacts
POST /customers/<customer.code>/contacts
PUT /customers/<customer.code>/contacts/<contact.id>

Customer Structure

  • workgroup
    • customer categories
      • customer

FLAPI: Customer Main Details FLAPI: Customer Main Details

FLAPI: Customer Addresses FLAPI: Customer Addresses

FLAPI: Customers

Quick Reference

Available to: FLAPI, M-FLAPI

Paths for Customers

GET /customers/<customer.code>/
POST /customers/<customer.code>/
name=<name>
PUT /customers/<customer.code>/

Paths for Customer Addresses

GET /customers/<customer.code>/addresses
POST /customers/<customer.code>/addresses
PUT /customers/<customer.code>/addresses

Paths for Customer contacts

GET /customers/<customer.code>/contacts
POST /customers/<customer.code>/contacts
PUT /customers/<customer.code>/contacts/<contact.id>

Customer Structure

  • workgroup
    • customer categories
      • customer

FLAPI: Customer Main Details

Request 'customer' by code

GET Syntax
/customers/<customer.code>

Retrieves a single customer item. You must have permission to view this customer.

HTTP request
GET http://dev.flyerlink.com/api.php/customers/HOTEST?format=json
HTTP response (JSON)
{
    "customer" : {
        "id" : "HOTEST",
        "name" : "printing.com",
        "address1" : "",
        "address2" : "Eighth Street",
        "address3" : "Second Avenue",
        "address4" : "Manchester",
        "address5" : "",
        "postcode" : "M17 1FG",
        "countrycode" : "GB",
        "category" : "417",
        "workgroup" : "W12"
        "payment_terms_code":"CASH",
        "payment_terms_description":"Cash"
    }
}

Create a 'customer'

POST Syntax
/customers

Creates a new customer item, using the specified parameters.
Success is indicated in the response by the status attribute of the response tag. If successful, the customer.id is returned.

Parameter Type Description
format string json or xml.
id char(8) New unique identifier for the customer.
name* char(40) Name for the new customer.
username char(90) username to log into a microsite
Must be unique
password char(255) password to log into their microsite - will be hashed after submission
email char(60) contact's email address
telephone char(20) contact's main telephone number
directtel char(20) additional telephone number
fax char(20) a fax number
mobile char(20) mobile number
website char(255) customers website
title char(4) customer's title
surname char(40) customer's surname
position char(40)
 
customer's job position
address1 ... address5 char(40)

Address lines. address1* is usually the legal / business name.
 

address2* is required as first line of the address, such as street number

address4* is required for the post town

Couriers may require that some of these details match the postcode.

postcode*  
countrycode char(4) Used as an address line, and to validate the postcode against the relevant third-party database (e.g. Post Office for UK).
workgrp char(8) Your workgroup.code.
category* char(4) Default category.code for customers created under this  workgrp (workgroup).
payment_terms_code char(1) Identifies payment terms, e.g.
CASH = must pay basket to order
14 = due in 14 days
payment_terms_description char(30)  
     
HTTP response (XML)
<?xml version="1.0" encoding="UTF-8"?>
<response status="ok">
  <id>APICUCT</id>
</response>
HTTP response (XML)
<?xml version="1.0" encoding="UTF-8"?>
<response status="error">
  <message>Data provided is not valid.</message>
  <errors>
    <id>
      <error>has already been taken.</error>
    </id>
  </errors>
</response>

Change 'customer' properties

PUT Syntax
/customers/<customer.code>

Changes the specified properties of a single customer item. You must have permission to access to this customer.

Parameter Type Description
format string json or xml.
name char(40) A short name for your customer’s account.
    (other properties will be implemented soon)
HTTP request
PUT http://dev.flyerlink.com/api.php/customers/HOTEST?name=Smiths&format=json

Request 'contact'

Each customer has at least 1 contact. Each contact has their own name, username and contact information.

View all contacts belonging to a customer

GETSyntax
/customers/<customer.code>/contacts
HTTP request
GET http://dev.flyerlink.com/api.php/customers/BDSPARK/contacts
HTTP response (XML)
<response status="ok">
  <contacts>
    <contact>
      <id>906396</id>
      <customer>BDSPARK</customer>
      <salutation>7</salutation>
      <title>Mr</title>
      <firstname>5</firstname>
      <surname>6</surname>
      <email>branddemand@printing.com</email>
      <telephone>€ à â ä æ ç é Â £</telephone>
      <website>www.sparklecleaning.co.uk</website>
      <directtel>0123456789</directtel>
      <fax></fax>
      <mobile>0723456789</mobile>
      <address></address>
      <username>BDSPAR25</username>
    </contact>
    <contact>
      <id>795724</id>
      <customer>BDSPARK</customer>
      <salutation>alistair</salutation>
      <title></title>
      <firstname>alistair</firstname>
      <surname>wilson</surname>
      <email>alistair.wilson@printing.com</email>
      <telephone></telephone>
      <website></website>
      <directtel></directtel>
      <fax></fax>
      <mobile></mobile>
      <address></address>
      <username>BDALIS22</username>
    </contact>
</contacts>

View all individual contact belonging to a customer

GETSyntax
/customers/<customer.code>/contacts/<contact.id>
HTTP request
GET http://dev.flyerlink.com/api.php/customers/BDSPARK/contacts/906396/
HTTP response (XML)
<response status="ok">
  <contacts>
    <contact>
      <id>906396</id>
      <customer>BDSPARK</customer>
      <salutation>7</salutation>
      <title>Mr</title>
      <firstname>5</firstname>
      <surname>6</surname>
      <email>branddemand@printing.com</email>
      <telephone>€ à â ä æ ç é Â £</telephone>
      <website>www.sparklecleaning.co.uk</website>
      <directtel>0123456789</directtel>
      <fax></fax>
      <mobile>0723456789</mobile>
      <address></address>
      <username>BDSPAR25</username>
    </contact>
 </contacts>

Create 'contact'

POST Syntax
/customers/<customer.code>/contacts/

Creates a new contact belonging to an existing customer, using the specified parameters.
Success is indicated in the response by the status attribute of the response tag. If successful, the contact.id is returned.

Parameter Type Description
format string json or xml.
firstname char(40) Name for the new customer.
username char(90) username to log into a microsite
Must be unique
password char(255) password to log into their microsite - will be hashed after submission
email char(60) contact's email address
telephone char(20) contact's main telephone number
directtel char(20) additional telephone number
fax char(20) a fax number
mobile char(20) mobile number
website char(255) customers website
title char(4) customer's title
surname char(40) customer's surname
position char(40)
 
customer's job position
HTTP response (XML)
<?xml version="1.0" encoding="UTF-8"?>
<response status="ok">
  <id>1035064</id>
</response>
HTTP response (XML)
<?xml version="1.0" encoding="UTF-8"?>
<response status="error">
  <message>Data provided is not valid.</message>
  <errors>
    <id>
      <error>has already been taken.</error>
    </id>
  </errors>
</response>

Update 'contact'

PUT Syntax
/customers/<customer.code>/contacts/<contact.id>

Updates an existing contact, details using the same parameters as create contact.
Success is indicated in the response by the status attribute of the response tag. If successful, the contact.id is returned.

FLAPI: Customer Addresses

Each customer has a main invoicing address. They may have additional delivery addresses, accessed using these .../addresses requests.

Request 'addresses' by customer

GET Syntax
/customers/<customer.code>/addresses

Retrieves all addresses for a customer (limited to 300 items).

Request 'address' by customer and address id

GET Syntax
/customers/<customer.code>/addresses/<address.id>

Retrieves a single address item for a customer. Note that the address.id values are 6-character strings of numeric digits, having leading zeros.

HTTP request
GET http://dev.flyerlink.com/api.php/customers/HOTEST/addresses/000004?format=json
HTTP response (JSON)
{
    "address" : {
        "id" : "000004",
        "customer" : "HOTEST",
        "name" : "Fred Valentine",
        "address1" : "Name of the Building, or number+street",
        "address2" : "3rd Avenue",
        "address3" : "The Village",
        "address4" : "Trafford Park",
        "address5" : "",
        "countrycode" : "GB",
        "postcode" : "M17 1FG",
        "telephone" : "",
        "contact" : "Fred Valentine"
    }
}
Response Item Description
product Container item, with status attribute.
  id Unique identifier for the product.
  customer customer.code
  name Trading name of the business, or customer's name.
  address1 ... address5 Address lines. Some couriers require that some of these details match the postcode.
  postcode
  countrycode ISO 2-character country code.
  telephone The contact number, relevant to receiving deliveries at this address.
  contact The name of the person at this address, likely to be available to receive deliveries.

Create a 'customer address'

POST Syntax
/customers/<customer.code>/addresses

Adds a new address to the customer. The new address.id is returned in the response. Use this address.id only in the context of the same customer.code when working with existing addresses.

HTTP request
POST /customers/HOTEST/addresses
name=Address%20Created%20Through%20API&address1=legal%20name&address2=6%20street%20name&address3=town&address4=county&address5=state&countrycode=GB&postcode=ABC%20DEF&telephone=01234%20578901&contact=Mr%20Test%20Cust

Update a 'customer address'

PUT Syntax
/customers/<customer.code>/addresses/<address.id>

Updates one or more fields of an identified customer + address.

Only add the parameters you want to update.

 
 

Jump to contents page of

Flyerlink API Guide

 
 
 

All content is (c) Nettl Systems Limited, 2024 and may not be used, copied or distributed without permission.