API Developers

Version 1.3

OVERVIEW
STATUS
AUTHENTICATION
COMPANY
PRODUCTS
CATEGORIES
CUSTOMERS
CUSTOMER ADDRESS
SALESMEN
SUPPLIERS
ORDERS
TAXES
UNITS
SERIES
WAREHOUSES
CURRENCIES
COUNTRIES
DELIVERY METHODS
EXEMPTION REASONS
PAYMENT CONDITIONS
PAYMENT METHODS
SALES DOCUMENTS
Changelog

Overview

Status

Get


The API status of a given company

Usage

GET/status

Header


Authorization: WDAPI {api-key}

Returned Values

  • Success
    200 OK
    {

    State: int,
    PublicKey:[

    Modulus,
    Exponent

    ]

    }
    State can assume the following values:
    0. Offline;
    1. Online;
    2. Company not found (Incorrect API key);
    3. API not activated;
    4. Table management not active (not relevant in this context);
    5. Module Wisedat API Server not available;
    6. Inactive plan;
    PublicKey is only returned if State is 1. This returns the Modulus and Exponent encoded in Base64, for RSA encryption purposes. A new key is generated once a day, or if the server is restarted, which invalidates all authorization tokens.

  • Error 400
    400 Bad Request – No Authorization property on the request header

Authentication

Login

Login on the Wisedat server

Usage

POST/authentication/login

Header

Authorization: WDAPI {ApiKey;User;Password} (encrypted with server’s public RSA key which is received on the status request, and its result converted to a Base64 string)

Returned Values


  • Success
    200 OK
    {

    auth_token: string

    }

    Auth_token is a JSON Web Token and contains encrypted information
    about the session, user, etc. It must be sent on the header of
    subsequent requests, for authorization purposes.
    This token is valid for 30 minutes.

  • Error 400
     400 Bad Request – No Authorization property on the request header
  • Error 401
     401 Unauthorized – Login failed

Company

Get

Information about a given company

Usage

GET/company

Header


Authorization: Bearer {JWT} (The JWT contains the ApiKey that identifies the company)

Returned Values

  • Success
    200 OK
    {

    id: string,
    name: string,
    tax_id: string,
    address:{

    street: string,
    city: string,
    postal_code: string,
    postal_code_location: string,
    phone: string,
    fax: string,
    region: string,
    country:{

    iso_3166_1: string,
    name: string

    }

    },
    currency:{

    id: string,
    description: string,
    symbol: string,
    decimal_cases: int,

    }
    alt_currency:{

    id: string,
    description: string,
    symbol: string,
    decimal_cases: int

    }

    }

  • Error 401
    401 Unauthorized – Invalid/Inexistent/Expired token

Products

Get

Get one or a list of products

Usage

GET/products{id,limit,page,modified_since,query,name,description,barcode,show_inactive}

Parameters

id (int): ID of a product. If this parameter is declared, all others are ignored.
limit(int): Limit of products per page. If not declared, the limit is 50.
page (int): Page number. If not declared, the default value is 1.
modified_since (date): Get products modified/created since the declared date. Date and time must be sent in UTC according to ISO 8601.
query (string): Get products whose name, description or barcode contain this parameter.
name (string): Get products whose unique name contains this parameter.
description (string): Get products whose description contains this parameter.
barcode (string): Get products whose barcode contains this parameter.
show_inactive (boolean): Show or hide inactive products. The default value is false.

 

Header

Authorization: Bearer {JWT}

 

Returned Values

  • Success without ID
    200 OK
    {
    pagination: {
    limit: int, page: int,
    number_pages: int,
    number_items: int
    },

    products:
    [

    {

    id: int,
    name:string,
    description: string,
    barcode: string,
    image: string,
    price: float,
    current_stock: float,
    type: int,
    active: boolean,
    tax: {

    id: string,
    value: float,
    description: string,
    type: int,
    exemption_reason: {

    id: string,
    description: string
    }

    },

    unit:
    id: string, description:
    string
    },

    categories:
    [

    {

    id: int,
    id_parent:int,
    name: string,
    short_name: string

    },

    (…)
    ]

    },

    (…)
    ]

    }

  • Success with ID
    200 OK
    {

    id: int,
    name: string,
    description: string,
    barcode: string,
    brief_description: string,
    commercial_description: string,
    notes: string,
    images:
    [

    string,
    (…)
    ]

    price: float,
    current_stock: float,
    type: int,
    net_weight: float,
    gross_weight: float,
    volume: float,
    delivery_time: int,
    active: boolean,
    tax: {

    id: string,
    value: float,
    description: string.
    type: int,
    exemption_reason: {

    id: string,
    description: string
    }

    },

    unit: {

    id: string,
    description: string
    },

    categories:
    [

    {

    id: int,
    id_parent: int,
    name: string,
    short_name: string
    },

    (…)
    ],

    stocks:
    [

    {

    id_warehouse: int,
    id_location: int,
    id_lot: int,
    current_stock: float,
    reserved_stock: float
    },

    (…)
    ],

    suppliers:
    [

    {

    id: int,
    cost_price: float,
    unit: {
    id: string,
    description: string
    }

    },

    (…)
    ],

    main_supplier: {

    id: int,
    code: string,
    name: string,
    tax_id: string,
    active: boolean
    }

    }

    Images are Base64 encoded strings.
    Type can assume two values: 1 (merchandise) and 2 (service).
    An inactive product is always returned when searched by ID.

  • Error 400
    400 Bad Request – Parameter id must be numeric
  • Error 401
    401 Unauthorized – Invalid/Inexistent/Expired token
  • Error 404
    404 Not Found – Product from parameter id doesn’t exist

Post


Insert a new product

Usage

POST/products

Header

Authorization: Bearer {JWT}

Body

{

name: string,
description: string,
barcode: string,
price: float,
type: int,
tax: string,
unit: string,
warehouse: int,
brief_description: string,
commercial_description: string,
notes: string,
categories: [

{

id: int

},

(…)
]

}

  • Note
    Name, description, price and type are mandatory.
    Name must be unique and contain only alpha-numeric characters.
    Price must be equal or higher than 0.
    Type can only assume 1 (merchandise) or 2 (service).
    Barcode must be unique.
    If tax, unit, or warehouse are not defined,
    their respective suggested values are used.
    The first category in the list, is considered the main one.

Returned Values

  • Success
    201 Created
    {

    id: int

    }

  • Error 400
    400 Bad Request – A list of errors concerning the
    validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

Put

Update an existing product

PUT/product

Header

Authorization: Bearer {JWT}

Body

{

id: int,
description:string,
barcode: string,
price: float,
type: int,
tax:string,
warehouse: int,
brief_description: string,
commercial_description: string,
notes: string,
categories: [

{

id: int
},
(…)

]

suppliers:
[

{

id: int,
cost_price: float,
unit: string

},
(…)

],

main_supplier: int
}

  • Note
    Id is mandatory.
    Price and supplier’s cost_price must be equal or higher than 0.
    Type can only assume 1 (merchandise) or 2 (service).
    Barcode must be unique.
    When a list of categories or suppliers is declared, they replace all the current ones. The first category in the list, is considered the main one.
    The main_supplier must be included on suppliers if it’s declared. Otherwise, it must be present on the current list of suppliers.
    If the suppliers’ unit is not indicated, the product’s unit is used. Otherwise, it must be related to the later.

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – A list of errors concerning the validation of
    the request is returned
    {
    errors:
    [
    string,
    (…)

    ]

    }

  • Error 404
     404 Not Found – The product indicated by the id does not exist

Delete

Delete a product

Usage

DELETE/product?id={id}

Header


Authorization Bearer {JWT}

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – id is mandatory and must be numeric;
    A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,

    (…)
    ]

    }

  • Error 404
    404 Not Found – The product indicated by the id does not exist

Categories

Get

Get one or a list of categories

Usage

GET:/categories{?id,limit,page,modified_since,query,name,parent}

Parameters

id (int): ID of a category. If this parameter is declared, all others are ignored.
limit (int): Limit of categories per page. If not declared, the limit is 50.
page (int): Page number. If not declared, the default value is 1.
modified_since (date): Get categories modified/created since the declared date. Date and time must be sent in UTC according to ISO 8601.
query (string): Get categories whose name, or parent name contain this parameter.
name (string): Get categories whose name contains this parameter.
parent (int/string): Get categories whose parent name or ID contains this parameter.

 

Header

Authorization: Bearer {JWT}

Returned Values

  • Success without ID
    200 OK
    {

    pagination: {

    limit: int,
    page: int,
    number_pages: int,
    number_items: int
    },

    categories: [

    {

    id: int, id_parent: int,
    name: string,
    short_name: string,
    image: string

    },

    (…)
    ]

    }

  • Success with ID
    200 OK
    {

    id: int,
    id_parent: int,
    name:string,
    short_name: string,
    image: string

    }

    Image is a Base64 encoded string.

  • Error 400
    400 Bad Request – Parameter id must be numeric
  • Error 401
    401 Unauthorized – Invalid/Inexistent/Expired token
  • Error 404
     404 Not Found – Category from parameter id doesn’t exist

 

Post

Insert a new category

Usage

POST/category

Header

Authorization: Bearer {JWT}

Body

{

name: string,
short_name: string,
id_parent: int

}

Name is mandatory.

Returned Values

  • Success
    201 Created
    {

    id: int

    }

  • Error 400
    400 Bad Request – A list of errors concerning the validation of
    the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

Put

Update an existing category

Usage

PUT/category

Header

Authorization: Bearer {JWT}

Body

{
id: int,
name: string,
short_name: string
}

Id is mandatory.

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

  • Error 404
    404 Not Found – The category indicated by the id does not exist

Delete

Delete a category

Usage

DELETE/category?id={id}

Header


 Authorization: Bearer {JWT}

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – id is mandatory and must be numeric; A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

  • Error 404
    404 Not Found – The category indicated by the id does not exist

Customers

Get

Get one or a list of customers

Usage

GET/customers{?id,limit,page,modified_since,query,name,code,tax_id,show_inactive}

Parameters

id (int): ID of a customer. If this parameter is declared, all others are ignored.
limit (int): Limit of customers per page. If not declared, the limit is 50.
page (int): Page number. If not declared, the default value is 1.
modified_since (date): Get customers modified/created since the declared date. Date and time must be sent in UTC according to ISO 8601.
query (string): Get customers whose name, code, or tax ID contain this parameter.
name (string): Get customers whose name contains this parameter.
name (string): Get customers whose code contains this parameter.
tax_id (string): Get customers whose tax ID contains this parameter.
show_inactive (boolean): Show or hide inactive customers. The default value is false.

 

Header

Authorization: Bearer {JWT}

Returned Values

  • Success without ID
    200 OK
    {

    pagination: {

    limit: int,
    page: int,
    number_pages: int,
    number_items: int
    },

    customers: [

    {

    id: int, code:
    string,
    name:string,
    tax_id: string,
    active: boolean

    },
    (…)

    ]

    }

  • Success with ID
    200 OK
    {

    id: int,
    code: string,
    name: string,
    tax_id: string,
    website: string,
    email: string,
    phone: string,
    notes: string,
    active: boolean,
    country: {

    iso_3166_1: string,
    name: string
    },

    birthday: date,
    payment_method: {

    string,
    },

    payment_condition: {

    id: string,
    description: string
    },

    delivery_method:{

    id: string,
    description: string
    },

    currency: {

    id: string,
    description:string.
    symbol: string.
    decimal_cases: int
    },

    salesman: {

    id: int,
    code:string,
    name: string,
    commission: float.
    tax_id: string,
    active: boolean
    },

    billing_address: {

    street:string,
    city: string,
    postal_code: string,
    postal_code_location: string,
    phone: string,
    fax: string,
    region: string,
    country: {

    iso_3166_1: string,
    name: string

    }

    },

    shipping_address: {

    street: string,
    city: string,
    postal_code: string,
    postal_code_location:
    string,
    phone: string,
    fax: string,
    region: string,
    country: {

    iso_3166_1: string,
    name: string
    }

    },

    other_addresses: [

    {

    street: string,
    city: string,
    type: string,
    postal_code: string,
    postal_code_location: string,
    phone: string,
    fax: string,
    region: string,
    country: {

    iso_3166_1: string,
    name: string
    }

    },

    (…)
    ]

    }

    An inactive customer is always returned when searched by ID.
    Birthday is a UTC date.

  • Error 400
    400 Bad Request – Parameter id must be numeric
  • Error 401
    401 Unauthorized – Invalid/Inexistent/Expired token
  • Error 404
     404 Not Found – Customer from parameter id doesn’t exist

Post

Insert a new customer

Usage

POST/customers

Header

Authorization: Bearer {JWT}

Body

{

code: string,
name: string,
tax_id: string,
website: string,
email: string,
phone: string,
notes: string,
currency: string,
birthday: string,
salesman: int,
country: string,
billing_address:
{

street: string,
city: string,
postal_code: string,
postal_code_location: string,
phone: string,
fax: string,
region: string,
country:{

iso_3166_1: string
}

},

shipping_address:
{

street: string,
city: string,
postal_code: string,
postal_code_location: string,
phone: string,
fax: string,
region: string,
country:{

iso_3166_1: string

}

}

}

  • Note
    Code, name, country and one of the addresses are mandatory.
    Code must be unique and contain only alpha-numeric characters.
    Country is an ISO 3166-1 code.
    In both addresses, the street and city are mandatory. If the country is not defined, the customer’s country is assumed. If the country is Portugal, postal_code must be a valid Portuguese postal code: four digits, ‘-‘, three digits (‘000’ if not present).
    If the country is Portugal, the tax_id must be a valid NIF.
    Email must be a valid e-mail.
    Birthday must be sent in UTC.
    If currency is not defined, the base currency is assumed.

Returned Values

  • Success
    201 Created
    {

    id: int

    }

  • Error 400
    400 Bad Request – A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

Put

Update an existing customer

Usage

PUT/customer

Header

Authorization: Bearer {JWT}

Body

{

id: int,
name: string,
tax_id: string,
website: string,
email: string,
phone: string,
notes: string,
currency: string,
birthday: string,
salesman: int,
country: string,
billing_address:
{

street: string,
city: string,
postal_code: string,
postal_code_location: string,
phone: string,
fax: string,
region: string,
country:{

iso_3166_1: string

}

},
shipping_address:
{

street: string,
city: string,
postal_code: string,
postal_code_location: string,
phone: string,
fax: string,
region: string,
country:{

iso_3166_1: string

}

}

}

  • Note
    Id is mandatory.
    Tax_id is ignored if the customer already has a tax ID.
    Country is an ISO 3166-1 code.
    The customer’s name can only be changed if it has a
    tax ID or no sale associated to it exist.
    In both addresses, the street and city are mandatory.
    If the country is not defined, the customer’s
    country is assumed.
    If the country is Portugal, postal_code must be a
    valid Portuguese postal code: four digits,
    ‘-‘, three digits (‘000’ if not present).
    If the country is Portugal, the tax_id must be a valid NIF.
    Email must be a valid e-mail address.
    Birthday must be sent in UTC according to ISO 8601(YYYY-MM-DD).
    If currency is not defined, the base currency is assumed.

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

  • Error 404
    404 Not Found – The customer indicated by the id does not exist

Delete

Delete a customer

Usage

DELETE/customers?id={id}

Header


Authorization: Bearer {JWT}

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – id is mandatory and must be numeric;
    A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

  • Error 404
    404 Not Found – The customer indicated by the id does not exist

Customer Addresses

Get

Get one or a list

Usage

GET/customeraddresses?customer={id}

Parameters

id (int): Customer ID. Numeric and mandatory.
type (string): Address type.

 

Header

Authorization: Bearer {JWT}

Returned Values

Post

Insert a new customer address

Usage

POST/customeraddresses

Header

Authorization: Bearer {JWT}

Body

{

customer: int,
street: string,
city: string,
type: string,
postal_code: string,
postal_code_location: string,
phone: string,
fax: string,
region: string,
country:{

iso_3166_1: string

}

}

  • Note
    Customer, type, street, city and country are mandatory.
    Type must be unique.
    If the country is Portugal, postal_code must be a
    valid Portuguese postal code: four digits, ‘-‘,
    three digits (‘000’ if not present).

Returned Values

  • Success
    201 Created
  • Error 400
    400 Bad Request – A list of errors concerning the validation
    of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

Put

Update an existing customer addresss

Usage

PUT/customeraddresses

Header

Authorization: Bearer {JWT}

Body

{

customer: int,
street: string,
city: string,
type: string,
postal_code: string,
postal_code_location: string,
phone: string,
fax: string,
region: string,
country:{

iso_3166_1: string

}

}

  • Note
    Customer, and type are mandatory.
    If the country is Portugal, postal_code
    (or the current one if postal_code isn’t in the request)
    must be a valid Portuguese postal code: four digits, ‘-‘,
    three digits (‘000’ if not present).

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – A list of errors concerning the validation
    of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

  • Error 404
     404 Not Found – The customer or type don’t exist

Delete

Delete a customer address

Usage

DELETE/customeraddresses?id={id}

Header


Authorization: Bearer {JWT}

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – customer and type are mandatory;
    A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

  • Error 404
     404 Not Found – The customer or type don’t exist

Salesmen

Get

Get one or a list of salesmen

Usage

GET/salesmen{?id,limit,page,modified_since,query,name,code,tax_id,show_inactive}

Parameters

id (int): ID of a salesman. If this parameter is declared, all others are ignored.
limit (int): Limit of salesmen per page. If not declared, the limit is 50.
page (int): Page number. If not declared, the default value is 1.
modified_since (date): Get salesmen modified/created since the declared date. Date and time must be sent in UTC according to ISO 8601.
query (string): Get salesmen whose name, code, or tax ID contain this parameter.
name (string): Get salesmen whose name contains this parameter.
name (string): Get salesmen whose code contains this parameter.
tax_id (string): Get salemen whose tax ID contains this parameter.
show_inactive (boolean): Show or hide inactive salesmen. The default value is false.

 

Header

Authorization: Bearer {JWT}

Returned Values

  • Success without ID
    200 OK
    {

    pagination: {

    limit: int,
    page: int,
    number_pages: int,
    number_items: int
    },

    salesmen:
    [

    {

    id: int, code:
    string,
    name: string,
    commission: float,
    tax_id: string,
    active: boolean

    },
    (…)

    ]

    }

  • Sucess with ID
    200 OK
    {

    id: int,
    code:string,
    name:string,
    commission: float,
    tax_id: string,
    email: string,
    phone: string,
    notes: string,
    active: boolean,
    country: {

    iso_3166_1: string,
    name: string
    },

    address: {

    street: string,
    city:string,
    postal_code: string,
    postal_code_location: string,
    phone: string,
    fax: string,
    region: string,
    country: {

    iso_3166_1: string,
    name: string

    }

    }

    }

    An inactive salesman is always returned when searched by ID.
    Commission is a percentage value.

  • Error 400
    400 Bad Request – Parameter id must be numeric 401 Unauthorized – Invalid/Inexistent/Expired token
  • Error 404
     404 Not Found – Salesman from parameter id doesn’t exist

Post

Insert a new salesman

Usage

POST/salesmen

Header

Authorization: Bearer {JWT}

Body

{

code: string,
name: string,
tax_id: string,
commission: float,
email: string,
phone: string,
notes: string,
country: string,
address:
{

street: string,
city: string,
postal_code: string,
postal_code_location: string,
phone: string,
fax: string,
region: string,
country:{

iso_3166_1: string

}

}

}

  • Note
    Code, name, country are mandatory.
    Code must be unique and contain only alpha-numeric characters.
    Country is an ISO 3166-1 code.
    If address is declared, the street and city are mandatory.
    If the country is not defined, the salesman’s country is assumed.
    If the country is Portugal, postal_code must be a valid
    Portuguese postal code: four digits,
    ‘-‘, three digits (‘000’ if not present).
    If the country is Portugal, the tax_id must be a valid NIF.
    Email must be a valid e-mail address.
    Commission must be a number between 0 and 100.

Returned Values

  • Success
    201 Created
    {

    id: int

    }

  • Error 400
    400 Bad Request – A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

Put

Update an existing salesman

Usage

PUT/salesmen

Header

Authorization: Bearer {JWT}

Body

{

id: int,
name: string,
tax_id: string,
commission: float,
email: string,
phone: string,
notes: string,
country: string,
address:
{

street: string,
city: string,
postal_code: string,
postal_code_location: string,
phone: string,
fax: string,
region: string,
country:{

iso_3166_1: string

}

}

}

  • Note
    Id is mandatory.
    Tax_id is ignored if the salesman already has a tax ID.
    Country is an ISO 3166-1 code.
    If address is declared and the salesman doesn’t have an address, the street and city are mandatory. If the country is not defined, the salesman’s country is assumed. If the country is Portugal, postal_code must be a valid Portuguese postal code: four digits, ‘-‘, three digits (‘000’ if not present).
    If the country is Portugal, the tax_id must be a valid NIF.
    Email must be a valid e-mail address.
    Commission must be a number between 0 and 100.

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

  • Error 404
    404 Not Found – The salesman indicated by the id does not exist

Delete

Delete a salesman

Usage

DELETE/salesmen?id={id}

Header


Authorization: Bearer {JWT}

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – id is mandatory and must be numeric; A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

  • Error 404
     404 Not Found – The salesman indicated by the id does not exist

Suppliers

Get

Get one or a list of suppliers

Usage

GET/suppliers{?id,limit,page,modified_since,query,name,code,tax_id,show_inactive}

Parameters

id (int): ID of a supplier. If this parameter is declared, all others are ignored.
limit (int): Limit of suppliers per page. If not declared, the limit is 50.
page (int): Page number. If not declared, the default value is 1.
modified_since (date): Get suppliers modified/created since the declared date. Date and time must be sent in UTC according to ISO 8601.
query (string): Get suppliers whose name, code, or tax ID contain this parameter.
name (string): Get suppliers whose name contains this parameter.
name (string): Get suppliers whose code contains this parameter.
tax_id (string): Get suppliers whose tax ID contains this parameter.
show_inactive (boolean): Show or hide inactive suppliers. The default value is false.

 

Header

Authorization:Bearer {JWT}

Returned Values

  • Success Without ID
    200 OK
    {

    pagination: {

    limit: int,
    page: int,
    number_pages: int,
    number_items: int
    },

    salesmen:
    [

    {

    id: int,
    code: string,
    name: string,
    tax_id: string,
    active: boolean

    },
    (…)

    ]

    }

  • Success with ID
    200 OK
    {

    id: int,
    code: string,
    name: string,
    tax_id: string,
    email: string,
    phone: string,
    notes: string,
    active: boolean,
    country: {

    iso_3166_1: string,
    name: string
    },

    address: {

    street: string,
    city: string,
    postal_code: string,
    postal_code_location: string,
    phone: string,
    fax: string,
    region: string,
    country: {

    iso_3166_1: string,
    name: string

    }

    }

    }

    An inactive supplier is always returned when searched by ID.

  • Error 400
    400 Bad Request – Parameter id must be numeric – Invalid/Inexistent/Expired token
  • Error 404
     401 Unauthorized – Invalid/Inexistent/Expired token
  • Error 409
     404 Not Found – Supplier from parameter id doesn’t exist

Post

Insert a new supplier

Usage

POST/suppliers

Header

Authorization: Bearer{JWT}

Body

{

code: string,
name: string,
tax_id: string,
email: string,
phone: string,
notes: string,
country: string,
address:
{

street: string,
city: string,
postal_code: string,
postal_code_location: string,
phone: string,
fax: string,
region: string,
country:
{

iso_3166_1: string

}

}

}

  • Note
    Code, name, country are mandatory.
    Code must be unique and contain only alpha-numeric characters.
    Country is an ISO 3166-1 code.
    If address is declared, the street and city are mandatory. If the country is not defined, the supplier’s country is assumed. If the country is Portugal, postal_code must be a valid Portuguese postal code: four digits, ‘-‘, three digits (‘000’ if not present).
    If the country is Portugal, the tax_id must be a valid NIF.
    Email must be a valid e-mail address.

Returned Values

  • Success
    201 Created
    {

    id: string

    }

  • Error 400
    400 Bad Request – A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

Put

Update an existing supplier

Usage

PUT/suppliers

Header

Authorization:Bearer{JWT}

Body

{

id:int,
name: string,
tax_id: string,
email: string,
phone: string,
notes: string,
country: string,
address:
{
street: string,
city: string,
postal_code: string,
postal_code_location: string,
phone: string,
fax: string,
region: string,
country:{

iso_3166_1: string
}

}

}

  • Note
    Id is mandatory.
    Tax_id is ignored if the supplier already has a tax ID.
    Country is an ISO 3166-1 code.
    If address is declared and the supplier doesn’t have an address, the street and city are mandatory. If the country is not defined, the supplier’s country is assumed. If the country is Portugal, postal_code must be a valid Portuguese postal code: four digits, ‘-‘, three digits (‘000’ if not present).
    If the country is Portugal, the tax_id must be a valid NIF.
    Email must be a valid e-mail address.

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

  • Error 404
     404 Not Found – The supplier indicated by the id does not exist

Delete

Delete a supplier

Usage

DELETE/suppliers?id={id}

Header


Authorization: Bearer {JWT}

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – id is mandatory. A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

  • Error 404
    404 Not Found – The supplier indicated by the id does not exist

Orders

Get

Get one or a list of orders

Usage

GET/orders{?id,limit,page,modified_since,query,closed,customer,salesman,series,
date,expiration_date,your_reference }

Parameters

id (string): ID of an order. If this parameter is declared, all others are ignored.
limit (int): Limit of orders per page. If not declared, the limit is 50.
page (int): Page number. If not declared, the default value is 1.
modified_since (date): Get orders modified/created since the declared date. Date and time must be sent in UTC according to ISO 8601.
query (string): Get orders whose customer (code/name), salesman (code/name), series or your reference contain this parameter.
closed (boolean): Get closed or open orders.
customer (int/string): Get orders whose customer’s ID, code or name contain this parameter.
salesman (string): Get orders whose salesman’s ID, code or name contain this parameter.
series (string): Get orders whose series ID contains this parameter.
date (date): Get orders from the given date. Date must be sent in UTC according to ISO 8601 (YYYY-MM-DD).
expiration_date (date): Get orders from the given expiration date. Date must be sent in UTC according to ISO 8601 (YYYY-MM-DD).
your_reference (string): Get orders whose reference contains this parameter.

 

Header

Authorization: Bearer {JWT}

Returned Values

  • Success without ID
    200 OK
    {

    pagination: {

    limit: int,
    page: int,
    number_pages: int,
    number_items: int
    },

    orders:
    [

    {

    id: string,
    customer: {

    id: int,
    code: string,
    name: string,
    tax_id: string,
    active: boolean
    },

    series: {

    id: string,
    description: string,
    vat_cash_system: boolean,
    active: boolean
    },

    delivery_method: {

    id: string,
    description: string
    },

    payment_condition: {

    id: string,
    description: string
    },

    payment_method: {

    id: string,
    description: string
    },

    sales_document: {

    id: string,
    description: string,
    default_series: string,
    document_type: int,
    saft_invoice_type: int,
    active: boolean
    },

    currency: {

    id: string,
    description: string,
    symbol: string,
    decimal_cases: int
    },

    exchange_rate: float,
    date: date,
    expiration_date: date,
    canceled: boolean,
    closed: boolean,
    merchandise: float,
    postage: float,
    discounts: float,
    subtotal: float,
    taxes: float,
    adjustment: float,
    total: float,
    entity_discount: float,
    financial_discount: float

    },
    (…)

    ]

    }

  • Success with ID
    200 OK
    {

    id: string,
    customer: {

    id: int,
    code: string,
    name: string,
    tax_id: string,
    email: string,
    phone: string,
    active: boolean,
    country: {

    iso_3166_1: string,
    name: string
    },

    billing_address: {

    street: string,
    city: string,
    postal_code: string,
    postal_code_location: string,
    phone: string,
    fax: string,
    region: string,
    country: {

    iso_3166_1: string,
    name: string
    }

    },

    shipping_address: {

    street: string,
    city: string,
    postal_code: string,
    postal_code_location: string,
    phone: string,
    fax: string,
    region: string,
    country: {

    iso_3166_1: string,
    name: string
    }

    }

    },

    series: {

    id: string,
    description: string,
    vat_cash_system: boolean,
    active: boolean
    },

    salesman: {

    id: int,
    code: string,
    name: string,
    commission: float,
    tax_id: string,
    active: boolean
    },

    delivery_method: {

    id: string,
    description: string
    },

    payment_condition: {

    id: string,
    description: string
    },

    payment_method: {

    id: string,
    description: string
    },

    sales_document: {

    id: string,
    description: string,
    default_series: string,
    document_type: int,
    saft_invoice_type: int,
    active: boolean
    },

    currency: {

    id: string,
    description: string,
    symbol: string,
    decimal_cases: int
    },

    exchange_rate: float,
    items:
    [

    {

    product: {

    id: int,
    name: int,
    barcode: string,
    type: int,
    unit: {

    id: string,
    description: string
    }

    },

    tax: {

    id: string,
    value: float,
    description: string,
    type: int,
    exemption_reason: {

    id: string,
    description: string
    }

    },

    price: float,
    quantity: float,
    discount: float,
    type: int,
    description: string,
    warehouse: int
    },

    (…)

    ],

    your_reference: string,
    notes: string,
    vehicle_plate: string,
    date: date,
    expiration_date: date,
    canceled: boolean,
    closed: boolean,
    merchandise: float,
    postage: float,
    discounts: float,
    subtotal: float,
    taxes: float,
    adjustment: float,
    total: float,
    entity_discount: float,
    financial_discount: float,
    alternate_billing_address: string,
    alternate_shipping_address: string,
    hash: string,
    hash_control: string,
    loading_location: {

    street: string,
    city: string,
    postal_code: string,
    postal_code_location: string,
    country: {

    iso_3166_1: string,
    name: Portugal
    }

    },

    unloading_location: {

    street: string,
    city: string,
    postal_code: string,
    postal_code_location: string,
    country: {

    iso_3166_1: string,
    name: Portugal
    }

    }

    }

    The field type of items can assume these values:
    1. Merchandise/Service
    2. Postage
    3. Adjustment
    4. Value discount on merchandise/service
    5. Other value discount
    6. Notes
    Date and expiration_date are sent in UTC.
    Merchandise is the total value of items with type 1. Postage is the total value of items with type 2. Adjusctment is the total value of items with type 3. Discounts is the total value of items with type 4 and 5.
    Subtotal is equal to Merchandise plus Postage minus Discounts. Total adds Taxes and subtracts Adjustment to the Subtotal.
    Taxes is the total value of item taxes, which exist in every item type, except 3 and 6.
    Entity_discount and financial_discount is a percentage value.
    Alternate_billing_address and alternate_shipping_address are address types.

  • Error 400
    400 Bad Request – Parameter id must be numeric
  • Error 401
    401 Unauthorized – Invalid/Inexistent/Expired token
  • Error 404
    404 Not Found – Order from parameter id doesn’t exist
  • Error 409
    409 Conflict – The order was edited by another application, in a way that makes it invalid for API purposes

Post

Insert a new order

Usage

POST/orders

Header

Authorization: Bearer {JWT}

Body

{

customer: int,
salesman: int,
series: string,
your_reference: string,
notes: string,
vehicle_plate: string,
delivery_method: string,
sales_document: string,
payment_condition: string,
payment_method: string,
date: date,
expiration_date: date,
closed: boolean,
currency: string,
exchange_rate: float,
entity_discount: float,
financial_discount: float,
alternate_billing_address: string,
alternate_shipping_address: string,
loading_location: {

street: string,
city: string,
postal_code_location: string,
country: {

iso_3166_1: string
}

}

unloading_location: {

street: string,
city: string,
postal_code: string,
postal_code_location: string,
country: {

iso_3166_1: string

}

},

items:
[

{

id: int,
description: string,
tax: string,
price: float,
quantity: float,
discount: float,
type: int,
warehouse: int
},

(…)
]

}

  • Note
    Customer, date, expiration_date and series are mandatory.
    The customer must have a billing address. The address of type “Empresa” is used as billing address and the one of type “Entrega” is used as shipping_address, unless alternate_billing_address or alternate_shipping_address are declared.
    If salesman, delivery_method, payment_condition, payment_method, currency or entity_discount are not defined, the customer’s respective values are used. If they don’t exist, the suggested or default values are used instead.
    If sales_document is defined, its document type must be 2 (orders). If not, the suggested orders sales document is used.
    When currency (either from the request or from customer) is not the company’s base currency, exchange_rate is mandatory and must be higher than zero.
    Series must be active for the sales_document, and the number of documents of that type can’t exceed the series’ limit. Date must be in its date interval. A series with vat_cash_system must be used if the company or the customer uses it. A series without vat_cash_system can only be used if neither use it.
    Entity_discount and financial_discount accept numbers between 0 and 100.
    If the country of loading_location and unloading_location is Portugal, postal_code must be a valid Portuguese postal code: four digits, ‘-‘, three digits (‘000’ if not present).
    The fields id, discount and warehouse of items are only considered if type is 1. Discount accepts numbers between 0 and 100.
    If item’s description is not declared a default value is used, except for type 6, the item is simply ignored in that case.
    The tax of an item is mandatory if type is 4 or 5. If type is 1 and tax is not declared, the product’s tax is used. Tax is ignored with other types.
    Item’s price and quantity must be higher than 0. Price is mandatory if type is 2, 3, 4 or 5. Quantity is mandatory if type is 1, otherwise its value is 1 if not declared.
    All the order’s totals must be positive.

Returned Values

  • Success
    201 Created
    {

    id: string

    }

  • Error 400
    400 Bad Request – A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

Put

Update an existing order

Usage

PUT/orders

Header

Authorization: Bearer {JWT}

Body

{

id: string,
customer: int,
salesman: int,
series: string,
your_reference: string,
notes: string,
vehicle_plate: string,
delivery_method: string,
sales_document: string,
payment_condition: string,
payment_method: string,
date: date,
expiration_date: date,
closed: boolean,
currency: string,
exchange_rate: float,
entity_discount: float,
financial_discount: float,
alternate_billing_address: string,
alternate_shipping_address: string,
loading_location: {

street: string,
city: string,
postal_code_location: string,
country: {

iso_3166_1: string

}

},

unloading_location: {

street: string,
city: string,
postal_code: string,
postal_code_location: string,
country: {

iso_3166_1: string

},

items:
[

{

id: int,
description: string,
tax: string,
price: float,
quantity: float,
discount: float,
type: int,
warehouse: int

},

(…)
]

}

  • Note
    Id is mandatory.
    Closed orders can’t be modified.
    The customer must have a billing address. The address of type “Empresa” is used as billing address and the one of type “Entrega” is used as shipping_address, unless alternate_billing_address or alternate_shipping_address are declared.
    If salesman, delivery_method, payment_condition, payment_method, currency or entity_discount are not defined, but customer is, the values are replaced by the customer ones, if they exist.
    If sales_document is defined, its document type must be 2 (orders).
    When currency (either from the request or from customer) is not the company’s base currency, exchange_rate is mandatory and must be higher than zero.
    Series must be active for the sales_document, and the number of documents of that type can’t exceed the series’ limit. Date must be in its date interval. A series with vat_cash_system must be used if the company or the customer uses it. A series without vat_cash_system can only be used if neither use it.
    Entity_discount and financial_discount accept numbers between 0 and 100.
    If the country of loading_location and unloading_location is Portugal, postal_code must be a valid Portuguese postal code: four digits, ‘-‘, three digits (‘000’ if not present).
    The fields id, discount and warehouse of items are only considered if type is 1. Discount accepts numbers between 0 and 100.
    If items is declared, all previous items of the order are deleted and replaced by the new ones.
    If item’s description is not declared a default value is used, except for type 6, the item is simply ignored in that case.
    The tax of an item is mandatory if type is 4 or 5. If type is 1 and tax is not declared, the product’s tax is used. Tax is ignored with other types.
    Item’s price and quantity must be higher than 0. Price is mandatory if type is 2, 3, 4 or 5. Quantity is mandatory if type is 1, otherwise its value is 1 if not declared.
    All the order’s totals must be positive.

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

  • Error 404
     404 Not Found – The order indicated by the id does not exist

Delete

Delete/cancel an order
Note:If the order is not closed, it’s deleted. If not, it’s canceled.

Usage

DELETE/orders?id={id}

Header


Authorization: Bearer {JWT}

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – id is mandatory; A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

  • Error 404
     404 Not Found – The order indicated by the id does not exist

Taxes

Get

Get one or a list of taxes

Usage

GET/taxes?id={id}

Parameters

id (string): ID of a tax.

 

Header

Authorization: Bearer {JWT}

Returned Values

  • Success without ID
    200 OK
    [

    {

    id: string,
    value: float,
    description: string,
    type: int,
    exemption_reason: {

    id: string,
    description: string

    }

    },
    (…)

    ]

  • Success with ID
    200 OK
    {

    id: string,
    description: string
    value: float,
    description: string,
    type: int,
    exemption_reason: {

    id: string,
    description: string

    }

    }
    Type can assume these values:
    0. Exempt
    1. Reduced
    2. Intermediate
    3. Normal
    4. No deduction

  • Error 401
    401 Unauthorized – Invalid/Inexistent/Expired token
  • Error 404
     404 Not Found – Tax from parameter id doesn’t exist

Post

Insert a new unit

Usage

POST/taxes

Header

Authorization: Bearer {JWT}

Body

{

id: string,
value: float,
description:string,
type: int,
exemption_reason:string
description: string
}
  • Note
    Id, value, description and type are mandatory.
    Id is a 2 character string, it must be unique and contain only alpha-numeric characters.
    Value must be a number between 0 and 100.
    If type is 0 or 4, exemption_reason is mandatory. In that case, the value must be 0, otherwise it can’t be 0.

Returned Values

  • Success
    201 Created
    {

    id: string

    }

  • Error 400
    400 Bad Request – A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

Put

Update an existing

Usage

PUT/taxes

Header

Authorization: Bearer {JWT}

Body

{

id: string,
value: float,
description: string,
type: int,
exemption_reason: string

}

  • Note
    Id is mandatory.
    Value must be a number between 0 and 100.
    If type is 0 or 4, exemption_reason is mandatory. In that case, the value must be 0, otherwise it can’t be 0.

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

  • Error 404
     404 Not Found – The tax indicated by the id does not exist

Delete

Delete a tax

Usage

DELETE/taxes?id={id}

Header


Authorization:Bearer {JWT}

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – id is mandatory; A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,

    (…)
    ]

    }

  • Error 404
     404 Not Found – The tax indicated by the id does not exist

Units

Get

Get one or a list of units

Usage

GET/units?id={id}

Parameters

id (string): ID of a unit.

 

Header

Authorization: Bearer {JWT}.

Returned Values

  • Success without ID
    200 OK
    [

    {

    id: string,
    description: string

    },
    (…)

    ]

  • Success with ID
    200 OK
    {

    id: string,
    description: string

    }

  • Error 400
     401 Unauthorized – Invalid/Inexistent/Expired token
  • Error 404
     404 Not Found – Unit from parameter id doesn’t exist

Post

Insert a new unit

Usage

POST/units

Header

Authorization: Bearer {JWT}

Body

{

id: string,
description: string

}

  • Note
    Id and description are mandatory.
    Id is a 5 character string, it must be unique and contain only alpha-numeric characters.

Returned Values

  • Success
    201 Created
    {

    id: string

    }

  • Error 400
    400 Bad Request – A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

Put

Update an existing tax

Usage

PUT/taxes

Header

Authorization: Bearer {JWT}

Body

{

id: string,
description: string

}

  • Note
    Id is mandatory.

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

  • Error 404
     404 Not Found – The units indicated by the id does not exist

Delete

Delete a units

Usage

DELETE/units?id={id}

Header


Authorization: Bearer {JWT}

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – id is mandatory; A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

  • Error 404
     404 Not Found – The unit indicated by the id does not exist

Series

Get

Get one or a list of series

Usage

GET/series?id={id}

Parameters

id (string): ID of a series.

 

Header

Authorization: Bearer {JWT}

Returned Values

  • Success without ID
    200 OK
    [

    {

    id: string,
    description: string,
    vat_cash_system: boolean,
    active: boolean

    },
    (…)

    ]

  • Success with ID
    200 OK
    {

    id: string,
    description: string,
    vat_cash_system: boolean,
    active: boolean

    }

    Vat_cash_system indicates if the series is under “Regime de IVA de caixa”.

  • Error 401
     401 Unauthorized – Invalid/Inexistent/Expired token
  • Error 404
     404 Not Found – Series from parameter id doesn’t exist

Post

Insert a new series

Usage

POST/series

Header

Authorization: Bearer {JWT}

Body

{

id: string,
description: string,
vat_cash_system: boolean

}

  • Note
    Id and description are mandatory.
    Id is a 5 character string, it must be unique and contain only alpha-numeric characters.
    The default value of vat_cash_system is false.

Returned Values

  • Success
    201 Created
    {

    id: int

    }

  • Error 400
    400 Bad Request – A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

Put

Update an existing series

Usage

PUT/series

Header

Authorization:Bearer {JWT}

Body

{

id: string,
description: string,
vat_cash_system: boolean

}

  • Note
    Id is mandatory.
    Vat_cash_system can be edited if no document is associated to that series.

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

  • Error 404
     404 Not Found – The series indicated by the id does not exist

Delete

Delete a series

Usage

DELETE/series?id={id}

Header


Authorization: Bearer {JWT}

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – id is mandatory; A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

  • Error 404
     404 Not Found – The series indicated by the id does not exist

Warehouses

Get

Get one or a list of warehouses

Usage

GET/warehouses?id={id}

Parameters

id (int): ID of a warehouse.

 

Header

Authorization: Bearer {JWT}

Returned Values

  • Success without ID
    200 OK
    [

    {

    id: int,
    code: string,
    description: string,
    address: {

    street: string,
    city: string,
    postal_code: string,
    postal_code_location: string,
    phone: string,
    fax: string,
    country: {

    iso_3166_1: string,
    name: string

    }

    }

    },
    (…)

    ]

  • Success with ID
    200 OK
    {

    id: int,
    code: string,
    description: string,
    address: {

    street: string,
    city: string,
    postal_code: string,
    postal_code_location: string,
    phone: string,
    fax: string,
    country: {

    iso_3166_1: string,
    name: string

    }

    }

    }

  • Error 401
     401 Unauthorized – Invalid/Inexistent/Expired token
  • Error 404
     404 Not Found – Warehouse from parameter id doesn’t exist

Post

Insert a new warehouse

Usage

POST/warehouses

Header

Authorization: Bearer {JWT}

Body

{

code: string,
description: string,
address:
{

street: string,
city: string,
postal_code: string,
postal_code_location: string,
phone: string,
fax: string,
country: {

iso_3166_1: string

}

}

}

  • Note
    Code and description are mandatory.
    Code is a 8 character string, it must be unique and contain only alpha-numeric characters.
    If the country of address is Portugal, postal_code must be a valid Portuguese postal code: four digits, ‘-‘, three digits (‘000’ if not present). If country is not defined, the company’s country is used.

Returned Values

  • Success
    201 Created

    {

    id: int
    }
  • Error 400
    400 Bad Request – A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

Put

Update an existing warehouse

Usage

PUT/warehouses

Header

Authorization: Bearer {JWT}

Body

{

id: int,
description: string,
address: {

street: string,
city: string,
postal_code: string,
postal_code_location: string,
phone: string,
fax: string,
country: {

iso_3166_1: string

}

}

}

  • Note
    Id is mandatory.
    If the country of address is Portugal, postal_code must be a valid Portuguese postal code: four digits, ‘-‘, three digits (‘000’ if not present).

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – id is mandatory; A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

  • Error 404
    Not Found – The warehouse indicated by the id does not exist

Delete

Delete a warehouse

Usage

DELETE/warehouses?id={id}

Header


Authorization: Bearer {JWT}

Returned Values

  • Success
    200 OK
  • Error 400
    400 Bad Request – id is mandatory; A list of errors concerning the validation of the request is returned
    {

    errors:
    [

    string,
    (…)

    ]

    }

  • Error 404
    404 Not Found – The warehouse indicated by the id does not exist

Currencies

Get

Get one or a list of currencies

Usage

GET/currencies?id={id}

Parameters

id (string): ID of a currency.

 

Header


Authorization: Bearer {JWT}

Returned Values

  • Success without ID
    200 OK
    [

    {

    id: string,
    description: string,
    symbol: string,
    decimal_cases: int

    },
    (…)

    ]

  • Success with ID
    200 OK
    {

    id: string,
    description: string,
    symbol: string,
    decimal_cases: int

    }

  • Error 401
     401 Unauthorized – Invalid/Inexistent/Expired token
  • Error 404
     404 Not Found – Currency from parameter id doesn’t exist

Countries

Get

Get one or a list of countries

Usage

GET/countries?id={id}

Parameters

id (string): Code ISO 3166-1 of a country.

Header

Authorization: Bearer {JWT}

Returned Values


  • Success without ID
    200 OK
    [

    {

    iso_3166_1: string,
    name: string

    },
    (…)

    ]

  • Success with ID
    200 OK
    {

    iso_3166_1: string,
    name: string

    }

  • Error 401
     401 Unauthorized – Invalid/Inexistent/Expired token
  • Error 404
     404 Not Found – Country from parameter id doesn’t exist

Delivery Methods

Get

Get one or a list of delivery methods

Usage

GET/deliverymethods?id={id}

Parameters

id (string): ID of a delivery method.

 

Header

Authorization: Bearer {JWT}

Returned Values


  • Success without ID
    200 OK
    [

    {

    id: string,
    description: string

    },
    (…)

    ]

  • Success with ID
    200 OK
    {

    id: string,
    description: string

    }

  • Error 401
     401 Unauthorized – Invalid/Inexistent/Expired token
  • Error 404
     404 Not Found – Delivery method from parameter id doesn’t exist

Exemption Reasons

Get

Get one or a list of exemption reasons

Usage

GET/exemptionreasons?id={id}

Parameters

id (string): ID of an exemption reason.

 

Header


Authorization: Bearer {JWT}

Returned Values

  • Success without ID
    200 OK
    [

    {

    id: string,
    description: string

    },
    (…)

    ]

  • Success with ID
    200 OK
    {

    id: string,
    description: string

    }

  • Error 401
     401 Unauthorized – Invalid/Inexistent/Expired token
  • Error 404
     404 Not Found – Exemption reason from parameter id doesn’t exist

Payment Conditions

Get

Get one or a list of payment conditions

Usage

GET/paymentconditions?id={id}

Parameters

id (string):</b< ID of a payment condition.

 

Header

Authorization: Bearer {JWT}

Returned Values


  • Success without ID
    200 OK
    [

    {

    id: string,
    description:string,

    },
    (…)

    ]

  • Success with ID
    200 OK
    {

    id: string,
    description: string

    }

  • Error 401
     401 Unauthorized – Invalid/Inexistent/Expired token
  • Error 404
    404 Not Found – Payment condition from parameter id doesn’t exist

Payment Methods

Get

Get one or a list of payment methods

Usage

GET/paymentmethods?id={id}

Parameters

id (string): ID of a payment method.

 

Header

Authorization: Bearer {JWT}

Returned Values


  • Success without ID
    200 OK
    [

    {

    id: string,
    description: string

    },
    (…)

    ]

  • Success with ID
    200 OK
    {

    id: string,
    description: string

    }

  • Error 401
     401 Unauthorized – Invalid/Inexistent/Expired token
  • Error 404
     404 Not Found – Payment method from parameter id doesn’t exist

Sales Documents

Get

Get one or a list of sales documents

Usage

GET/salesdocuments?id={id}

Parameters

id (string): ID of a sales document.

 

Header

Authorization: Bearer {JWT}

Returned Values


  • Success without ID
    200 OK
    [

    {

    id: string,
    description: string,
    default_series: string,
    document_type: int,
    saft_invoice_type: int,
    active: boolean

    },
    (…)

    ]

  • Success with ID
    200 OK
    {

    id: string,
    description: string,
    default_series: string,
    document_type: int,
    saft_invoice_type: int,
    active: boolean

    }

    Document_type can assume these values:
    0. Quotation request (work)
    1. Quotation
    2. Order
    3. Stock/Transfer (mov)
    4. Financial (inv)
    Saft_invoice_type can assume different values, depending on the document_type.
    If document_type is 0 or 1, its value can be -1 (no SAFT) or 0 (conference document).
    With type 2, it can only be -1 (no SAFT).
    If type is 3, it can be -1 (no SAFT), 0 (GR – Goods delivery), 1 (GT – Transport document), 2 (GA – Transport document for own fixed assets), 3 (GC – Consignation guide) and 4 (GD – Return note from customer).
    If type is 4, it can be -1 (no SAFT), 0 (FT – Invoice), 1 (ND – Debit note), 2 (NC – Credit note), 3 (VD – Sale for cash), 4 (TV – Sales ticket), 5 (TD – Devolution ticket), 6 (FS – Simplified invoice) and 7 (FR – Invoice-receipt).

  • Error 401
    401 Unauthorized – Invalid/Inexistent/Expired token
  • Error 404
    404 Not Found – Sales document from parameter id doesn’t exist

Changelog

Version 1

Date: 20/03/2017
Notes: First version.

Version 1.1

Date: 04/04/2017
Notes: Added supplier management and product suppliers. New fields on products.

Version 1.2

Date: 17/05/2017
Notes: New fields when getting a single order (hash, hash_control).

VERSION 1.3

Date: 24/11/2017
Notes: Creation of hash code when creating a new order.

top