API-V2

Application Programming Interface

InvoiceXpress Documentation

Create

POST /items.json

Creates a new item.

Example Request

curl

curl --request POST \
  --url 'https://account_name.app.invoicexpress.com/items.json?api_key=YOUR%20API%20KEY%20HERE' \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{"item":{"name":"Item name","description":"Item description","unit_price":"9.99","unit":"service","tax":{"name":"IVA23"}}}'

Ruby

require 'uri'
require 'net/http'

url = URI("https://account_name.app.invoicexpress.com/items.json?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::Post.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'application/json'
request.body = "{\"item\":{\"name\":\"Item name\",\"description\":\"Item description\",\"unit_price\":\"9.99\",\"unit\":\"service\",\"tax\":{\"name\":\"IVA23\"}}}"

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

Node

var http = require("https");

var options = {
  "method": "POST",
  "hostname": "account_name.app.invoicexpress.com",
  "port": null,
  "path": "/items.json?api_key=YOUR%20API%20KEY%20HERE",
  "headers": {
    "accept": "application/json",
    "content-type": "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.write(JSON.stringify({ item:
   { name: 'Item name',
     description: 'Item description',
     unit_price: '9.99',
     unit: 'service',
     tax: { name: 'IVA23' } } }));
req.end();

Python

import http.client

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

payload = "{\"item\":{\"name\":\"Item name\",\"description\":\"Item description\",\"unit_price\":\"9.99\",\"unit\":\"service\",\"tax\":{\"name\":\"IVA23\"}}}"

headers = {
    'accept': "application/json",
    'content-type': "application/json"
    }

conn.request("POST", "/items.json?api_key=YOUR%20API%20KEY%20HERE", payload, 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/items.json?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 => "POST",
  CURLOPT_POSTFIELDS => "{\"item\":{\"name\":\"Item name\",\"description\":\"Item description\",\"unit_price\":\"9.99\",\"unit\":\"service\",\"tax\":{\"name\":\"IVA23\"}}}",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "content-type: 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"
    "strings"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://account_name.app.invoicexpress.com/items.json?api_key=YOUR%20API%20KEY%20HERE"

    payload := strings.NewReader("{\"item\":{\"name\":\"Item name\",\"description\":\"Item description\",\"unit_price\":\"9.99\",\"unit\":\"service\",\"tax\":{\"name\":\"IVA23\"}}}")

    req, _ := http.NewRequest("POST", url, payload)

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

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

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

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

}

Request Body

NameTypeRequiredDescription
itemObjectRequiredItem data to be created
nameStringRequiredName of the item. Must be unique.
descriptionStringRequiredItem’s description.
unit_priceNumberRequiredItem’s unit price. Must be a number equal or greater than 0.0.
unitStringThe item unit of measure.
taxObjectThe tax applied to the item line. If not present the default tax is applied to the item.
nameStringThe tax name to be used on this item line. If not found the default tax is applied to the line item.

Example Request Body

{
  "item": {
    "name": "Item name",
    "description": "Item description",
    "unit_price": "9.99",
    "unit": "service",
    "tax": {
      "name": "IVA23"
    }
  }
}

Responses

201SUCCESSItems Get
401ACCESS DENIED
The API Key parameter is missing or is incorrectly entered.
(Empty Response)
422UNPROCESSABLE ENTITY
Some parameters were incorrect.
(Empty Response)

Example Success Body Response

{
  "item": {
    "id": 402321,
    "name": "Medium",
    "description": "foo",
    "unit_price": 16.2602,
    "unit": "service",
    "tax": {
      "name": "IVA23",
      "value": 23,
      "comment": "tax value:23.0%"
    }
  }
}