Introduction

The API is exposed as RESTful HTTPS web service calls using JSON exchange format.
Web application URL: https://spendgate-live.appspot.com/
Base API URL: https://spendgate-live.appspot.com/api/partner/ 
API Key is passed as parameter of every request – e.g. https://spendgate-live.appspot.com/api/partner/?key=[api_key]

For each of the calls there is at least one example which explains the fields, we can provide more information if needed. Contact support@spendgate.com for assistance.

Company API
Read Company
Tax Rate API
Create Tax Rate
Read Tax Rates
Account API
Create Account
Read Accounts
Read Account
Update Account
Inventory Items API
Supplier API
Create Supplier
Read Suppliers
Read Supplier
Update Supplier
Contact API
Create Contact
Read Contacts
Read Contact
Update Contact
Invoice API
Create Invoice
Read Invoices
Read Invoice
Update Invoice

Company API

Read Company


GET https://spendgate-live.appspot.com/api/partner/company
Response:
HTTP 200|403|500
{JSON_SPENDGATE_RESPONSE}

Tax Rate API

Create Tax Rate


POST https://spendgate-live.appspot.com/api/partner/taxrates
{JSON_BODY}

Response:
HTTP 200|403|500
{JSON_SPENDGATE_RESPONSE}

Example 1:
POST https://spendgate-live.appspot.com/api/partner/taxrates
{
“key” : “001″,
“description” : “Tax on Sales”,
“rate” : 20.0
}

Response:
HTTP 200

Read Tax Rates


GET https://spendgate-live.appspot.com/api/partner/taxrates

Response:
HTTP 200|403|500
{JSON_ACCOUNT_LIST}

[ {
"key" : "001",
"id" : 166143,
"description" : "Tax on Sales",
"rate" : 20.0
},
{ … },
….
]

Account API

Create Account


POST https://spendgate-live.appspot.com/api/partner/accounts
{JSON_BODY}

Response:
HTTP 200|403|500
{JSON_SPENDGATE_RESPONSE}

Example 1:
POST https://spendgate-live.appspot.com/api/partner/accounts
{
“name” : “General Expenses”,
“key” : “$$$00001″,
“code” : “101″
}

Response:
HTTP 200
{
“id” : 222009,
“errors” : [ ],
“status” : “OK”,
“validationErrors” : [ ] }

Example 2:
POST https://spendgate-live.appspot.com/api/partner/accounts
{
“name” : “General Expenses”,
“key” : “$$$00001″,
“code” : “101″
}

Response:
HTTP 200
{
“errors” : [ ],
“status” : “ERROR”,
“validationErrors” : [ "Account with code: 101 already exists" ] }

Read Accounts


GET https://spendgate-live.appspot.com/api/partner/accounts
Response:
HTTP 200|403|500
{JSON_ACCOUNT_LIST}

Example:
GET https://spendgate-live.appspot.com/api/partner/accounts
Response:
[
{
"name" : "General Expenses",
"key" : "$$$00001",
"id" : 222009,
"code" : "101"
},
...
]

Read Account


GET https://spendgate-live.appspot.com/api/partner/accounts/{account_id}
Response:
HTTP 200|403|500
{JSON_ACCOUNT}

Example:
GET https://spendgate-live.appspot.com/api/partner/accounts/222009

Response:
{
“name” : “General Expenses”,
“key” : “$$$00001″,
“id” : 222009,
“code” : “101″
}

Update Account


POST https://spendgate-live.appspot.com/api/partner/accounts
{JSON_BODY}
Response:
HTTP 200|403|500
{JSON_SPENDGATE_RESPONSE}

Example:
POST https://spendgate-live.appspot.com/api/partner/accounts
{
“name” : “General Expenses Updated”,
“id” : 222009
}

Response:
HTTP 200
{
“key” : 222009,
“errors” : [ ],
“status” : “OK”,
“validationErrors” : [ ] }

Inventory Items API


https://spendgate-live.appspot.com/api/partner/items

Properties:
key
code
description
purchaseUnitPrice
purchaseAccountCode
salesUnitPrice
salesAccountCode

Usage: same structure of the calls as the account calls

Supplier API


Properties:

key
name
firstName
lastName
email
address1
address2
address3
city
state
zip
country
phoneNumber
faxNumber

Create Supplier


POST https://spendgate-live.appspot.com/api/partner/suppliers
{JSON_BODY}

Response:
HTTP 200|403|500
{JSON_SPENDGATE_RESPONSE}

Example 1:
POST https://spendgate-live.appspot.com/api/partner/suppliers
{
“name” : “ATME”,
“key” : “$$$10000″,
“email” : “test@atme.com”
}

Response:
HTTP 200
{
“id” : 219013,
“errors” : [ ],
“status” : “OK”,
“validationErrors” : [ ] }

Example 2:
POST https://spendgate-live.appspot.com/api/partner/suppliers
{
“name” : “ATME”,
“key” : “$$$10000″,
“email” : “test@atme.com”
}

Response:
HTTP 200
{
“errors” : [ ],
“status” : “ERROR”,
“validationErrors” : [ "Supplier with name: ATME already exists" ] }

Read Suppliers


GET https://spendgate-live.appspot.com/api/partner/suppliers?lastChangedDate={MM-dd-yyyy}

Filters:
lastChangedDate – optional query parameter that filters the results that have been modified after the date specified

Response:
HTTP 200|403|500
{JSON_SUPPLIER_LIST}

Example:
GET https://spendgate-live.appspot.com/api/partner/suppliers
Response:
[
{
"name" : "ATME",
"key" : "$$$10000",
"id" : 219013,
"email" : "test@atme.com"
},
...
]

Read Supplier


GET https://spendgate-live.appspot.com/api/partner/suppliers/{supplier_id}
Response:
HTTP 200|403|500
{JSON_BODY}

Example:
GET https://spendgate-live.appspot.com/api/partner/suppliers/219013

Response:
{
“name” : “ATME”,
“key” : “$$$10000″,
“id” : 219013,
“email” : “test@atme.com”
}

Update Supplier


POST https://spendgate-live.appspot.com/api/partner/suppliers
{JSON_BODY}
Response:
HTTP 200|403|500
{JSON_SPENDGATE_RESPONSE}

Example:
POST https://spendgate-live.appspot.com/api/partner/suppliers
{
“name” : “ATME Updated”,
“id” : 219013,
}

Response:
HTTP 200
{
“key” : 219013,
“errors” : [ ],
“status” : “OK”,
“validationErrors” : [ ] }

Contact API


Properties:

key
name
firstName
lastName
email
address1
address2
address3
city
state
zip
country
phoneNumber
faxNumber

Create Contact


POST https://spendgate-live.appspot.com/api/partner/contacts
{JSON_BODY}

Response:
HTTP 200|403|500
{JSON_SPENDGATE_RESPONSE}

Example 1:
POST https://spendgate-live.appspot.com/api/partner/contacts
{
“name” : “ATME”,
“key” : “$$$10000″,
“email” : “test@atme.com”
}

Response:
HTTP 200
{
“id” : 219013,
“errors” : [ ],
“status” : “OK”,
“validationErrors” : [ ] }

Example 2:
POST https://spendgate-live.appspot.com/api/partner/contact
{
“name” : “ATME”,
“key” : “$$$10000″,
“email” : “test@atme.com”
}

Response:
HTTP 200
{
“errors” : [ ],
“status” : “ERROR”,
“validationErrors” : [ "Contact with name: ATME already exists" ] }

Read Contacts


GET https://spendgate-live.appspot.com/api/partner/contacts?lastChangedDate={MM-dd-yyyy}

Filters:
lastChangedDate – optional query parameter that filters the results that have been modified after the date specified

Response:
HTTP 200|403|500
{JSON_CONTACT_LIST}

Example:
GET https://spendgate-live.appspot.com/api/partner/contacts
Response:
[
{
"name" : "ATME",
"key" : "$$$10000",
"id" : 219013,
"email" : "test@atme.com"
},
...
]

Read Contact


GET https://spendgate-live.appspot.com/api/partner/contacts/{contact_id}
Response:
HTTP 200|403|500
{JSON_BODY}

Example:
GET https://spendgate-live.appspot.com/api/partner/contacts/219013

Response:
{
“name” : “ATME”,
“key” : “$$$10000″,
“id” : 219013,
“email” : “test@atme.com”
}

Update Contact


POST https://spendgate-live.appspot.com/api/partner/contacts
{JSON_BODY}
Response:
HTTP 200|403|500
{JSON_SPENDGATE_RESPONSE}

Example:
POST https://spendgate-live.appspot.com/api/partner/contacts
{
“name” : “ATME Updated”,
“id” : 219013,
}

Response:
HTTP 200
{
“key” : 219013,
“errors” : [ ],
“status” : “OK”,
“validationErrors” : [ ] }

Invoice API

Create Invoice


POST https://spendgate-live.appspot.com/api/partner/invoices

Read Invoices


GET https://spendgate-live.appspot.com/api/partner/invoices?lastChangedDate={MM-dd-yyyy}&invoiceAccountingState={STATE}&invoiceType={TYPE}
Filters:
lastChangedDate – optional query parameter that filters the results that have been modified after the date specified
invoiceAccountingState – optional filter by invoice accounting state. Possible values are:

- NOT_POSTED

- POSTED
- PULLED_AWAITING – “Awaiting Payment”, // POSTED or APPROVED for SCM
- PAID – “Paid”, // Paid invoice – used in SCM
- APPROVED

- REJECTED

invoiceType – optional filter by invoice type. Possible values are – SCM and SIM. SCM maps to sales invoices, SIM to purchase invoices.

Example:
GET https://spendgate-live.appspot.com/api/partner/invoices
[ {
"key" : 113019,
"fileName" : "Filename.pdf",
"date" : "08/03/2011",
"currency" : "GBP",
"description" : "aaa",
"mimeType" : "application/pdf",
"accSystemInvoiceId" : "113019",
"refNumber" : "08031100113019",
"invoiceState" : "L2_APPROVED",
"supplier" : {
"name" : "Company Name Ltd",
"key" : "COMP001",
"id" : 167070,
"state" : "",
"country" : "",
"email" : "",
"firstName" : "John",
"lastName" : "Smith",
"address1" : "2 High Street",
"address2" : "",
"address3" : "",
"city" : "Anytown",
"zip" : "AB1 2CD",
"phoneNumber" : "0800 111 2345",
"faxNumber" : "0800 111 2346"
},
"supplierInvoiceNumber" : "INV-1234",
"documentType" : "INVOICE",
"dueDate" : "08/03/2011",
"lines" : [ {
"total" : 172.8,
"description" : "aaa",
"quantity" : 12.0,
"unitPrice" : 12.0,
"account" : {
"name" : "Materials Purchased",
"key" : "5000",
"id" : 167079,
"code" : "5000"
},
"taxName" : "Standard Rate: 20%",
"taxRate" : 20.0,
"singleTaxRate" : 20.0,
"subTotal" : 144.0,
"unitPriceBaseCurrency" : 12.0,
"subTotalBaseCurrency" : 144.0
} ],
“grandSubTotal” : 144.0,
“grandSubTotalBaseCurrency” : 144.0,
“taxTotal” : 28.8,
“taxTotalBaseCurrency” : 28.8,
“grandTotal” : 172.8,
“grandTotalBaseCurrency” : 172.8,
“submitterName” : “Super Admin”,
“invoiceAccountingState” : “APPROVED”
} ,
….
]

Read Invoice


GET https://spendgate-live.appspot.com/api/partner/invoices/{invoice_key}
Example:
Same as call above, pass the invoice key as path parameter

Update Invoice


POST https://spendgate-live.appspot.com/api/partner/invoices

Example (Update the accounting state):
POST https://spendgate-live.appspot.com/api/partner/invoices
{
“key” : 113019,
“invoiceAccountingState” : “REJECTED|APPROVED”
}