SQL Server / New FreshBooks / Create Expense with Receipt
Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
-- Use this online tool to generate code from sample JSON: Generate Code to Create JSON
-- The following JSON is sent in the request body.
-- {
-- "expense": {
-- "transactionid": null,
-- "status": null,
-- "has_receipt": false,
-- "always_remember": false,
-- "is_cogs": false,
-- "account_name": null,
-- "include_receipt": false,
-- "amount": {
-- "amount": "79.73",
-- "code": "USD"
-- },
-- "notes": "Purchased Gasoline for deliveries",
-- "vendor": "Shell Gas Station",
-- "date": "2019-04-24",
-- "staffid": 1,
-- "author_name": null,
-- "taxName1": "other tax",
-- "taxName2": null,
-- "taxAmount1": {
-- "amount": "9.17",
-- "code": "USD"
-- },
-- "taxPercent1": 13,
-- "taxPercent2": null,
-- "markup_percent": null,
-- "invoiceid": null,
-- "attachment": {
-- "jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY2NvdW50Ijo0MjM2NDEwLCJvcmlnaW5hbF9maWxlbmFtZSI6IlNjcmVlbiBTaG90IDIwMTktMDQtMjQgYXQgOS4zOS4xOSBBTS5wbmciLCJidWNrZXQiOiJ1cGxvYWRzIiwiZmlsZW5hbWUiOiJ1cGxvYWQtMGU2ZDMwOWQ1ZTI5MzA3NmNhMGIyNDdkODFlOGJlNWE4NDZlZWE0YSIsImxlbmd0aCI6MTkxNDcyLCJrZXkiOiInZG9jcy0nLTQyMzY0MTAvdXBsb2FkLTBlNmQzMDlkNWUyOTMwNzZjYTBiMjQ3ZDgxZThiZTVhODQ2ZWVhNGEifQ.SOoW3_nTUrxjYO76g1UXHPIrO_aLbTpXCHEa-ZcnejA",
-- "media_type": "image/png",
-- "expenseid": null
-- },
-- "categoryid": "2003174",
-- "clientid": null
-- }
-- }
DECLARE @json int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @json OUT
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'expense.transactionid'
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'expense.status'
EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'expense.has_receipt', 0
EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'expense.always_remember', 0
EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'expense.is_cogs', 0
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'expense.account_name'
EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'expense.include_receipt', 0
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'expense.amount.amount', '79.73'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'expense.amount.code', 'USD'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'expense.notes', 'Purchased Gasoline for deliveries'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'expense.vendor', 'Shell Gas Station'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'expense.date', '2019-04-24'
EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'expense.staffid', 1
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'expense.author_name'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'expense.taxName1', 'other tax'
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'expense.taxName2'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'expense.taxAmount1.amount', '9.17'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'expense.taxAmount1.code', 'USD'
EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'expense.taxPercent1', 13
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'expense.taxPercent2'
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'expense.markup_percent'
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'expense.invoiceid'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'expense.attachment.jwt', 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY2NvdW50Ijo0MjM2NDEwLCJvcmlnaW5hbF9maWxlbmFtZSI6IlNjcmVlbiBTaG90IDIwMTktMDQtMjQgYXQgOS4zOS4xOSBBTS5wbmciLCJidWNrZXQiOiJ1cGxvYWRzIiwiZmlsZW5hbWUiOiJ1cGxvYWQtMGU2ZDMwOWQ1ZTI5MzA3NmNhMGIyNDdkODFlOGJlNWE4NDZlZWE0YSIsImxlbmd0aCI6MTkxNDcyLCJrZXkiOiInZG9jcy0nLTQyMzY0MTAvdXBsb2FkLTBlNmQzMDlkNWUyOTMwNzZjYTBiMjQ3ZDgxZThiZTVhODQ2ZWVhNGEifQ.SOoW3_nTUrxjYO76g1UXHPIrO_aLbTpXCHEa-ZcnejA'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'expense.attachment.media_type', 'image/png'
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'expense.attachment.expenseid'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'expense.categoryid', '2003174'
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'expense.clientid'
-- Adds the "Authorization: Bearer <access_token>" header.
EXEC sp_OASetProperty @http, 'AuthToken', '<access_token>'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Content-Type', 'application/json'
DECLARE @resp int
EXEC sp_OAMethod @http, 'PostJson3', @resp OUT, 'https://api.freshbooks.com/accounting/account/{{accountId}}/expenses/expenses?include%5B%5D=attachment', 'application/json', @json
EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
IF @iTmp0 = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
RETURN
END
DECLARE @sbResponseBody int
-- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT
EXEC sp_OAMethod @resp, 'GetBodySb', @success OUT, @sbResponseBody
DECLARE @jResp int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @jResp OUT
EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody
EXEC sp_OASetProperty @jResp, 'EmitCompact', 0
PRINT 'Response Body:'
EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT
PRINT @sTmp0
DECLARE @respStatusCode int
EXEC sp_OAGetProperty @resp, 'StatusCode', @respStatusCode OUT
PRINT 'Response Status Code = ' + @respStatusCode
IF @respStatusCode >= 400
BEGIN
PRINT 'Response Header:'
EXEC sp_OAGetProperty @resp, 'Header', @sTmp0 OUT
PRINT @sTmp0
PRINT 'Failed.'
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
RETURN
END
EXEC @hr = sp_OADestroy @resp
-- Sample JSON response:
-- (Sample code for parsing the JSON response is shown below)
-- {
-- "response": {
-- "result": {
-- "expense": {
-- "account_name": "",
-- "accountid": null,
-- "accounting_systemid": "wkMd2g",
-- "amount": {
-- "amount": "79.73",
-- "code": "USD"
-- },
-- "attachment": {
-- "attachmentid": 8670,
-- "id": 8670,
-- "jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY2NvdW50Ijo0MjM2NDEwLCJvcmlnaW5hbF9maWxlbmFtZSI6IlNjcmVlbiBTaG90IDIwMTktMDQtMjQgYXQgOS4zOS4xOSBBTS5wbmciLCJidWNrZXQiOiJ1cGxvYWRzIiwiZmlsZW5hbWUiOiJ1cGxvYWQtMGU2ZDMwOWQ1ZTI5MzA3NmNhMGIyNDdkODFlOGJlNWE4NDZlZWE0YSIsImxlbmd0aCI6MTkxNDcyLCJrZXkiOiInZG9jcy0nLTQyMzY0MTAvdXBsb2FkLTBlNmQzMDlkNWUyOTMwNzZjYTBiMjQ3ZDgxZThiZTVhODQ2ZWVhNGEifQ.SOoW3_nTUrxjYO76g1UXHPIrO_aLbTpXCHEa-ZcnejA",
-- "media_type": "image/png"
-- },
-- "background_jobid": null,
-- "bank_name": "",
-- "categoryid": 2003174,
-- "clientid": 0,
-- "compounded_tax": false,
-- "date": "2019-04-24",
-- "expenseid": 1825574,
-- "ext_invoiceid": 0,
-- "ext_systemid": 0,
-- "from_bulk_import": false,
-- "has_receipt": true,
-- "id": 1825574,
-- "include_receipt": false,
-- "invoiceid": null,
-- "is_cogs": false,
-- "isduplicate": true,
-- "markup_percent": "0",
-- "notes": "Purchased Gasoline for deliveries",
-- "profileid": null,
-- "projectid": 0,
-- "staffid": 1,
-- "status": 0,
-- "taxAmount1": {
-- "amount": "9.17",
-- "code": "USD"
-- },
-- "taxAmount2": null,
-- "taxName1": "other tax",
-- "taxName2": null,
-- "taxPercent1": "13",
-- "taxPercent2": null,
-- "transactionid": null,
-- "updated": "2019-04-24 11:33:35",
-- "vendor": "Shell Gas Station",
-- "vis_state": 0
-- }
-- }
-- }
-- }
-- Sample code for parsing the JSON response...
-- Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
DECLARE @Account_name nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Account_name OUT, 'response.result.expense.account_name'
DECLARE @Accountid nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Accountid OUT, 'response.result.expense.accountid'
DECLARE @Accounting_systemid nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Accounting_systemid OUT, 'response.result.expense.accounting_systemid'
DECLARE @Amount nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Amount OUT, 'response.result.expense.amount.amount'
DECLARE @Code nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Code OUT, 'response.result.expense.amount.code'
DECLARE @Attachmentid int
EXEC sp_OAMethod @jResp, 'IntOf', @Attachmentid OUT, 'response.result.expense.attachment.attachmentid'
DECLARE @Id int
EXEC sp_OAMethod @jResp, 'IntOf', @Id OUT, 'response.result.expense.attachment.id'
DECLARE @v_Jwt nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @v_Jwt OUT, 'response.result.expense.attachment.jwt'
DECLARE @Media_type nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Media_type OUT, 'response.result.expense.attachment.media_type'
DECLARE @Background_jobid nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Background_jobid OUT, 'response.result.expense.background_jobid'
DECLARE @Bank_name nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Bank_name OUT, 'response.result.expense.bank_name'
DECLARE @Categoryid int
EXEC sp_OAMethod @jResp, 'IntOf', @Categoryid OUT, 'response.result.expense.categoryid'
DECLARE @Clientid int
EXEC sp_OAMethod @jResp, 'IntOf', @Clientid OUT, 'response.result.expense.clientid'
DECLARE @Compounded_tax int
EXEC sp_OAMethod @jResp, 'BoolOf', @Compounded_tax OUT, 'response.result.expense.compounded_tax'
DECLARE @Date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Date OUT, 'response.result.expense.date'
DECLARE @Expenseid int
EXEC sp_OAMethod @jResp, 'IntOf', @Expenseid OUT, 'response.result.expense.expenseid'
DECLARE @Ext_invoiceid int
EXEC sp_OAMethod @jResp, 'IntOf', @Ext_invoiceid OUT, 'response.result.expense.ext_invoiceid'
DECLARE @Ext_systemid int
EXEC sp_OAMethod @jResp, 'IntOf', @Ext_systemid OUT, 'response.result.expense.ext_systemid'
DECLARE @From_bulk_import int
EXEC sp_OAMethod @jResp, 'BoolOf', @From_bulk_import OUT, 'response.result.expense.from_bulk_import'
DECLARE @Has_receipt int
EXEC sp_OAMethod @jResp, 'BoolOf', @Has_receipt OUT, 'response.result.expense.has_receipt'
DECLARE @ExpenseId int
EXEC sp_OAMethod @jResp, 'IntOf', @ExpenseId OUT, 'response.result.expense.id'
DECLARE @Include_receipt int
EXEC sp_OAMethod @jResp, 'BoolOf', @Include_receipt OUT, 'response.result.expense.include_receipt'
DECLARE @Invoiceid nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Invoiceid OUT, 'response.result.expense.invoiceid'
DECLARE @Is_cogs int
EXEC sp_OAMethod @jResp, 'BoolOf', @Is_cogs OUT, 'response.result.expense.is_cogs'
DECLARE @Isduplicate int
EXEC sp_OAMethod @jResp, 'BoolOf', @Isduplicate OUT, 'response.result.expense.isduplicate'
DECLARE @Markup_percent nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Markup_percent OUT, 'response.result.expense.markup_percent'
DECLARE @Notes nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Notes OUT, 'response.result.expense.notes'
DECLARE @Profileid nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Profileid OUT, 'response.result.expense.profileid'
DECLARE @Projectid int
EXEC sp_OAMethod @jResp, 'IntOf', @Projectid OUT, 'response.result.expense.projectid'
DECLARE @Staffid int
EXEC sp_OAMethod @jResp, 'IntOf', @Staffid OUT, 'response.result.expense.staffid'
DECLARE @Status int
EXEC sp_OAMethod @jResp, 'IntOf', @Status OUT, 'response.result.expense.status'
DECLARE @TaxAmount1Amount nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @TaxAmount1Amount OUT, 'response.result.expense.taxAmount1.amount'
DECLARE @TaxAmount1Code nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @TaxAmount1Code OUT, 'response.result.expense.taxAmount1.code'
DECLARE @TaxAmount2 nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @TaxAmount2 OUT, 'response.result.expense.taxAmount2'
DECLARE @TaxName1 nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @TaxName1 OUT, 'response.result.expense.taxName1'
DECLARE @TaxName2 nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @TaxName2 OUT, 'response.result.expense.taxName2'
DECLARE @TaxPercent1 nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @TaxPercent1 OUT, 'response.result.expense.taxPercent1'
DECLARE @TaxPercent2 nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @TaxPercent2 OUT, 'response.result.expense.taxPercent2'
DECLARE @Transactionid nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Transactionid OUT, 'response.result.expense.transactionid'
DECLARE @Updated nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Updated OUT, 'response.result.expense.updated'
DECLARE @Vendor nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Vendor OUT, 'response.result.expense.vendor'
DECLARE @Vis_state int
EXEC sp_OAMethod @jResp, 'IntOf', @Vis_state OUT, 'response.result.expense.vis_state'
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
END
GO
Curl Command
curl -X POST
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
-d '{
"expense": {
"transactionid": null,
"status": null,
"has_receipt": false,
"always_remember": false,
"is_cogs": false,
"account_name": null,
"include_receipt": false,
"amount": {
"amount": "79.73",
"code": "USD"
},
"notes": "Purchased Gasoline for deliveries",
"vendor": "Shell Gas Station",
"date": "2019-04-24",
"staffid": 1,
"author_name": null,
"taxName1": "other tax",
"taxName2": null,
"taxAmount1": {
"amount": "9.17",
"code": "USD"
},
"taxPercent1": 13,
"taxPercent2": null,
"markup_percent": null,
"invoiceid": null,
"attachment": {
"jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY2NvdW50Ijo0MjM2NDEwLCJvcmlnaW5hbF9maWxlbmFtZSI6IlNjcmVlbiBTaG90IDIwMTktMDQtMjQgYXQgOS4zOS4xOSBBTS5wbmciLCJidWNrZXQiOiJ1cGxvYWRzIiwiZmlsZW5hbWUiOiJ1cGxvYWQtMGU2ZDMwOWQ1ZTI5MzA3NmNhMGIyNDdkODFlOGJlNWE4NDZlZWE0YSIsImxlbmd0aCI6MTkxNDcyLCJrZXkiOiInZG9jcy0nLTQyMzY0MTAvdXBsb2FkLTBlNmQzMDlkNWUyOTMwNzZjYTBiMjQ3ZDgxZThiZTVhODQ2ZWVhNGEifQ.SOoW3_nTUrxjYO76g1UXHPIrO_aLbTpXCHEa-ZcnejA",
"media_type": "image/png",
"expenseid": null
},
"categoryid": "2003174",
"clientid": null
}
}'
https://api.freshbooks.com/accounting/account/{{accountId}}/expenses/expenses?include%5B%5D=attachment
Postman Collection Item JSON
{
"name": "Create Expense with Receipt",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"expense\": {\n \"transactionid\": null,\n \"status\": null,\n \"has_receipt\": false,\n \"always_remember\": false,\n \"is_cogs\": false,\n \"account_name\": null,\n \"include_receipt\": false,\n \"amount\": {\n \"amount\": \"79.73\",\n \"code\": \"USD\"\n },\n \"notes\": \"Purchased Gasoline for deliveries\",\n \"vendor\": \"Shell Gas Station\",\n \"date\": \"2019-04-24\",\n \"staffid\": 1,\n \"author_name\": null,\n \"taxName1\": \"other tax\",\n \"taxName2\": null,\n \"taxAmount1\": {\n \"amount\": \"9.17\",\n \"code\": \"USD\"\n },\n \"taxPercent1\": 13,\n \"taxPercent2\": null,\n \"markup_percent\": null,\n \"invoiceid\": null,\n \"attachment\": {\n \"jwt\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY2NvdW50Ijo0MjM2NDEwLCJvcmlnaW5hbF9maWxlbmFtZSI6IlNjcmVlbiBTaG90IDIwMTktMDQtMjQgYXQgOS4zOS4xOSBBTS5wbmciLCJidWNrZXQiOiJ1cGxvYWRzIiwiZmlsZW5hbWUiOiJ1cGxvYWQtMGU2ZDMwOWQ1ZTI5MzA3NmNhMGIyNDdkODFlOGJlNWE4NDZlZWE0YSIsImxlbmd0aCI6MTkxNDcyLCJrZXkiOiInZG9jcy0nLTQyMzY0MTAvdXBsb2FkLTBlNmQzMDlkNWUyOTMwNzZjYTBiMjQ3ZDgxZThiZTVhODQ2ZWVhNGEifQ.SOoW3_nTUrxjYO76g1UXHPIrO_aLbTpXCHEa-ZcnejA\",\n \"media_type\": \"image/png\",\n \"expenseid\": null\n },\n \"categoryid\": \"2003174\",\n \"clientid\": null\n }\n}"
},
"url": {
"raw": "https://api.freshbooks.com/accounting/account/{{accountId}}/expenses/expenses?include%5B%5D=attachment",
"protocol": "https",
"host": [
"api",
"freshbooks",
"com"
],
"path": [
"accounting",
"account",
"{{accountId}}",
"expenses",
"expenses"
],
"query": [
{
"key": "include%5B%5D",
"value": "attachment"
}
]
},
"description": "In order to create an expense with a receipt, you will first need to upload your image via the uploader endpoint. Once you receive a response, you can apply that `jwt` token to your expense under the nested `attachment` object. Look at the example on the right. "
},
"response": [
{
"name": "Create Expense",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"expense\": {\n \"transactionid\": null,\n \"status\": null,\n \"has_receipt\": false,\n \"always_remember\": false,\n \"is_cogs\": false,\n \"account_name\": null,\n \"include_receipt\": false,\n \"amount\": {\n \"amount\": \"79.73\",\n \"code\": \"USD\"\n },\n \"notes\": \"Purchased Gasoline for deliveries\",\n \"vendor\": \"Shell Gas Station\",\n \"date\": \"2019-04-24\",\n \"staffid\": 1,\n \"author_name\": null,\n \"taxName1\": \"other tax\",\n \"taxName2\": null,\n \"taxAmount1\": {\n \"amount\": \"9.17\",\n \"code\": \"USD\"\n },\n \"taxPercent1\": 13,\n \"taxPercent2\": null,\n \"markup_percent\": null,\n \"invoiceid\": null,\n \"attachment\": {\n \"jwt\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY2NvdW50Ijo0MjM2NDEwLCJvcmlnaW5hbF9maWxlbmFtZSI6IlNjcmVlbiBTaG90IDIwMTktMDQtMjQgYXQgOS4zOS4xOSBBTS5wbmciLCJidWNrZXQiOiJ1cGxvYWRzIiwiZmlsZW5hbWUiOiJ1cGxvYWQtMGU2ZDMwOWQ1ZTI5MzA3NmNhMGIyNDdkODFlOGJlNWE4NDZlZWE0YSIsImxlbmd0aCI6MTkxNDcyLCJrZXkiOiInZG9jcy0nLTQyMzY0MTAvdXBsb2FkLTBlNmQzMDlkNWUyOTMwNzZjYTBiMjQ3ZDgxZThiZTVhODQ2ZWVhNGEifQ.SOoW3_nTUrxjYO76g1UXHPIrO_aLbTpXCHEa-ZcnejA\",\n \"media_type\": \"image/png\",\n \"expenseid\": null\n },\n \"categoryid\": \"2003174\",\n \"clientid\": null\n }\n}"
},
"url": {
"raw": "https://api.freshbooks.com/accounting/account/{{accountId}}/expenses/expenses?include%5B%5D=attachment",
"protocol": "https",
"host": [
"api",
"freshbooks",
"com"
],
"path": [
"accounting",
"account",
"{{accountId}}",
"expenses",
"expenses"
],
"query": [
{
"key": "include%5B%5D",
"value": "attachment"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "nginx"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-NewRelic-App-Data",
"value": "PxQBWV5TCBABVlVSAwEOVlcTGhE1AwE2QgNWEVlbQFtcCxYnRA9QFg1ZWU4DFVdfRgFPCkNFR0gBSUZWDBUGEQoHQBJdVkdXQEcVUR1RHVBVBQBZU1UMCwNQVFsDBgVRSAAFBVBKQVFWUwEACAkBCgJcCFQBAAtASFBWDRUGZQ=="
},
{
"key": "Access-Control-Allow-Origin",
"value": "*"
},
{
"key": "Expires",
"value": "Tue, 24 Apr 2018 15:33:35 GMT"
},
{
"key": "Cache-Control",
"value": "no-cache"
},
{
"key": "Content-Encoding",
"value": "gzip"
},
{
"key": "Via",
"value": "1.1 google"
},
{
"key": "Via",
"value": "1.1 varnish"
},
{
"key": "Transfer-Encoding",
"value": "chunked"
},
{
"key": "Accept-Ranges",
"value": "bytes"
},
{
"key": "Date",
"value": "Wed, 24 Apr 2019 15:33:35 GMT"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "X-Served-By",
"value": "cache-jfk8129-JFK"
},
{
"key": "X-Cache",
"value": "MISS"
},
{
"key": "X-Cache-Hits",
"value": "0"
},
{
"key": "Vary",
"value": "Accept-Encoding"
},
{
"key": "Country",
"value": "CA"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=31536000; includeSubDomains; preload"
}
],
"cookie": [
],
"body": "{\n \"response\": {\n \"result\": {\n \"expense\": {\n \"account_name\": \"\",\n \"accountid\": null,\n \"accounting_systemid\": \"wkMd2g\",\n \"amount\": {\n \"amount\": \"79.73\",\n \"code\": \"USD\"\n },\n \"attachment\": {\n \"attachmentid\": 8670,\n \"id\": 8670,\n \"jwt\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY2NvdW50Ijo0MjM2NDEwLCJvcmlnaW5hbF9maWxlbmFtZSI6IlNjcmVlbiBTaG90IDIwMTktMDQtMjQgYXQgOS4zOS4xOSBBTS5wbmciLCJidWNrZXQiOiJ1cGxvYWRzIiwiZmlsZW5hbWUiOiJ1cGxvYWQtMGU2ZDMwOWQ1ZTI5MzA3NmNhMGIyNDdkODFlOGJlNWE4NDZlZWE0YSIsImxlbmd0aCI6MTkxNDcyLCJrZXkiOiInZG9jcy0nLTQyMzY0MTAvdXBsb2FkLTBlNmQzMDlkNWUyOTMwNzZjYTBiMjQ3ZDgxZThiZTVhODQ2ZWVhNGEifQ.SOoW3_nTUrxjYO76g1UXHPIrO_aLbTpXCHEa-ZcnejA\",\n \"media_type\": \"image/png\"\n },\n \"background_jobid\": null,\n \"bank_name\": \"\",\n \"categoryid\": 2003174,\n \"clientid\": 0,\n \"compounded_tax\": false,\n \"date\": \"2019-04-24\",\n \"expenseid\": 1825574,\n \"ext_invoiceid\": 0,\n \"ext_systemid\": 0,\n \"from_bulk_import\": false,\n \"has_receipt\": true,\n \"id\": 1825574,\n \"include_receipt\": false,\n \"invoiceid\": null,\n \"is_cogs\": false,\n \"isduplicate\": true,\n \"markup_percent\": \"0\",\n \"notes\": \"Purchased Gasoline for deliveries\",\n \"profileid\": null,\n \"projectid\": 0,\n \"staffid\": 1,\n \"status\": 0,\n \"taxAmount1\": {\n \"amount\": \"9.17\",\n \"code\": \"USD\"\n },\n \"taxAmount2\": null,\n \"taxName1\": \"other tax\",\n \"taxName2\": null,\n \"taxPercent1\": \"13\",\n \"taxPercent2\": null,\n \"transactionid\": null,\n \"updated\": \"2019-04-24 11:33:35\",\n \"vendor\": \"Shell Gas Station\",\n \"vis_state\": 0\n }\n }\n }\n}"
}
]
}