Invoice API
Examples provided in JSON. XML format is also accepted.
| URL | https://api_url/v1/invoice |
| Supported Methods | GET, POST, DELETE |
| Description | Retrieve, Create or Delete the firm's invoices |
Accepted Query Formats
.format is either xml or json| GET /invoice[.format] | retrieve all invoices |
| GET /invoice/1[.format] | retrieve invoice with ID = 1 |
| GET /invoice[.format]?customer_bill_to_id=168347&from_invoice_date=2018-08-29&to_invoice_date=2018-08-29 | retrieve invoices with filter by customer id and by date |
| DELETE /invoice/1 | delete invoice with ID = 1 |
| POST /invoice[.format] | create a new invoice |
| POST /invoice/1/reverse_invoice[.format] | Reverse a posted invoice |
| POST /invoice/1/post_invoice[.format] | Post a draft invoice |
| POST /invoice/1/mark_invoice_paid[.format] | Post a payment for the invoice |
Create invoice method.
term_id and facility_id can be nil.
curl -i -k -X POST \
https://api_url/v1/invoice.json \
-H 'Content-Type: application/json' \
-H 'VERSACCOUNTS_AUTHORIZATION: 3bc483d60c7a47423e56fe1d64dbdeaf8035a46f' \
-H 'cache-control: no-cache' \
-d '{
"invoice":
{"invoice_date":"2018-12-15",
"internal_ref":"testonref1",
"message":"test_message",
"description":"invoice description",
"customer_id":"167965",
"currency_id":"1",
"term_id": "",
"multiplier":"1",
"facility_id":"",
"invoice_items":[{"product_id":"782427",
"quantity":"1",
"item_description": "testdesc",
"measurement_unit_id":"4839",
"unit_cost":"2.00",
"amount":"0.0",
"organization_gl_account_id":"1392919"
}
]
}
}'
Add new invoice line to existing invoice
curl -i -k -X POST \
https://api_url/v1/invoice/188669/invoice_item.json \
-H 'Content-Type: application/json' \
-H 'VERSACCOUNTS_AUTHORIZATION: 3bc483d60c7a47423e56fe1d64dbdeaf8035a46f' \
-H 'cache-control: no-cache' \
-d '{
"invoice_items":
[{"product_id":"782427",
"quantity":"1",
"item_description": "testdesc",
"measurement_unit_id":"4839",
"unit_cost":"2.00",
"amount":"0.0",
"organization_gl_account_id":"1392919"
}]
}'
List invoices
curl -i -k --header "VERSACCOUNTS_AUTHORIZATION:3bc483d60c7a47423e56fe1d64dbdeaf8035a46f" https://api_url/v1/invoice.xmlList invoices with paging parameter
curl -i -k --header "VERSACCOUNTS_AUTHORIZATION:3bc483d60c7a47423e56fe1d64dbdeaf8035a46f" https://api_url/v1/invoice.xml?page=2 List invoices with filters by customer id and invoice date
curl -i -k --header "VERSACCOUNTS_AUTHORIZATION:3bc483d60c7a47423e56fe1d64dbdeaf8035a46f" 'https://api_url/v1/invoice.xml?customer_bill_to_id=168347&from_invoice_date=2018-08-29&to_invoice_date=2018-08-29'
Get a Link to View Invoice
Get a link for anyone with the link to view the invoice (read only)
curl -i -k --header "VERSACCOUNTS_AUTHORIZATION:3bc483d60c7a47423e56fe1d64dbdeaf8035a46f" https://api_url/v1/invoice/123/invoice_link
Update invoice (no line item update)
curl -i -k -X PUT \
https://api_url/v1/invoice/188669.json \
-H 'Content-Type: application/json' \
-H 'VERSACCOUNTS_AUTHORIZATION: 3bc483d60c7a47423e56fe1d64dbdeaf8035a46f' \
-H 'cache-control: no-cache' \
-d '{
"invoice":
{"invoice_date":"2018-12-15",
"internal_ref":"testonref12",
"message":"test_message",
"description":"invoice description",
"customer_id":"167965",
"currency_id":"1",
"multiplier":"1"
}
}'
Delete an invoice Delete an invoice that is not posted
curl -i -k -X DELETE --header "VERSACCOUNTS_AUTHORIZATION:3bc483d60c7a47423e56fe1d64dbdeaf8035a46f" 'https://api_url/v1/invoice/188669.json'Delete invoice item
curl -i -k -X DELETE --header "VERSACCOUNTS_AUTHORIZATION:3bc483d60c7a47423e56fe1d64dbdeaf8035a46f" 'https://api_url/v1/invoice/188669/invoice_item/418477.json'Reverse invoice for posted invoice
curl -i -k --header "Content-Type: application/json" \ --request POST \ --header "VERSACCOUNTS_AUTHORIZATION:3bc483d60c7a47423e56fe1d64dbdeaf8035a46f" \ https://api_url/v1/invoice/170385/reverse_invoice.jsonPost an invoice
curl -i -k --header "Content-Type: application/json" \ --request POST \ --header "VERSACCOUNTS_AUTHORIZATION:3bc483d60c7a47423e56fe1d64dbdeaf8035a46f" \ https://api_url/v1/invoice/170385/post_invoice.jsonMark an invoice as paid
curl -i -k --header "Content-Type: application/json" \ --request POST \ --header "VERSACCOUNTS_AUTHORIZATION:3bc483d60c7a47423e56fe1d64dbdeaf8035a46f" \ https://api_urlv1/invoice/170385/mark_invoice_paid.json?payment_method_type_id=1&organization_gl_account_id=2
Comments and Suggestions
0 comments
Please sign in to leave a comment.
Related articles