Each API query is made over secure HTTP to the following URL: www10.versaccounts.com/v1
If your account is not currently on www10.versaccounts.com, replace www10 with the actual host name you are using.
For clarity, we will give example queries using the common Linux curl command, which is available on virtually any Linux or Unix system. Versions of curl are also available on the web for other operating systems.
The structure of a query is as follows: https:/www10.versaccounts.com/v1/resource[/resource_id[/nested_resource[/nested_resource_id]]]
Square brackets indicate optional parts of the query.
- A GET request to a resource, with no other options, will return all available records of that resource in XML format.
- A POST request to a resource creates a new record of that resource type.
- A PUT request updates a resource record.
- A DELETE request deletes a resource record.
Examples
Create a new draft transaction:
$ curl -i -X POST -H "Content-Type: application/xml" --header "VERSACCOUNTS_AUTHORIZATION:409696900e0b3f5a4297e3cd5823f734f0095e66" \ -d @new_draft_transaction.xml https://www10.versaccounts.com/v1/draft_transaction.xml
This request posts the XML file new_draft_transaction.xml, which contains:
<?xml version="1.0" encoding="UTF-8"?> <draft_transaction> <transaction_date>2011-04-15 13:35:54 UTC</transaction_date> <description>My Experimental Transaction</description> </draft_transaction>Add a draft_transaction_detail to draft_transaction 2205:
$ curl -i -X POST -H "Content-Type: application/json" --header "VERSACCOUNTS_AUTHORIZATION:409696900e0b3f5a4297e3cd5823f734f0095e66" \ -d @new_draft_transaction_detail_line_1.json https://www10.versaccounts.com/v1/draft_transaction/2205/draft_transaction_detail.jsonThis request posts the XML file new_draft_transaction_detail_line_1.json, which contains: {"draft_transaction_detail":{"amount":100.0,"debit_credit_flag":false,"multiplier":1.0,"organization_gl_account_id":37162,"currency_id":"1"}} Retrieve all Organization GL Accounts in JSON format:
$ curl -i --header "VERSACCOUNTS_AUTHORIZATION:409696900e0b3f5a4297e3cd5823f734f0095e66" https://www10.versaccounts.com/v1/organization_gl_account.jsonRetrieve Organization GL Account 50333 in XML format:
$ curl -i --header "VERSACCOUNTS_AUTHORIZATION:409696900e0b3f5a4297e3cd5823f734f0095e66" https://www10.versaccounts.com/v1/organization_gl_account/50333.xmlDelete draft_transaction 405:
$ curl -i -X DELETE --header "VERSACCOUNTS_AUTHORIZATION:409696900e0b3f5a4297e3cd5823f734f0095e66" https://www10.versaccounts.com/v1/draft_transaction/405Delete draft_transaction_detail 3306, which is a line in draft_transaction 405:
$ curl -i -X DELETE --header "VERSACCOUNTS_AUTHORIZATION:409696900e0b3f5a4297e3cd5823f734f0095e66" https://www10.versaccounts.com/v1/draft_transaction/405/draft_transaction_detail/3306
Comments and Suggestions
0 comments
Please sign in to leave a comment.
Related articles