omnix-logo.png

V6RESTful APIs - Invoices

Retrieve invoices by date range

Description

This API interface can be used retrieve invoices created within a date range in v6.

Protocol

Url: {domain_name}/v6-api/rest/invoices?fromDate=ddMMyyyy&toDate=ddMMyyyy

Method: GET

Authentication: ApiKey, embedded in the request header. In details, the request header must contain a key value pair for the authorization; in which the key should be “Authorization” and value is “ApiKey {provided-api-key}”; for example “ApiKey rGzwXXurMoOd9ooSrOZ4UO2izAXHfzVU”

JSON request example: in order to get all invoices within a date range, users need to submit the required parameters which are fromDate and toDate; missing one of the 2 fields will result in Bad Request response (http code: 400).

 

JSON Response:

The response will be returned in JSON format. The following are the list of some common responses.

Please note that some information of invoices may not be available (have no data), and they will not in the JSON response. For all fields which potentially returned in JSON response please see appendix A.

JSON Response:

The response will be returned in JSON format. The following are the list of some common responses. 

Please note that some information of invoices may not be available (have no data), and they will not in the JSON response. For all fields which potentially return in JSON response please see appendix A.

 

Successful request will return list of invoices within the given date range, for example:

[

         {

         "businessName": "OMNIX PTY LTD",

         "invoiceDate": "2018-01-24",

         "taxAmount": 0.91,

         "fileType": "I",

         "customerCode": "001",

         "address1": "80 JEPHSON STREET",

        "lines": [

             {

                 "amount": 10,

                 "price": 10,

                 "gstAmount": 0.91,

                 "quantity": 1,

                 "departmentCode": "BRI",

                 "glCode": "23"

             }

    ],

    "postcode": "4006",

    "invoiceNo": "LT001",

    "grossEntry": true,

    "city": "TOOWONG"

},

{

    "businessName": "OMNIX PTY LTD",

    "invoiceDate": "2018-01-25",

    "taxAmount": 1.82,

    "fileType": "I",

    "customerCode": "001",

    "address1": "80 JEPHSON STREET",

    "lines": [

             {

                 "amount": 20,

                 "price": 20,

                 "gstAmount": 1.82,

                 "quantity": 1,

                 "departmentCode": "BRI",

                 "glCode": "23"

        }

    ],

    "postcode": "4006",

    "invoiceNo": "LT002",

    "grossEntry": true,

    "city": "TOOWONG"

     }

]
 

Authentication problem: no API key found in the “Authorization” in request header, or wrong API key. This may provide different warning messages.

{

          "httpStatusCode": 401,

          "msg": "Unauthorised: Cannot find API key in the header or the API key is not correct. Make sure the API key is embedded in the request header, under Authorization property. E.x. Auhtorization: apikey provided-api-key"

}


 

{

          "httpStatusCode": 401,

          "Msg": "Invalid API key"

}

 

Violating data constraints

There are some constraints that submitted data must follow, for example some malformed data errors but not all:

  • Missing required fields,

  • Unrecognised fields,

  • string value exceed maximum length or shorter than minimum length,

  • number is smaller than minimum value or larger than maximum value

  • and some other logical constraints (e.g. pickup date must be before delivery date).

All the requests breaking the these rules will result in Bad Request (400). The corresponding responses also contain intuitive error messages informing which fields do not follow which rules. To see all rules please see appendix A.

 

The format of bad request response should look like following JSON

{

          "httpStatusCode": 400,

          "msg": "Bad request"

          "violations": {

                    //a list of violations

                    [

                    {fieldName} - {error} - {suggestion},

                    ...

                    ]

          }

}

Example of Bad Request response:

{

          "violations": [

          "fromDate - required field - must exist and must not be empty",

          "fromDate, toDate - invalid date range - fromDate date has to be before toDate",

          "toDate - required field - must exist and must not be empty"

          ],

          "httpStatusCode": 400,

          "msg": "Bad Request"

}

Appendix A: All fields that are potentially returned when querying invoices by date range

1/96 Jephson Street, Toowong

Call us free: 1800 666 490

apple.png
android.png
linkedin.png
youtube.png