API-v2

Application Programming Interface

InvoiceXpress Documentation



List All


GET /purchase_orders.json

Returns all your purchase orders. You can filter your purchase orders by passing parameters in the query string.

Example Request

curl

curl --request GET \
  --url 'https://account_name.app.invoicexpress.com/purchase_orders.json?text=foo&type=PurchaseOrder&status%5B%5D=sent&date%5Bfrom%5D=30%2F09%2F2017&date%5Bto%5D=31%2F10%2F2017&due_date%5Bfrom%5D=30%2F09%2F2017&due_date%5Bto%5D=31%2F10%2F2017&total_before_taxes%5Bfrom%5D=100.00&total_before_taxes%5Bto%5D=500.00&non_archived=true&archived=false&page=1&per_page=30&api_key=YOUR%20API%20KEY%20HERE' \
  --header 'accept: application/json'

Ruby

require 'uri'
require 'net/http'

url = URI("https://account_name.app.invoicexpress.com/purchase_orders.json?text=foo&type=PurchaseOrder&status%5B%5D=sent&date%5Bfrom%5D=30%2F09%2F2017&date%5Bto%5D=31%2F10%2F2017&due_date%5Bfrom%5D=30%2F09%2F2017&due_date%5Bto%5D=31%2F10%2F2017&total_before_taxes%5Bfrom%5D=100.00&total_before_taxes%5Bto%5D=500.00&non_archived=true&archived=false&page=1&per_page=30&api_key=YOUR%20API%20KEY%20HERE")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

response = http.request(request)
puts response.read_body

Node

var http = require("https");

var options = {
  "method": "GET",
  "hostname": "account_name.app.invoicexpress.com",
  "port": null,
  "path": "/purchase_orders.json?text=foo&type=PurchaseOrder&status%5B%5D=sent&date%5Bfrom%5D=30%2F09%2F2017&date%5Bto%5D=31%2F10%2F2017&due_date%5Bfrom%5D=30%2F09%2F2017&due_date%5Bto%5D=31%2F10%2F2017&total_before_taxes%5Bfrom%5D=100.00&total_before_taxes%5Bto%5D=500.00&non_archived=true&archived=false&page=1&per_page=30&api_key=YOUR%20API%20KEY%20HERE",
  "headers": {
    "accept": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();

Python

import http.client

conn = http.client.HTTPSConnection("account_name.app.invoicexpress.com")

headers = { 'accept': "application/json" }

conn.request("GET", "/purchase_orders.json?text=foo&type=PurchaseOrder&status%5B%5D=sent&date%5Bfrom%5D=30%2F09%2F2017&date%5Bto%5D=31%2F10%2F2017&due_date%5Bfrom%5D=30%2F09%2F2017&due_date%5Bto%5D=31%2F10%2F2017&total_before_taxes%5Bfrom%5D=100.00&total_before_taxes%5Bto%5D=500.00&non_archived=true&archived=false&page=1&per_page=30&api_key=YOUR%20API%20KEY%20HERE", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://account_name.app.invoicexpress.com/purchase_orders.json?text=foo&type=PurchaseOrder&status%5B%5D=sent&date%5Bfrom%5D=30%2F09%2F2017&date%5Bto%5D=31%2F10%2F2017&due_date%5Bfrom%5D=30%2F09%2F2017&due_date%5Bto%5D=31%2F10%2F2017&total_before_taxes%5Bfrom%5D=100.00&total_before_taxes%5Bto%5D=500.00&non_archived=true&archived=false&page=1&per_page=30&api_key=YOUR%20API%20KEY%20HERE",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Go

package main

import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://account_name.app.invoicexpress.com/purchase_orders.json?text=foo&type=PurchaseOrder&status%5B%5D=sent&date%5Bfrom%5D=30%2F09%2F2017&date%5Bto%5D=31%2F10%2F2017&due_date%5Bfrom%5D=30%2F09%2F2017&due_date%5Bto%5D=31%2F10%2F2017&total_before_taxes%5Bfrom%5D=100.00&total_before_taxes%5Bto%5D=500.00&non_archived=true&archived=false&page=1&per_page=30&api_key=YOUR%20API%20KEY%20HERE"

    req, _ := http.NewRequest("GET", url, nil)

    req.Header.Add("accept", "application/json")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

Query Parameters

Name Type Required Description Example
text String Search for purchase order, client or item details. foo
type[] String Required Possible value: PurchaseOrder. PurchaseOrder
status[] String Required Possible values: draft, sent, accepted, completed, refused, canceled or second_copy. sent
date[from] String Date in format dd/mm/yyyy. Ex: 30/09/2017 30%2F09%2F2017
date[to] String Date in format dd/mm/yyyy. Ex: 30/09/2017 30%2F09%2F2017
due_date[from] String Date in format dd/mm/yyyy. Ex: 30/09/2017 30%2F09%2F2017
due_date[to] String Date in format dd/mm/yyyy. Ex: 30/09/2017 30%2F09%2F2017
total_before_taxes[from] Number Minimum document amount. Ex: 100.00 100.00
total_before_taxes[to] Number Maximum document amount. Ex: 500.00 500.00
non_archived Boolean Required Possible values: true or false. true
archived Boolean Possible values: true or false. false
page Integer You can ask for a specific page of purchase orders. Defaults to 1. 1
per_page String You can specify how many results you want to fetch. Defaults to 10 or value defined in account settings (10, 20 or 30). 30

Responses

200 SUCCESS
Purchase orders were returned successfully.
Purchase Orders List all
401 ACCESS DENIED
The API Key parameter is missing or is incorrectly entered.
(Empty Response)

Example Success Body Response

{
  "purchase_orders": [
    {
      "id": 541790,
      "status": "completed",
      "archived": false,
      "type": "PurchaseOrder",
      "sequence_number": "1/A",
      "inverted_sequence_number": "A/1",
      "date": "12/06/2017",
      "due_date": "12/06/2017",
      "reference": "foo",
      "observations": "foo",
      "retention": "foo",
      "permalink": "https://www.app.invoicexpress.com/documents/5417901530e3995dac359aacc1a821976099c2c7b3c9b6",
      "saft_hash": "TO4M",
      "sum": 10,
      "discount": 0,
      "before_taxes": 10,
      "taxes": 2.3,
      "total": 12.3,
      "currency": "Euro",
      "client": {
        "id": 1310176,
        "name": "John",
        "country": "Portugal"
      },
      "items": [
        {
          "name": "iPhone",
          "description": "foo",
          "unit_price": "10.0",
          "unit": "foo",
          "quantity": "1.0",
          "tax": {
            "id": 31567,
            "name": "IVA23",
            "value": 23
          },
          "discount": 0,
          "subtotal": 10,
          "tax_amount": 2.3,
          "discount_amount": 0,
          "total": 12.3
        }
      ],
      "sequence_id": "12345",
      "tax_exemption": "M01"
    }
  ],
  "pagination": {
    "total_entries": 6,
    "current_page": 1,
    "total_pages": 1,
    "per_page": 10
  }
}
Livro de Reclamação