SQL Server / New FreshBooks / Add Bill from Vendor
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.
-- {
-- "bill": {
-- "vendorid": "5",
-- "previous_vendor_id": null,
-- "bill_number": null,
-- "issue_date": "2020-10-09",
-- "due_offset_days": 39,
-- "currency_code": "USD",
-- "language": "en",
-- "lines": [
-- {
-- "tax_percent1": null,
-- "tax_percent2": null,
-- "unit_cost": {
-- "amount": "125",
-- "code": "USD"
-- },
-- "description": "Malm Side Table",
-- "tax_name1": null,
-- "quantity": 1,
-- "tax_name2": null,
-- "compounded_tax": false,
-- "categoryid": "65773"
-- },
-- {
-- "tax_percent1": null,
-- "tax_percent2": null,
-- "unit_cost": {
-- "amount": "250",
-- "code": "USD"
-- },
-- "description": "Malm Book Shelf",
-- "tax_name1": null,
-- "quantity": 1,
-- "tax_name2": null,
-- "compounded_tax": false,
-- "categoryid": "65773"
-- }
-- ],
-- "attachment": 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, 'UpdateString', @success OUT, 'bill.vendorid', '5'
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'bill.previous_vendor_id'
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'bill.bill_number'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'bill.issue_date', '2020-10-09'
EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'bill.due_offset_days', 39
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'bill.currency_code', 'USD'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'bill.language', 'en'
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'bill.lines[0].tax_percent1'
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'bill.lines[0].tax_percent2'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'bill.lines[0].unit_cost.amount', '125'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'bill.lines[0].unit_cost.code', 'USD'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'bill.lines[0].description', 'Malm Side Table'
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'bill.lines[0].tax_name1'
EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'bill.lines[0].quantity', 1
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'bill.lines[0].tax_name2'
EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'bill.lines[0].compounded_tax', 0
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'bill.lines[0].categoryid', '65773'
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'bill.lines[1].tax_percent1'
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'bill.lines[1].tax_percent2'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'bill.lines[1].unit_cost.amount', '250'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'bill.lines[1].unit_cost.code', 'USD'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'bill.lines[1].description', 'Malm Book Shelf'
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'bill.lines[1].tax_name1'
EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'bill.lines[1].quantity', 1
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'bill.lines[1].tax_name2'
EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'bill.lines[1].compounded_tax', 0
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'bill.lines[1].categoryid', '65773'
EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'bill.attachment'
-- Adds the "Authorization: Bearer <access_token>" header.
EXEC sp_OASetProperty @http, 'AuthToken', '<access_token>'
DECLARE @resp int
EXEC sp_OAMethod @http, 'PostJson3', @resp OUT, 'https://api.freshbooks.com/accounting/account/{{accountId}}/bills/bills', '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": {
-- "bill": {
-- "amount": {
-- "amount": "375.00",
-- "code": "USD"
-- },
-- "attachment": null,
-- "bill_number": null,
-- "bill_payments": [
-- ],
-- "created_at": "2020-10-09 15:28:49",
-- "currency_code": "USD",
-- "due_date": "2020-11-17",
-- "due_offset_days": 39,
-- "id": 7,
-- "issue_date": "2020-10-09",
-- "language": "en",
-- "lines": [
-- {
-- "amount": {
-- "amount": "125.00",
-- "code": "USD"
-- },
-- "category": {
-- "category": "Office Expenses & Postage",
-- "categoryid": 65773,
-- "created_at": "2016-11-17 14:22:35",
-- "id": 65773,
-- "is_cogs": false,
-- "is_editable": false,
-- "parentid": null,
-- "updated_at": "2016-11-17 14:22:35",
-- "vis_state": 0
-- },
-- "description": "Malm Side Table",
-- "id": 13,
-- "list_index": 1,
-- "quantity": "1",
-- "tax_amount1": null,
-- "tax_amount2": null,
-- "tax_authorityid1": null,
-- "tax_authorityid2": null,
-- "tax_name1": null,
-- "tax_name2": null,
-- "tax_percent1": null,
-- "tax_percent2": null,
-- "total_amount": {
-- "amount": "125.00",
-- "code": "USD"
-- },
-- "unit_cost": {
-- "amount": "125.00",
-- "code": "USD"
-- }
-- },
-- {
-- "amount": {
-- "amount": "250.00",
-- "code": "USD"
-- },
-- "category": {
-- "category": "Office Expenses & Postage",
-- "categoryid": 65773,
-- "created_at": "2016-11-17 14:22:35",
-- "id": 65773,
-- "is_cogs": false,
-- "is_editable": false,
-- "parentid": null,
-- "updated_at": "2016-11-17 14:22:35",
-- "vis_state": 0
-- },
-- "description": "Malm Book Shelf",
-- "id": 15,
-- "list_index": 2,
-- "quantity": "1",
-- "tax_amount1": null,
-- "tax_amount2": null,
-- "tax_authorityid1": null,
-- "tax_authorityid2": null,
-- "tax_name1": null,
-- "tax_name2": null,
-- "tax_percent1": null,
-- "tax_percent2": null,
-- "total_amount": {
-- "amount": "250.00",
-- "code": "USD"
-- },
-- "unit_cost": {
-- "amount": "250.00",
-- "code": "USD"
-- }
-- }
-- ],
-- "outstanding": {
-- "amount": "375.00",
-- "code": "USD"
-- },
-- "overall_category": "Office Expenses & Postage",
-- "overall_description": "Malm Side Table",
-- "paid": {
-- "amount": "0.00",
-- "code": "USD"
-- },
-- "status": "unpaid",
-- "tax_amount": {
-- "amount": "0.00",
-- "code": "USD"
-- },
-- "total_amount": {
-- "amount": "375.00",
-- "code": "USD"
-- },
-- "updated_at": "2020-10-09 15:28:49",
-- "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 @amountAmount nvarchar(4000)
DECLARE @amountCode nvarchar(4000)
DECLARE @Category nvarchar(4000)
DECLARE @Categoryid int
DECLARE @categoryCreated_at nvarchar(4000)
DECLARE @categoryId int
DECLARE @Is_cogs int
DECLARE @Is_editable int
DECLARE @Parentid nvarchar(4000)
DECLARE @categoryUpdated_at nvarchar(4000)
DECLARE @categoryVis_state int
DECLARE @description nvarchar(4000)
DECLARE @id int
DECLARE @list_index int
DECLARE @quantity nvarchar(4000)
DECLARE @tax_amount1 nvarchar(4000)
DECLARE @tax_amount2 nvarchar(4000)
DECLARE @tax_authorityid1 nvarchar(4000)
DECLARE @tax_authorityid2 nvarchar(4000)
DECLARE @tax_name1 nvarchar(4000)
DECLARE @tax_name2 nvarchar(4000)
DECLARE @tax_percent1 nvarchar(4000)
DECLARE @tax_percent2 nvarchar(4000)
DECLARE @total_amountAmount nvarchar(4000)
DECLARE @total_amountCode nvarchar(4000)
DECLARE @unit_costAmount nvarchar(4000)
DECLARE @unit_costCode nvarchar(4000)
DECLARE @Amount nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Amount OUT, 'response.result.bill.amount.amount'
DECLARE @Code nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Code OUT, 'response.result.bill.amount.code'
DECLARE @Attachment nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Attachment OUT, 'response.result.bill.attachment'
DECLARE @Bill_number nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Bill_number OUT, 'response.result.bill.bill_number'
DECLARE @Created_at nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Created_at OUT, 'response.result.bill.created_at'
DECLARE @Currency_code nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Currency_code OUT, 'response.result.bill.currency_code'
DECLARE @Due_date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Due_date OUT, 'response.result.bill.due_date'
DECLARE @Due_offset_days int
EXEC sp_OAMethod @jResp, 'IntOf', @Due_offset_days OUT, 'response.result.bill.due_offset_days'
DECLARE @Id int
EXEC sp_OAMethod @jResp, 'IntOf', @Id OUT, 'response.result.bill.id'
DECLARE @Issue_date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Issue_date OUT, 'response.result.bill.issue_date'
DECLARE @Language nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Language OUT, 'response.result.bill.language'
DECLARE @OutstandingAmount nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @OutstandingAmount OUT, 'response.result.bill.outstanding.amount'
DECLARE @OutstandingCode nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @OutstandingCode OUT, 'response.result.bill.outstanding.code'
DECLARE @Overall_category nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Overall_category OUT, 'response.result.bill.overall_category'
DECLARE @Overall_description nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Overall_description OUT, 'response.result.bill.overall_description'
DECLARE @PaidAmount nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @PaidAmount OUT, 'response.result.bill.paid.amount'
DECLARE @PaidCode nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @PaidCode OUT, 'response.result.bill.paid.code'
DECLARE @Status nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Status OUT, 'response.result.bill.status'
DECLARE @Tax_amountAmount nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Tax_amountAmount OUT, 'response.result.bill.tax_amount.amount'
DECLARE @Tax_amountCode nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Tax_amountCode OUT, 'response.result.bill.tax_amount.code'
DECLARE @Total_amountAmount nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Total_amountAmount OUT, 'response.result.bill.total_amount.amount'
DECLARE @Total_amountCode nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Total_amountCode OUT, 'response.result.bill.total_amount.code'
DECLARE @Updated_at nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Updated_at OUT, 'response.result.bill.updated_at'
DECLARE @Vis_state int
EXEC sp_OAMethod @jResp, 'IntOf', @Vis_state OUT, 'response.result.bill.vis_state'
DECLARE @i int
SELECT @i = 0
DECLARE @count_i int
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'response.result.bill.bill_payments'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'response.result.bill.lines'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'StringOf', @amountAmount OUT, 'response.result.bill.lines[i].amount.amount'
EXEC sp_OAMethod @jResp, 'StringOf', @amountCode OUT, 'response.result.bill.lines[i].amount.code'
EXEC sp_OAMethod @jResp, 'StringOf', @Category OUT, 'response.result.bill.lines[i].category.category'
EXEC sp_OAMethod @jResp, 'IntOf', @Categoryid OUT, 'response.result.bill.lines[i].category.categoryid'
EXEC sp_OAMethod @jResp, 'StringOf', @categoryCreated_at OUT, 'response.result.bill.lines[i].category.created_at'
EXEC sp_OAMethod @jResp, 'IntOf', @categoryId OUT, 'response.result.bill.lines[i].category.id'
EXEC sp_OAMethod @jResp, 'BoolOf', @Is_cogs OUT, 'response.result.bill.lines[i].category.is_cogs'
EXEC sp_OAMethod @jResp, 'BoolOf', @Is_editable OUT, 'response.result.bill.lines[i].category.is_editable'
EXEC sp_OAMethod @jResp, 'StringOf', @Parentid OUT, 'response.result.bill.lines[i].category.parentid'
EXEC sp_OAMethod @jResp, 'StringOf', @categoryUpdated_at OUT, 'response.result.bill.lines[i].category.updated_at'
EXEC sp_OAMethod @jResp, 'IntOf', @categoryVis_state OUT, 'response.result.bill.lines[i].category.vis_state'
EXEC sp_OAMethod @jResp, 'StringOf', @description OUT, 'response.result.bill.lines[i].description'
EXEC sp_OAMethod @jResp, 'IntOf', @id OUT, 'response.result.bill.lines[i].id'
EXEC sp_OAMethod @jResp, 'IntOf', @list_index OUT, 'response.result.bill.lines[i].list_index'
EXEC sp_OAMethod @jResp, 'StringOf', @quantity OUT, 'response.result.bill.lines[i].quantity'
EXEC sp_OAMethod @jResp, 'StringOf', @tax_amount1 OUT, 'response.result.bill.lines[i].tax_amount1'
EXEC sp_OAMethod @jResp, 'StringOf', @tax_amount2 OUT, 'response.result.bill.lines[i].tax_amount2'
EXEC sp_OAMethod @jResp, 'StringOf', @tax_authorityid1 OUT, 'response.result.bill.lines[i].tax_authorityid1'
EXEC sp_OAMethod @jResp, 'StringOf', @tax_authorityid2 OUT, 'response.result.bill.lines[i].tax_authorityid2'
EXEC sp_OAMethod @jResp, 'StringOf', @tax_name1 OUT, 'response.result.bill.lines[i].tax_name1'
EXEC sp_OAMethod @jResp, 'StringOf', @tax_name2 OUT, 'response.result.bill.lines[i].tax_name2'
EXEC sp_OAMethod @jResp, 'StringOf', @tax_percent1 OUT, 'response.result.bill.lines[i].tax_percent1'
EXEC sp_OAMethod @jResp, 'StringOf', @tax_percent2 OUT, 'response.result.bill.lines[i].tax_percent2'
EXEC sp_OAMethod @jResp, 'StringOf', @total_amountAmount OUT, 'response.result.bill.lines[i].total_amount.amount'
EXEC sp_OAMethod @jResp, 'StringOf', @total_amountCode OUT, 'response.result.bill.lines[i].total_amount.code'
EXEC sp_OAMethod @jResp, 'StringOf', @unit_costAmount OUT, 'response.result.bill.lines[i].unit_cost.amount'
EXEC sp_OAMethod @jResp, 'StringOf', @unit_costCode OUT, 'response.result.bill.lines[i].unit_cost.code'
SELECT @i = @i + 1
END
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>"
-d '{
"bill": {
"vendorid": "5",
"previous_vendor_id": null,
"bill_number": null,
"issue_date": "2020-10-09",
"due_offset_days": 39,
"currency_code": "USD",
"language": "en",
"lines": [
{
"tax_percent1": null,
"tax_percent2": null,
"unit_cost": {
"amount": "125",
"code": "USD"
},
"description": "Malm Side Table",
"tax_name1": null,
"quantity": 1,
"tax_name2": null,
"compounded_tax": false,
"categoryid": "65773"
},
{
"tax_percent1": null,
"tax_percent2": null,
"unit_cost": {
"amount": "250",
"code": "USD"
},
"description": "Malm Book Shelf",
"tax_name1": null,
"quantity": 1,
"tax_name2": null,
"compounded_tax": false,
"categoryid": "65773"
}
],
"attachment": null
}
}'
https://api.freshbooks.com/accounting/account/{{accountId}}/bills/bills
Postman Collection Item JSON
{
"name": "Add Bill from Vendor",
"request": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"bill\": {\n \"vendorid\": \"5\",\n \"previous_vendor_id\": null,\n \"bill_number\": null,\n \"issue_date\": \"2020-10-09\",\n \"due_offset_days\": 39,\n \"currency_code\": \"USD\",\n \"language\": \"en\",\n \"lines\": [\n {\n \"tax_percent1\": null,\n \"tax_percent2\": null,\n \"unit_cost\": {\n \"amount\": \"125\",\n \"code\": \"USD\"\n },\n \"description\": \"Malm Side Table\",\n \"tax_name1\": null,\n \"quantity\": 1,\n \"tax_name2\": null,\n \"compounded_tax\": false,\n \"categoryid\": \"65773\"\n },\n {\n \"tax_percent1\": null,\n \"tax_percent2\": null,\n \"unit_cost\": {\n \"amount\": \"250\",\n \"code\": \"USD\"\n },\n \"description\": \"Malm Book Shelf\",\n \"tax_name1\": null,\n \"quantity\": 1,\n \"tax_name2\": null,\n \"compounded_tax\": false,\n \"categoryid\": \"65773\"\n }\n ],\n \"attachment\": null\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://api.freshbooks.com/accounting/account/{{accountId}}/bills/bills",
"protocol": "https",
"host": [
"api",
"freshbooks",
"com"
],
"path": [
"accounting",
"account",
"{{accountId}}",
"bills",
"bills"
]
}
},
"response": [
{
"name": "Add Bill from Vendor",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"bill\": {\n \"vendorid\": \"5\",\n \"previous_vendor_id\": null,\n \"bill_number\": null,\n \"issue_date\": \"2020-10-09\",\n \"due_offset_days\": 39,\n \"currency_code\": \"USD\",\n \"language\": \"en\",\n \"lines\": [\n {\n \"tax_percent1\": null,\n \"tax_percent2\": null,\n \"unit_cost\": {\n \"amount\": \"125\",\n \"code\": \"USD\"\n },\n \"description\": \"Malm Side Table\",\n \"tax_name1\": null,\n \"quantity\": 1,\n \"tax_name2\": null,\n \"compounded_tax\": false,\n \"categoryid\": \"65773\"\n },\n {\n \"tax_percent1\": null,\n \"tax_percent2\": null,\n \"unit_cost\": {\n \"amount\": \"250\",\n \"code\": \"USD\"\n },\n \"description\": \"Malm Book Shelf\",\n \"tax_name1\": null,\n \"quantity\": 1,\n \"tax_name2\": null,\n \"compounded_tax\": false,\n \"categoryid\": \"65773\"\n }\n ],\n \"attachment\": null\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://api.freshbooks.com/accounting/account/{{accountId}}/bills/bills",
"protocol": "https",
"host": [
"api",
"freshbooks",
"com"
],
"path": [
"accounting",
"account",
"{{accountId}}",
"bills",
"bills"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "nginx"
},
{
"key": "Date",
"value": "Fri, 09 Oct 2020 15:28:49 GMT"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Vary",
"value": "Accept-Encoding"
},
{
"key": "X-NewRelic-App-Data",
"value": "PxQBWV5TCBABVlVSAwEOVlcTGhE1AwE2QgNWEVlbQFtcCxYnRA9QFg1ZWU4DFVdfRgFPCkNFR0gGWFpfEVwBC1wOS0AUCBgCHVEKVwVWBVZSDwdSX1oJBBxVU1IBHRVVAgYGVQRQVQAAV11UCVwDEB8DWA1CBG4="
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "Content-Security-Policy",
"value": "default-src 'self'"
},
{
"key": "X-Content-Security-Policy",
"value": "default-src 'self'"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=31556926; includeSubDomains; preload"
},
{
"key": "Referrer-Policy",
"value": "strict-origin-when-cross-origin"
},
{
"key": "X-RateLimit-Limit",
"value": "600"
},
{
"key": "X-RateLimit-Remaining",
"value": "599"
},
{
"key": "X-RateLimit-Reset",
"value": "1602257389"
},
{
"key": "Retry-After",
"value": "59"
},
{
"key": "Access-Control-Allow-Origin",
"value": "*"
},
{
"key": "Content-Encoding",
"value": "gzip"
},
{
"key": "Via",
"value": "1.1 google"
},
{
"key": "Alt-Svc",
"value": "h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\""
},
{
"key": "Transfer-Encoding",
"value": "chunked"
}
],
"cookie": [
],
"body": "{\n \"response\": {\n \"result\": {\n \"bill\": {\n \"amount\": {\n \"amount\": \"375.00\",\n \"code\": \"USD\"\n },\n \"attachment\": null,\n \"bill_number\": null,\n \"bill_payments\": [],\n \"created_at\": \"2020-10-09 15:28:49\",\n \"currency_code\": \"USD\",\n \"due_date\": \"2020-11-17\",\n \"due_offset_days\": 39,\n \"id\": 7,\n \"issue_date\": \"2020-10-09\",\n \"language\": \"en\",\n \"lines\": [\n {\n \"amount\": {\n \"amount\": \"125.00\",\n \"code\": \"USD\"\n },\n \"category\": {\n \"category\": \"Office Expenses & Postage\",\n \"categoryid\": 65773,\n \"created_at\": \"2016-11-17 14:22:35\",\n \"id\": 65773,\n \"is_cogs\": false,\n \"is_editable\": false,\n \"parentid\": null,\n \"updated_at\": \"2016-11-17 14:22:35\",\n \"vis_state\": 0\n },\n \"description\": \"Malm Side Table\",\n \"id\": 13,\n \"list_index\": 1,\n \"quantity\": \"1\",\n \"tax_amount1\": null,\n \"tax_amount2\": null,\n \"tax_authorityid1\": null,\n \"tax_authorityid2\": null,\n \"tax_name1\": null,\n \"tax_name2\": null,\n \"tax_percent1\": null,\n \"tax_percent2\": null,\n \"total_amount\": {\n \"amount\": \"125.00\",\n \"code\": \"USD\"\n },\n \"unit_cost\": {\n \"amount\": \"125.00\",\n \"code\": \"USD\"\n }\n },\n {\n \"amount\": {\n \"amount\": \"250.00\",\n \"code\": \"USD\"\n },\n \"category\": {\n \"category\": \"Office Expenses & Postage\",\n \"categoryid\": 65773,\n \"created_at\": \"2016-11-17 14:22:35\",\n \"id\": 65773,\n \"is_cogs\": false,\n \"is_editable\": false,\n \"parentid\": null,\n \"updated_at\": \"2016-11-17 14:22:35\",\n \"vis_state\": 0\n },\n \"description\": \"Malm Book Shelf\",\n \"id\": 15,\n \"list_index\": 2,\n \"quantity\": \"1\",\n \"tax_amount1\": null,\n \"tax_amount2\": null,\n \"tax_authorityid1\": null,\n \"tax_authorityid2\": null,\n \"tax_name1\": null,\n \"tax_name2\": null,\n \"tax_percent1\": null,\n \"tax_percent2\": null,\n \"total_amount\": {\n \"amount\": \"250.00\",\n \"code\": \"USD\"\n },\n \"unit_cost\": {\n \"amount\": \"250.00\",\n \"code\": \"USD\"\n }\n }\n ],\n \"outstanding\": {\n \"amount\": \"375.00\",\n \"code\": \"USD\"\n },\n \"overall_category\": \"Office Expenses & Postage\",\n \"overall_description\": \"Malm Side Table\",\n \"paid\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"status\": \"unpaid\",\n \"tax_amount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"total_amount\": {\n \"amount\": \"375.00\",\n \"code\": \"USD\"\n },\n \"updated_at\": \"2020-10-09 15:28:49\",\n \"vis_state\": 0\n }\n }\n }\n}"
},
{
"name": "Add Bill from Vendor",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"bill\": {\n \"vendorid\": \"5\",\n \"previous_vendor_id\": null,\n \"bill_number\": null,\n \"issue_date\": \"2020-10-09\",\n \"due_offset_days\": 39,\n \"currency_code\": \"USD\",\n \"language\": \"en\",\n \"lines\": [\n {\n \"tax_percent1\": null,\n \"tax_percent2\": null,\n \"unit_cost\": {\n \"amount\": \"125\",\n \"code\": \"USD\"\n },\n \"description\": \"Malm Side Table\",\n \"tax_name1\": null,\n \"quantity\": 1,\n \"tax_name2\": null,\n \"compounded_tax\": false,\n \"categoryid\": \"65773\"\n },\n {\n \"tax_percent1\": null,\n \"tax_percent2\": null,\n \"unit_cost\": {\n \"amount\": \"250\",\n \"code\": \"USD\"\n },\n \"description\": \"Malm Book Shelf\",\n \"tax_name1\": null,\n \"quantity\": 1,\n \"tax_name2\": null,\n \"compounded_tax\": false,\n \"categoryid\": \"65773\"\n }\n ],\n \"attachment\": null\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://api.freshbooks.com/accounting/account/{{accountId}}/bills/bills",
"protocol": "https",
"host": [
"api",
"freshbooks",
"com"
],
"path": [
"accounting",
"account",
"{{accountId}}",
"bills",
"bills"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "nginx"
},
{
"key": "Date",
"value": "Fri, 09 Oct 2020 15:28:49 GMT"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Vary",
"value": "Accept-Encoding"
},
{
"key": "X-NewRelic-App-Data",
"value": "PxQBWV5TCBABVlVSAwEOVlcTGhE1AwE2QgNWEVlbQFtcCxYnRA9QFg1ZWU4DFVdfRgFPCkNFR0gGWFpfEVwBC1wOS0AUCBgCHVEKVwVWBVZSDwdSX1oJBBxVU1IBHRVVAgYGVQRQVQAAV11UCVwDEB8DWA1CBG4="
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "Content-Security-Policy",
"value": "default-src 'self'"
},
{
"key": "X-Content-Security-Policy",
"value": "default-src 'self'"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=31556926; includeSubDomains; preload"
},
{
"key": "Referrer-Policy",
"value": "strict-origin-when-cross-origin"
},
{
"key": "X-RateLimit-Limit",
"value": "600"
},
{
"key": "X-RateLimit-Remaining",
"value": "599"
},
{
"key": "X-RateLimit-Reset",
"value": "1602257389"
},
{
"key": "Retry-After",
"value": "59"
},
{
"key": "Access-Control-Allow-Origin",
"value": "*"
},
{
"key": "Content-Encoding",
"value": "gzip"
},
{
"key": "Via",
"value": "1.1 google"
},
{
"key": "Alt-Svc",
"value": "h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\""
},
{
"key": "Transfer-Encoding",
"value": "chunked"
}
],
"cookie": [
],
"body": "{\n \"response\": {\n \"result\": {\n \"bill\": {\n \"amount\": {\n \"amount\": \"375.00\",\n \"code\": \"USD\"\n },\n \"attachment\": null,\n \"bill_number\": null,\n \"bill_payments\": [],\n \"created_at\": \"2020-10-09 15:28:49\",\n \"currency_code\": \"USD\",\n \"due_date\": \"2020-11-17\",\n \"due_offset_days\": 39,\n \"id\": 7,\n \"issue_date\": \"2020-10-09\",\n \"language\": \"en\",\n \"lines\": [\n {\n \"amount\": {\n \"amount\": \"125.00\",\n \"code\": \"USD\"\n },\n \"category\": {\n \"category\": \"Office Expenses & Postage\",\n \"categoryid\": 65773,\n \"created_at\": \"2016-11-17 14:22:35\",\n \"id\": 65773,\n \"is_cogs\": false,\n \"is_editable\": false,\n \"parentid\": null,\n \"updated_at\": \"2016-11-17 14:22:35\",\n \"vis_state\": 0\n },\n \"description\": \"Malm Side Table\",\n \"id\": 13,\n \"list_index\": 1,\n \"quantity\": \"1\",\n \"tax_amount1\": null,\n \"tax_amount2\": null,\n \"tax_authorityid1\": null,\n \"tax_authorityid2\": null,\n \"tax_name1\": null,\n \"tax_name2\": null,\n \"tax_percent1\": null,\n \"tax_percent2\": null,\n \"total_amount\": {\n \"amount\": \"125.00\",\n \"code\": \"USD\"\n },\n \"unit_cost\": {\n \"amount\": \"125.00\",\n \"code\": \"USD\"\n }\n },\n {\n \"amount\": {\n \"amount\": \"250.00\",\n \"code\": \"USD\"\n },\n \"category\": {\n \"category\": \"Office Expenses & Postage\",\n \"categoryid\": 65773,\n \"created_at\": \"2016-11-17 14:22:35\",\n \"id\": 65773,\n \"is_cogs\": false,\n \"is_editable\": false,\n \"parentid\": null,\n \"updated_at\": \"2016-11-17 14:22:35\",\n \"vis_state\": 0\n },\n \"description\": \"Malm Book Shelf\",\n \"id\": 15,\n \"list_index\": 2,\n \"quantity\": \"1\",\n \"tax_amount1\": null,\n \"tax_amount2\": null,\n \"tax_authorityid1\": null,\n \"tax_authorityid2\": null,\n \"tax_name1\": null,\n \"tax_name2\": null,\n \"tax_percent1\": null,\n \"tax_percent2\": null,\n \"total_amount\": {\n \"amount\": \"250.00\",\n \"code\": \"USD\"\n },\n \"unit_cost\": {\n \"amount\": \"250.00\",\n \"code\": \"USD\"\n }\n }\n ],\n \"outstanding\": {\n \"amount\": \"375.00\",\n \"code\": \"USD\"\n },\n \"overall_category\": \"Office Expenses & Postage\",\n \"overall_description\": \"Malm Side Table\",\n \"paid\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"status\": \"unpaid\",\n \"tax_amount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"total_amount\": {\n \"amount\": \"375.00\",\n \"code\": \"USD\"\n },\n \"updated_at\": \"2020-10-09 15:28:49\",\n \"vis_state\": 0\n }\n }\n }\n}"
}
]
}