Support for

FLAPI: Customer Main Details

Alistair Wilson
by Alistair Wilson 6 years ago
 

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.

 

Jump to contents page of

FLAPI: Customers

 
 
 

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