Freshbooks
You'll need to provide the following variables in your postman collection:
Variable | Description | Example |
---|---|---|
API_VERSION | Represents the version of the Alloy Unified API you intend to make calls to. API versions are dated and new versions are released quarterly (in March, June, September, and December). | 2024-03 |
credentialId | The Id of the credential. | |
apiKey | Your API key. Never share this with anyone. |
JSON
{
"info": {
"_postman_id": "fa07d632-d64a-41a6-a511-3808d9bcc367",
"name": "Freshbooks – Alloy UAPI",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "17412242"
},
"item": [
{
"name": "01 Create then Retrieve",
"item": [
{
"name": "Create Account",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 501\"] = responseCode.code === 501;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"Status code is 501\", function () {",
" pm.response.to.have.status(501);",
"});",
"",
"pm.test(\"Body has code and message\", function () {",
" let jsonData = pm.response.json();",
" console.log(jsonData);",
" pm.expect(jsonData).to.have.property('code');",
" pm.expect(jsonData).to.have.property('message');",
"});",
"",
"pm.test(\"Code is MODEL_NOT_SUPPORTED\", function () {",
" let jsonData = pm.response.json();",
" pm.expect(jsonData.code).to.eql(\"MODEL_NOT_SUPPORTED\");",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"accountName\": \"FrancisChild+{{$randomUUID}}\",\n \"accountType\": \"OTHER_ASSET\",\n \"currency\": \"USD\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/accounts?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": ["{{API_VERSION}}", "one", "accounting", "accounts"],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Retrieve Account",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 501\"] = responseCode.code === 501;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"Status code is 501\", function () {",
" pm.response.to.have.status(501);",
"});",
"",
"pm.test(\"Body has code and message\", function () {",
" let jsonData = pm.response.json();",
" console.log(jsonData);",
" pm.expect(jsonData).to.have.property('code');",
" pm.expect(jsonData).to.have.property('message');",
"});",
"",
"pm.test(\"Code is MODEL_NOT_SUPPORTED\", function () {",
" let jsonData = pm.response.json();",
" pm.expect(jsonData.code).to.eql(\"MODEL_NOT_SUPPORTED\");",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
},
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/accounts/{{accountId}}?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"accounts",
"{{accountId}}"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Create Customer",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"[qbo] customer is retrieved correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('customer');",
" pm.expect(jsonData.customer).to.not.be.null;",
" pm.expect(jsonData.customer).to.have.property('remoteId');",
" pm.expect(jsonData.customer).to.have.property('customerName');",
" pm.expect(jsonData.customer).to.have.property('email');",
" pm.expect(jsonData.customer).to.have.property('taxNumber');",
" pm.expect(jsonData.customer).to.have.property('customerStatus');",
" pm.expect(jsonData.customer).to.have.property('currency');",
" pm.expect(jsonData.customer).to.have.property('companyId');",
" pm.expect(jsonData.customer.addresses).to.be.an('array').that.is.not.empty;",
" pm.expect(jsonData.customer.addresses[0]).to.have.property('addressType');",
" pm.expect(jsonData.customer.addresses[0]).to.have.property('street1');",
" pm.expect(jsonData.customer).to.have.property('phoneNumbers');",
" pm.expect(jsonData.customer.phoneNumbers).to.be.an('array').that.is.not.empty;",
" pm.expect(jsonData.customer.phoneNumbers[0]).to.have.property('phoneNumberType');",
" pm.expect(jsonData.customer.phoneNumbers[0]).to.have.property('phoneNumber');",
" pm.expect(jsonData.customer).to.have.property('addresses');",
" pm.expect(jsonData.customer).to.have.property('remoteCreatedAt');",
" pm.expect(jsonData.customer).to.have.property('remoteUpdatedAt');",
" pm.expect(jsonData.customer).to.have.property('createdAt');",
" pm.expect(jsonData.customer).to.have.property('updatedAt');",
" pm.expect(jsonData.customer).to.have.property('id');",
" pm.expect(jsonData.customer.addresses[0].addressType).to.equal('BILLING');",
" pm.expect(jsonData.customer.addresses[0].street1).to.equal('Beverly Hills');",
" pm.expect(jsonData.customer.addresses[0].zipCode).to.equal('90210');",
" pm.expect(jsonData.customer.addresses[0].country).to.equal('US');",
" pm.expect(jsonData.customer.phoneNumbers[0].phoneNumber).to.equal('09173210215');",
" pm.expect(jsonData.customer.phoneNumbers[0].phoneNumberType).to.equal('MOBILE');",
"});",
"",
"var jsonData = pm.response.json();",
"let customerId = jsonData.customer.id;",
"postman.setEnvironmentVariable(\"customerId\", customerId);"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"customerName\": \"Alloy+{{$randomUUID}}\",\n \"email\":\"alloy+{{$randomUUID}}@runalloy.com\",\n \"addresses\": [\n { \n \"addressType\": \"BILLING\",\n \"street1\": \"Beverly Hills\",\n \"zipCode\": \"90210\",\n \"country\": \"US\"\n }\n ],\n \"phoneNumbers\": [\n {\n \"phoneNumberType\": \"MOBILE\",\n \"phoneNumber\": \"09173210215\"\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/customers?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": ["{{API_VERSION}}", "one", "accounting", "customers"],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Retrieve Customer",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"customer is retrieved correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('customer');",
" pm.expect(jsonData.customer).to.not.be.null;",
" pm.expect(jsonData.customer).to.have.property('remoteId');",
" pm.expect(jsonData.customer).to.have.property('customerName');",
" pm.expect(jsonData.customer).to.have.property('email');",
" pm.expect(jsonData.customer).to.have.property('taxNumber');",
" pm.expect(jsonData.customer).to.have.property('customerStatus');",
" pm.expect(jsonData.customer).to.have.property('currency');",
" pm.expect(jsonData.customer).to.have.property('companyId');",
" pm.expect(jsonData.customer).to.have.property('addresses');",
" pm.expect(jsonData.customer).to.have.property('remoteCreatedAt');",
" pm.expect(jsonData.customer).to.have.property('remoteUpdatedAt');",
" pm.expect(jsonData.customer).to.have.property('createdAt');",
" pm.expect(jsonData.customer).to.have.property('updatedAt');",
" pm.expect(jsonData.customer).to.have.property('id');",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
},
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/customers/{{customerId}}?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"customers",
"{{customerId}}"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Create Vendor",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"vendor is retrieved correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('vendor');",
" pm.expect(jsonData.vendor).to.not.be.null;",
" pm.expect(jsonData.vendor).to.have.property('remoteId');",
" pm.expect(jsonData.vendor).to.have.property('vendorName');",
" pm.expect(jsonData.vendor).to.have.property('email');",
" pm.expect(jsonData.vendor).to.have.property('taxNumber');",
" pm.expect(jsonData.vendor).to.have.property('vendorStatus');",
" pm.expect(jsonData.vendor).to.have.property('currency');",
" pm.expect(jsonData.vendor).to.have.property('companyId');",
" pm.expect(jsonData.vendor).to.have.property('addresses');",
" pm.expect(jsonData.vendor.addresses).to.be.an('array').that.is.not.empty;",
" pm.expect(jsonData.vendor).to.have.property('phoneNumbers');",
" pm.expect(jsonData.vendor).to.have.property('remoteCreatedAt');",
" pm.expect(jsonData.vendor).to.have.property('remoteUpdatedAt');",
" pm.expect(jsonData.vendor).to.have.property('createdAt');",
" pm.expect(jsonData.vendor).to.have.property('updatedAt');",
" pm.expect(jsonData.vendor).to.have.property('id');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('addressType');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('street1');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('street2');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('city');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('state');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('country');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('countrySubdivision');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('country');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('zipCode');",
"",
"});",
"",
"var jsonData = pm.response.json();",
"let vendorId = jsonData.vendor.id;",
"postman.setEnvironmentVariable(\"vendorId\", vendorId);"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"vendorName\": \"Alloy+{{$randomUUID}}\",\n \"vendorStatus\": \"ACTIVE\",\n \"email\":\"alloy+{{$randomUUID}}@runalloy.com\",\n \"currency\":\"USD\",\n \"addresses\": [\n { \n \"addressType\": \"BILLING\",\n \"street1\": \"Avenue of the Americas\",\n \"zipCode\": \"90210\",\n \"country\": \"US\"\n }\n ],\n \"phoneNumbers\": [\n {\n \"phoneNumberType\": \"PRIMARY\",\n \"phoneNumber\": \"09173210215\"\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/vendors?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": ["{{API_VERSION}}", "one", "accounting", "vendors"],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Retrieve Vendor",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"[qbo] vendor is retrieved correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('vendor');",
" pm.expect(jsonData.vendor).to.not.be.null;",
" pm.expect(jsonData.vendor).to.have.property('remoteId');",
" pm.expect(jsonData.vendor).to.have.property('vendorName');",
" pm.expect(jsonData.vendor).to.have.property('email');",
" pm.expect(jsonData.vendor).to.have.property('taxNumber');",
" pm.expect(jsonData.vendor).to.have.property('vendorStatus');",
" pm.expect(jsonData.vendor).to.have.property('currency');",
" pm.expect(jsonData.vendor).to.have.property('companyId');",
" pm.expect(jsonData.vendor).to.have.property('addresses');",
" pm.expect(jsonData.vendor.addresses).to.be.an('array');",
" pm.expect(jsonData.vendor).to.have.property('phoneNumbers');",
" pm.expect(jsonData.vendor).to.have.property('remoteCreatedAt');",
" pm.expect(jsonData.vendor).to.have.property('remoteUpdatedAt');",
" pm.expect(jsonData.vendor).to.have.property('createdAt');",
" pm.expect(jsonData.vendor).to.have.property('updatedAt');",
" pm.expect(jsonData.vendor).to.have.property('id');",
" if(jsonData.vendor.addresses.length > 0) {",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('addressType');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('street1');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('street2');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('city');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('state');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('country');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('countrySubdivision');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('country');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('zipCode');",
" }",
"});",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
},
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/vendors/{{vendorId}}?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"vendors",
"{{vendorId}}"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Create Item",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"[qbo] item is retrieved correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('item');",
" pm.expect(jsonData.item).to.not.be.null;",
" pm.expect(jsonData.item).to.have.property('remoteId');",
" pm.expect(jsonData.item).to.have.property('itemName');",
" pm.expect(jsonData.item).to.have.property('itemStatus');",
" pm.expect(jsonData.item).to.have.property('itemType');",
" pm.expect(jsonData.item).to.have.property('unitPrice');",
" pm.expect(jsonData.item).to.have.property('purchasePrice');",
" pm.expect(jsonData.item).to.have.property('qtyOnHand');",
" pm.expect(jsonData.item).to.have.property('billAccountId');",
" pm.expect(jsonData.item).to.have.property('invoiceAccountId');",
" pm.expect(jsonData.item).to.have.property('assetAccountId');",
" pm.expect(jsonData.item).to.have.property('companyId');",
" pm.expect(jsonData.item).to.have.property('remoteCreatedAt');",
" pm.expect(jsonData.item).to.have.property('remoteUpdatedAt');",
" pm.expect(jsonData.item).to.have.property('createdAt');",
" pm.expect(jsonData.item).to.have.property('updatedAt');",
" pm.expect(jsonData.item).to.have.property('id');",
"});",
"",
"var jsonData = pm.response.json();",
"console.log(jsonData);",
"let itemId = jsonData.item.id;",
"console.log(\"itemId\",itemId)",
"postman.setEnvironmentVariable(\"itemId\", itemId);"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"itemName\": \"{{$randomAdjective}} {{$randomNoun}} Item {{$randomUUID}}\",\n \"unitPrice\": 1,\n \"qtyOnHand\":2\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/items?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": ["{{API_VERSION}}", "one", "accounting", "items"],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Retrieve Item",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"[qbo] item is retrieved correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('item');",
" pm.expect(jsonData.item).to.not.be.null;",
" pm.expect(jsonData.item).to.have.property('remoteId');",
" pm.expect(jsonData.item).to.have.property('itemName');",
" pm.expect(jsonData.item).to.have.property('itemStatus');",
" pm.expect(jsonData.item).to.have.property('itemType');",
" pm.expect(jsonData.item).to.have.property('unitPrice');",
" pm.expect(jsonData.item).to.have.property('purchasePrice');",
" pm.expect(jsonData.item).to.have.property('qtyOnHand');",
" pm.expect(jsonData.item).to.have.property('billAccountId');",
" pm.expect(jsonData.item).to.have.property('invoiceAccountId');",
" pm.expect(jsonData.item).to.have.property('assetAccountId');",
" pm.expect(jsonData.item).to.have.property('companyId');",
" pm.expect(jsonData.item).to.have.property('remoteCreatedAt');",
" pm.expect(jsonData.item).to.have.property('remoteUpdatedAt');",
" pm.expect(jsonData.item).to.have.property('createdAt');",
" pm.expect(jsonData.item).to.have.property('updatedAt');",
" pm.expect(jsonData.item).to.have.property('id');",
"});",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
},
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/items/{{itemId}}?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"items",
"{{itemId}}"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Create Purchase Order",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 501\"] = responseCode.code === 501;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"Status code is 501\", function () {",
" pm.response.to.have.status(501);",
"});",
"",
"pm.test(\"Body has code and message\", function () {",
" let jsonData = pm.response.json();",
" console.log(jsonData);",
" pm.expect(jsonData).to.have.property('code');",
" pm.expect(jsonData).to.have.property('message');",
"});",
"",
"pm.test(\"Code is MODEL_NOT_SUPPORTED\", function () {",
" let jsonData = pm.response.json();",
" pm.expect(jsonData.code).to.eql(\"MODEL_NOT_SUPPORTED\");",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"vendorId\": \"{{vendorId}}\",\n \"accountId\": \"{{accountIdForCreatePO}}\",\n \"lineItems\": [{\n \"description\": \"Line Item 1\",\n \"accountingItemId\": \"{{itemId}}\",\n \"totalLineAmount\": 100\n }]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/purchase-orders?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"purchase-orders"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Retrieve Purchase Order",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 501\"] = responseCode.code === 501;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"Status code is 501\", function () {",
" pm.response.to.have.status(501);",
"});",
"",
"pm.test(\"Body has code and message\", function () {",
" let jsonData = pm.response.json();",
" console.log(jsonData);",
" pm.expect(jsonData).to.have.property('code');",
" pm.expect(jsonData).to.have.property('message');",
"});",
"",
"pm.test(\"Code is MODEL_NOT_SUPPORTED\", function () {",
" let jsonData = pm.response.json();",
" pm.expect(jsonData.code).to.eql(\"MODEL_NOT_SUPPORTED\");",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
},
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/purchase-orders/{{purchaseOrderId}}?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"purchase-orders",
"{{purchaseOrderId}}"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "List Tracking Categories for Bill",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"[qbo] trackingCategories are listed correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('trackingCategories');",
" pm.expect(jsonData.trackingCategories[0]).to.not.be.null;",
" pm.expect(jsonData.trackingCategories[0]).to.have.property('remoteId');",
" pm.expect(jsonData.trackingCategories[0]).to.have.property('trackingCategoryName');",
" pm.expect(jsonData.trackingCategories[0]).to.have.property('trackingCategoryStatus');",
" pm.expect(jsonData.trackingCategories[0]).to.have.property('trackingCategoryType');",
" pm.expect(jsonData.trackingCategories[0]).to.have.property('parentCategoryId');",
" pm.expect(jsonData.trackingCategories[0]).to.have.property('companyId');",
" pm.expect(jsonData.trackingCategories[0]).to.have.property('id');",
"});",
"",
"var jsonData = pm.response.json();",
"let trackingCategoryId = jsonData.trackingCategories[0].id;",
"postman.setEnvironmentVariable(\"trackingCategoryId\", trackingCategoryId);",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
},
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/tracking-categories?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"tracking-categories"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Create Bill",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"bill is retrieved correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('bill');",
" pm.expect(jsonData.bill).to.not.be.null;",
" pm.expect(jsonData.bill).to.have.property('remoteId');",
" pm.expect(jsonData.bill).to.have.property('vendorId');",
" pm.expect(jsonData.bill).to.have.property('billNumber');",
" pm.expect(jsonData.bill).to.have.property('issueDate');",
" pm.expect(jsonData.bill).to.have.property('dueDate');",
" pm.expect(jsonData.bill).to.have.property('paidOnDate');",
" pm.expect(jsonData.bill).to.have.property('memo');",
" pm.expect(jsonData.bill).to.have.property('companyId');",
" pm.expect(jsonData.bill).to.have.property('currency');",
" pm.expect(jsonData.bill).to.have.property('exchangeRate');",
" pm.expect(jsonData.bill).to.have.property('totalDiscount');",
" pm.expect(jsonData.bill).to.have.property('subTotal');",
" pm.expect(jsonData.bill).to.have.property('billStatus');",
" pm.expect(jsonData.bill).to.have.property('totalTaxAmount');",
" pm.expect(jsonData.bill).to.have.property('totalAmount');",
" pm.expect(jsonData.bill).to.have.property('balance');",
" pm.expect(jsonData.bill).to.have.property('trackingCategories');",
" pm.expect(jsonData.bill).to.have.property('lineItems');",
" pm.expect(jsonData.bill).to.have.property('purchaseOrders');",
" pm.expect(jsonData.bill).to.have.property('remoteCreatedAt');",
" pm.expect(jsonData.bill).to.have.property('remoteUpdatedAt');",
" pm.expect(jsonData.bill).to.have.property('createdAt');",
" pm.expect(jsonData.bill).to.have.property('updatedAt');",
" pm.expect(jsonData.bill).to.have.property('id');",
" pm.expect(jsonData.bill.lineItems[0].description).to.equal('Line Item 1');",
"});",
"",
"var jsonData = pm.response.json();",
"let billId = jsonData.bill.id;",
"postman.setEnvironmentVariable(\"billId\", billId);"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"vendorId\": \"{{vendorId}}\",\n \"billNumber\": \"PLDT-{{$guid}}\",\n \"issueDate\": \"2024-04-09\",\n \"dueDate\": \"2024-05-01\",\n \"currency\": \"USD\",\n \"lineItems\": [\n {\n \"description\": \"Line Item 1\",\n \"trackingCategoryId\": \"{{trackingCategoryId}}\",\n \"quantity\": 1,\n \"unitPrice\": 1\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/bills?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": ["{{API_VERSION}}", "one", "accounting", "bills"],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Retrieve Bill",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"[qbo] bill is retrieved correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('bill');",
" pm.expect(jsonData.bill).to.not.be.null;",
" pm.expect(jsonData.bill).to.have.property('remoteId');",
" pm.expect(jsonData.bill).to.have.property('vendorId');",
" pm.expect(jsonData.bill).to.have.property('billNumber');",
" pm.expect(jsonData.bill).to.have.property('issueDate');",
" pm.expect(jsonData.bill).to.have.property('dueDate');",
" pm.expect(jsonData.bill).to.have.property('paidOnDate');",
" pm.expect(jsonData.bill).to.have.property('memo');",
" pm.expect(jsonData.bill).to.have.property('companyId');",
" pm.expect(jsonData.bill).to.have.property('currency');",
" pm.expect(jsonData.bill).to.have.property('exchangeRate');",
" pm.expect(jsonData.bill).to.have.property('totalDiscount');",
" pm.expect(jsonData.bill).to.have.property('subTotal');",
" pm.expect(jsonData.bill).to.have.property('billStatus');",
" pm.expect(jsonData.bill).to.have.property('totalTaxAmount');",
" pm.expect(jsonData.bill).to.have.property('totalAmount');",
" pm.expect(jsonData.bill).to.have.property('balance');",
" pm.expect(jsonData.bill).to.have.property('trackingCategories');",
" pm.expect(jsonData.bill).to.have.property('lineItems');",
" pm.expect(jsonData.bill).to.have.property('purchaseOrders');",
" pm.expect(jsonData.bill).to.have.property('remoteCreatedAt');",
" pm.expect(jsonData.bill).to.have.property('remoteUpdatedAt');",
" pm.expect(jsonData.bill).to.have.property('createdAt');",
" pm.expect(jsonData.bill).to.have.property('updatedAt');",
" pm.expect(jsonData.bill).to.have.property('id');",
" pm.expect(jsonData.bill.lineItems[0]).to.have.property('id');",
" pm.expect(jsonData.bill.lineItems[0]).to.have.property('remoteId');",
" pm.expect(jsonData.bill.lineItems[0]).to.have.property('description');",
" pm.expect(jsonData.bill.lineItems[0]).to.have.property('unitPrice');",
" pm.expect(jsonData.bill.lineItems[0]).to.have.property('quantity');",
" pm.expect(jsonData.bill.lineItems[0]).to.have.property('totalAmount');",
" pm.expect(jsonData.bill.lineItems[0]).to.have.property('currency');",
" pm.expect(jsonData.bill.lineItems[0]).to.have.property('exchangeRate');",
" pm.expect(jsonData.bill.lineItems[0]).to.have.property('accountingItemId');",
" pm.expect(jsonData.bill.lineItems[0]).to.have.property('accountId');",
" pm.expect(jsonData.bill.lineItems[0]).to.have.property('trackingCategoryId');",
" pm.expect(jsonData.bill.lineItems[0]).to.have.property('trackingCategoryIds');",
" pm.expect(jsonData.bill.lineItems[0]).to.have.property('companyId');",
"});",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
},
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/bills/{{billId}}?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"bills",
"{{billId}}"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Create Invoice",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"[qbo] invoice is retrieved correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('invoice');",
" pm.expect(jsonData.invoice).to.not.be.null;",
" pm.expect(jsonData.invoice).to.have.property('remoteId');",
" pm.expect(jsonData.invoice).to.have.property('customerId');",
" pm.expect(jsonData.invoice).to.have.property('invoiceNumber');",
" pm.expect(jsonData.invoice).to.have.property('issueDate');",
" pm.expect(jsonData.invoice).to.have.property('dueDate');",
" pm.expect(jsonData.invoice).to.have.property('paidOnDate');",
" pm.expect(jsonData.invoice).to.have.property('memo');",
" pm.expect(jsonData.invoice).to.have.property('companyId');",
" pm.expect(jsonData.invoice).to.have.property('currency');",
" pm.expect(jsonData.invoice).to.have.property('exchangeRate');",
" pm.expect(jsonData.invoice).to.have.property('totalDiscount');",
" pm.expect(jsonData.invoice).to.have.property('subTotal');",
" pm.expect(jsonData.invoice).to.have.property('invoiceStatus');",
" pm.expect(jsonData.invoice).to.have.property('totalTaxAmount');",
" pm.expect(jsonData.invoice).to.have.property('totalAmount');",
" pm.expect(jsonData.invoice).to.have.property('balance');",
" pm.expect(jsonData.invoice).to.have.property('trackingCategories');",
" pm.expect(jsonData.invoice).to.have.property('lineItems');",
" pm.expect(jsonData.invoice).to.have.property('purchaseOrders');",
" pm.expect(jsonData.invoice).to.have.property('remoteCreatedAt');",
" pm.expect(jsonData.invoice).to.have.property('remoteUpdatedAt');",
" pm.expect(jsonData.invoice).to.have.property('createdAt');",
" pm.expect(jsonData.invoice).to.have.property('updatedAt');",
" pm.expect(jsonData.invoice).to.have.property('id');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('id');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('remoteId');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('description');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('unitPrice');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('quantity');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('totalAmount');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('currency');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('exchangeRate');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('accountingItemId');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('accountId');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('trackingCategoryId');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('trackingCategoryIds');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('companyId');",
"});",
"",
"var jsonData = pm.response.json();",
"let invoiceId = jsonData.invoice.id;",
"let invoiceRemoteId = jsonData.invoice.remoteId;",
"postman.setEnvironmentVariable(\"invoiceId\", invoiceId);",
"postman.setEnvironmentVariable(\"invoiceRemoteId\", invoiceRemoteId);"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"customerId\": \"{{customerId}}\",\n \"issueDate\":\"2024-04-10\",\n \"dueDate\":\"2024-04-15\",\n \"lineItems\": [\n {\n \"description\": \"Francis Menguito - Developer\",\n \"unitPrice\": 12,\n \"quantity\":2\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/invoices?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": ["{{API_VERSION}}", "one", "accounting", "invoices"],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Retrieve Invoice",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"invoice is retrieved correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('invoice');",
" pm.expect(jsonData.invoice).to.not.be.null;",
" pm.expect(jsonData.invoice).to.have.property('remoteId');",
" pm.expect(jsonData.invoice).to.have.property('customerId');",
" pm.expect(jsonData.invoice).to.have.property('invoiceNumber');",
" pm.expect(jsonData.invoice).to.have.property('issueDate');",
" pm.expect(jsonData.invoice).to.have.property('dueDate');",
" pm.expect(jsonData.invoice).to.have.property('paidOnDate');",
" pm.expect(jsonData.invoice).to.have.property('memo');",
" pm.expect(jsonData.invoice).to.have.property('companyId');",
" pm.expect(jsonData.invoice).to.have.property('currency');",
" pm.expect(jsonData.invoice).to.have.property('exchangeRate');",
" pm.expect(jsonData.invoice).to.have.property('totalDiscount');",
" pm.expect(jsonData.invoice).to.have.property('subTotal');",
" pm.expect(jsonData.invoice).to.have.property('invoiceStatus');",
" pm.expect(jsonData.invoice).to.have.property('totalTaxAmount');",
" pm.expect(jsonData.invoice).to.have.property('totalAmount');",
" pm.expect(jsonData.invoice).to.have.property('balance');",
" pm.expect(jsonData.invoice).to.have.property('trackingCategories');",
" pm.expect(jsonData.invoice).to.have.property('lineItems');",
" pm.expect(jsonData.invoice).to.have.property('purchaseOrders');",
" pm.expect(jsonData.invoice).to.have.property('remoteCreatedAt');",
" pm.expect(jsonData.invoice).to.have.property('remoteUpdatedAt');",
" pm.expect(jsonData.invoice).to.have.property('createdAt');",
" pm.expect(jsonData.invoice).to.have.property('updatedAt');",
" pm.expect(jsonData.invoice).to.have.property('id');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('id');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('remoteId');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('description');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('unitPrice');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('quantity');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('totalAmount');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('currency');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('exchangeRate');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('accountingItemId');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('accountId');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('trackingCategoryId');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('trackingCategoryIds');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('companyId');",
"});",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
},
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/invoices/{{invoiceId}}?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"invoices",
"{{invoiceId}}"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Create Payment",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"[qbo] payment is created correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('payment');",
" pm.expect(jsonData.payment).to.not.be.null;",
" pm.expect(jsonData.payment).to.have.property('remoteId');",
" pm.expect(jsonData.payment).to.have.property('transactionDate');",
" pm.expect(jsonData.payment).to.have.property('customerId');",
" pm.expect(jsonData.payment).to.have.property('vendorId');",
" pm.expect(jsonData.payment).to.have.property('accountId');",
" pm.expect(jsonData.payment).to.have.property('currency');",
" pm.expect(jsonData.payment).to.have.property('exchangeRate');",
" pm.expect(jsonData.payment).to.have.property('companyId');",
" pm.expect(jsonData.payment).to.have.property('totalAmount');",
" pm.expect(jsonData.payment).to.have.property('trackingCategoryIds');",
" pm.expect(jsonData.payment).to.have.property('remoteCreatedAt');",
" pm.expect(jsonData.payment).to.have.property('remoteUpdatedAt');",
" pm.expect(jsonData.payment).to.have.property('createdAt');",
" pm.expect(jsonData.payment).to.have.property('updatedAt');",
" pm.expect(jsonData.payment).to.have.property('id');",
"});",
"",
"var jsonData = pm.response.json();",
"let paymentId = jsonData.payment.id;",
"postman.setEnvironmentVariable(\"paymentId\", paymentId);",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"customerId\": \"{{customerId}}\",\n \"totalAmount\": 1,\n \"transactionDate\": \"2024-04-10\",\n \"remoteFields\": {\n \"invoiceid\": \"{{invoiceRemoteId}}\",\n \"type\": \"CASH\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/payments?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": ["{{API_VERSION}}", "one", "accounting", "payments"],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Retrieve Payment",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"[qbo] payment is retrieved correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('payment');",
" pm.expect(jsonData.payment).to.not.be.null;",
" pm.expect(jsonData.payment).to.have.property('remoteId');",
" pm.expect(jsonData.payment).to.have.property('transactionDate');",
" pm.expect(jsonData.payment).to.have.property('customerId');",
" pm.expect(jsonData.payment).to.have.property('vendorId');",
" pm.expect(jsonData.payment).to.have.property('accountId');",
" pm.expect(jsonData.payment).to.have.property('currency');",
" pm.expect(jsonData.payment).to.have.property('exchangeRate');",
" pm.expect(jsonData.payment).to.have.property('companyId');",
" pm.expect(jsonData.payment).to.have.property('totalAmount');",
" pm.expect(jsonData.payment).to.have.property('trackingCategoryIds');",
" pm.expect(jsonData.payment).to.have.property('remoteCreatedAt');",
" pm.expect(jsonData.payment).to.have.property('remoteUpdatedAt');",
" pm.expect(jsonData.payment).to.have.property('createdAt');",
" pm.expect(jsonData.payment).to.have.property('updatedAt');",
" pm.expect(jsonData.payment).to.have.property('id');",
"});",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
},
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/payments/{{paymentId}}?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"payments",
"{{paymentId}}"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
}
]
},
{
"name": "02 Update",
"item": [
{
"name": "Update Account",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 501\"] = responseCode.code === 501;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"Status code is 501\", function () {",
" pm.response.to.have.status(501);",
"});",
"",
"pm.test(\"Body has code and message\", function () {",
" let jsonData = pm.response.json();",
" console.log(jsonData);",
" pm.expect(jsonData).to.have.property('code');",
" pm.expect(jsonData).to.have.property('message');",
"});",
"",
"pm.test(\"Code is MODEL_NOT_SUPPORTED\", function () {",
" let jsonData = pm.response.json();",
" pm.expect(jsonData.code).to.eql(\"MODEL_NOT_SUPPORTED\");",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
}
},
"request": {
"method": "PUT",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"accountName\": \"CachoChildren+{{$randomUUID}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/accounts/{{accountId}}?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"accounts",
"{{accountId}}"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Update Customer",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"customer is retrieved correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('customer');",
" pm.expect(jsonData.customer).to.not.be.null;",
" pm.expect(jsonData.customer).to.have.property('remoteId');",
" pm.expect(jsonData.customer).to.have.property('customerName');",
" pm.expect(jsonData.customer).to.have.property('email');",
" pm.expect(jsonData.customer).to.have.property('taxNumber');",
" pm.expect(jsonData.customer).to.have.property('customerStatus');",
" pm.expect(jsonData.customer).to.have.property('currency');",
" pm.expect(jsonData.customer).to.have.property('companyId');",
" pm.expect(jsonData.customer).to.have.property('addresses');",
" pm.expect(jsonData.customer).to.have.property('remoteCreatedAt');",
" pm.expect(jsonData.customer).to.have.property('remoteUpdatedAt');",
" pm.expect(jsonData.customer).to.have.property('createdAt');",
" pm.expect(jsonData.customer).to.have.property('updatedAt');",
" pm.expect(jsonData.customer).to.have.property('id');",
" pm.expect(jsonData.customer.addresses).to.be.an('array').that.is.not.empty;",
"});",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
}
},
"request": {
"method": "PUT",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"customerName\": \"AlloyUpdate+{{$randomUUID}}\",\n \"customerStatus\":\"ACTIVE\",\n \"addresses\": [\n { \n \"addressType\": \"BILLING\",\n \"street1\": \"Lombard\",\n \"zipCode\": \"94012\",\n \"country\": \"US\"\n }\n ],\n \"phoneNumbers\": [\n {\n \"phoneNumberType\": \"MOBILE\",\n \"phoneNumber\": \"09173210215\"\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/customers/{{customerId}}?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"customers",
"{{customerId}}"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Update Vendor",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"vendor is retrieved correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('vendor');",
" pm.expect(jsonData.vendor).to.not.be.null;",
" pm.expect(jsonData.vendor).to.have.property('remoteId');",
" pm.expect(jsonData.vendor).to.have.property('vendorName');",
" pm.expect(jsonData.vendor).to.have.property('email');",
" pm.expect(jsonData.vendor).to.have.property('taxNumber');",
" pm.expect(jsonData.vendor).to.have.property('vendorStatus');",
" pm.expect(jsonData.vendor).to.have.property('currency');",
" pm.expect(jsonData.vendor).to.have.property('companyId');",
" pm.expect(jsonData.vendor).to.have.property('addresses');",
" pm.expect(jsonData.vendor.addresses).to.be.an('array').that.is.not.empty;",
" pm.expect(jsonData.vendor).to.have.property('phoneNumbers');",
" pm.expect(jsonData.vendor).to.have.property('remoteCreatedAt');",
" pm.expect(jsonData.vendor).to.have.property('remoteUpdatedAt');",
" pm.expect(jsonData.vendor).to.have.property('createdAt');",
" pm.expect(jsonData.vendor).to.have.property('updatedAt');",
" pm.expect(jsonData.vendor).to.have.property('id');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('addressType');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('street1');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('street2');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('city');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('state');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('country');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('countrySubdivision');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('country');",
" pm.expect(jsonData.vendor.addresses[0]).to.have.property('zipCode');",
"});",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
}
},
"request": {
"method": "PUT",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"vendorName\": \"AlloyUpdate+{{$randomUUID}}\",\n \"vendorStatus\": \"ACTIVE\",\n \"addresses\": [\n { \n \"addressType\": \"BILLING\",\n \"street1\": \"Dan Troy\",\n \"zipCode\": \"14221\",\n \"country\": \"US\"\n }\n ],\n \"phoneNumbers\": [\n {\n \"phoneNumberType\": \"PRIMARY\",\n \"phoneNumber\": \"09173210215\"\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/vendors/{{vendorId}}?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"vendors",
"{{vendorId}}"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Update Item",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"[qbo] item is retrieved correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('item');",
" pm.expect(jsonData.item).to.not.be.null;",
" pm.expect(jsonData.item).to.have.property('remoteId');",
" pm.expect(jsonData.item).to.have.property('itemName');",
" pm.expect(jsonData.item).to.have.property('itemStatus');",
" pm.expect(jsonData.item).to.have.property('itemType');",
" pm.expect(jsonData.item).to.have.property('unitPrice');",
" pm.expect(jsonData.item).to.have.property('purchasePrice');",
" pm.expect(jsonData.item).to.have.property('qtyOnHand');",
" pm.expect(jsonData.item).to.have.property('billAccountId');",
" pm.expect(jsonData.item).to.have.property('invoiceAccountId');",
" pm.expect(jsonData.item).to.have.property('assetAccountId');",
" pm.expect(jsonData.item).to.have.property('companyId');",
" pm.expect(jsonData.item).to.have.property('remoteCreatedAt');",
" pm.expect(jsonData.item).to.have.property('remoteUpdatedAt');",
" pm.expect(jsonData.item).to.have.property('createdAt');",
" pm.expect(jsonData.item).to.have.property('updatedAt');",
" pm.expect(jsonData.item).to.have.property('id');",
" pm.expect(jsonData.item.itemStatus).to.equal(\"ACTIVE\");",
"});",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
}
},
"request": {
"method": "PUT",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"itemStatus\": \"ACTIVE\",\n \"qtyOnHand\": 3\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/items/{{itemId}}?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"items",
"{{itemId}}"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Update Bill",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"bill is retrieved correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('bill');",
" pm.expect(jsonData.bill).to.not.be.null;",
" pm.expect(jsonData.bill).to.have.property('remoteId');",
" pm.expect(jsonData.bill).to.have.property('vendorId');",
" pm.expect(jsonData.bill).to.have.property('billNumber');",
" pm.expect(jsonData.bill).to.have.property('issueDate');",
" pm.expect(jsonData.bill).to.have.property('dueDate');",
" pm.expect(jsonData.bill).to.have.property('paidOnDate');",
" pm.expect(jsonData.bill).to.have.property('memo');",
" pm.expect(jsonData.bill).to.have.property('companyId');",
" pm.expect(jsonData.bill).to.have.property('currency');",
" pm.expect(jsonData.bill).to.have.property('exchangeRate');",
" pm.expect(jsonData.bill).to.have.property('totalDiscount');",
" pm.expect(jsonData.bill).to.have.property('subTotal');",
" pm.expect(jsonData.bill).to.have.property('billStatus');",
" pm.expect(jsonData.bill).to.have.property('totalTaxAmount');",
" pm.expect(jsonData.bill).to.have.property('totalAmount');",
" pm.expect(jsonData.bill).to.have.property('balance');",
" pm.expect(jsonData.bill).to.have.property('trackingCategories');",
" pm.expect(jsonData.bill).to.have.property('lineItems');",
" pm.expect(jsonData.bill).to.have.property('purchaseOrders');",
" pm.expect(jsonData.bill).to.have.property('remoteCreatedAt');",
" pm.expect(jsonData.bill).to.have.property('remoteUpdatedAt');",
" pm.expect(jsonData.bill).to.have.property('createdAt');",
" pm.expect(jsonData.bill).to.have.property('updatedAt');",
" pm.expect(jsonData.bill).to.have.property('id');",
"});",
"",
"var jsonData = pm.response.json();",
"let billId = jsonData.bill.id;",
"postman.setEnvironmentVariable(\"billId\", billId);"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
}
},
"request": {
"method": "PUT",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"issueDate\": \"2024-04-10\",\n \"dueDate\": \"2024-05-01\",\n \"lineItems\": [\n {\n \"description\": \"Line Item 2\",\n \"trackingCategoryId\": \"{{trackingCategoryId}}\",\n \"quantity\": 1,\n \"unitPrice\": 1\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/bills/{{billId}}?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"bills",
"{{billId}}"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Update Invoice",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"[qbo] invoice is retrieved correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('invoice');",
" pm.expect(jsonData.invoice).to.not.be.null;",
" pm.expect(jsonData.invoice).to.have.property('remoteId');",
" pm.expect(jsonData.invoice).to.have.property('customerId');",
" pm.expect(jsonData.invoice).to.have.property('invoiceNumber');",
" pm.expect(jsonData.invoice).to.have.property('issueDate');",
" pm.expect(jsonData.invoice).to.have.property('dueDate');",
" pm.expect(jsonData.invoice).to.have.property('paidOnDate');",
" pm.expect(jsonData.invoice).to.have.property('memo');",
" pm.expect(jsonData.invoice).to.have.property('companyId');",
" pm.expect(jsonData.invoice).to.have.property('currency');",
" pm.expect(jsonData.invoice).to.have.property('exchangeRate');",
" pm.expect(jsonData.invoice).to.have.property('totalDiscount');",
" pm.expect(jsonData.invoice).to.have.property('subTotal');",
" pm.expect(jsonData.invoice).to.have.property('invoiceStatus');",
" pm.expect(jsonData.invoice).to.have.property('totalTaxAmount');",
" pm.expect(jsonData.invoice).to.have.property('totalAmount');",
" pm.expect(jsonData.invoice).to.have.property('balance');",
" pm.expect(jsonData.invoice).to.have.property('trackingCategories');",
" pm.expect(jsonData.invoice).to.have.property('lineItems');",
" pm.expect(jsonData.invoice).to.have.property('purchaseOrders');",
" pm.expect(jsonData.invoice).to.have.property('remoteCreatedAt');",
" pm.expect(jsonData.invoice).to.have.property('remoteUpdatedAt');",
" pm.expect(jsonData.invoice).to.have.property('createdAt');",
" pm.expect(jsonData.invoice).to.have.property('updatedAt');",
" pm.expect(jsonData.invoice).to.have.property('id');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('id');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('remoteId');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('description');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('unitPrice');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('quantity');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('totalAmount');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('currency');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('exchangeRate');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('accountingItemId');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('accountId');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('trackingCategoryId');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('trackingCategoryIds');",
" pm.expect(jsonData.invoice.lineItems[0]).to.have.property('companyId');",
"});",
"",
"var jsonData = pm.response.json();",
"let invoiceId = jsonData.invoice.id;",
"postman.setEnvironmentVariable(\"invoiceId\", invoiceId);"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
}
},
"request": {
"method": "PUT",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"lineItems\": [\n {\n \"description\": \"Francis Menguito - Developer\",\n \"unitPrice\": 12,\n \"quantity\":3\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/invoices/{{invoiceId}}?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"invoices",
"{{invoiceId}}"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Update Payment",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"[qbo] payment is created correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('payment');",
" pm.expect(jsonData.payment).to.not.be.null;",
" pm.expect(jsonData.payment).to.have.property('remoteId');",
" pm.expect(jsonData.payment).to.have.property('transactionDate');",
" pm.expect(jsonData.payment).to.have.property('customerId');",
" pm.expect(jsonData.payment).to.have.property('vendorId');",
" pm.expect(jsonData.payment).to.have.property('accountId');",
" pm.expect(jsonData.payment).to.have.property('currency');",
" pm.expect(jsonData.payment).to.have.property('exchangeRate');",
" pm.expect(jsonData.payment).to.have.property('companyId');",
" pm.expect(jsonData.payment).to.have.property('totalAmount');",
" pm.expect(jsonData.payment).to.have.property('trackingCategoryIds');",
" pm.expect(jsonData.payment).to.have.property('remoteCreatedAt');",
" pm.expect(jsonData.payment).to.have.property('remoteUpdatedAt');",
" pm.expect(jsonData.payment).to.have.property('createdAt');",
" pm.expect(jsonData.payment).to.have.property('updatedAt');",
" pm.expect(jsonData.payment).to.have.property('id');",
"});",
"",
"var jsonData = pm.response.json();",
"let paymentId = jsonData.payment.id;",
"postman.setEnvironmentVariable(\"paymentId\", paymentId);",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
}
},
"request": {
"method": "PUT",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"totalAmount\": 10,\n \"transactionDate\": \"2024-04-11\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/payments/{{paymentId}}?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"payments",
"{{paymentId}}"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
}
]
},
{
"name": "03 List and Count",
"item": [
{
"name": "List Company Info",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 501\"] = responseCode.code === 501;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"Status code is 501\", function () {",
" pm.response.to.have.status(501);",
"});",
"",
"pm.test(\"Body has code and message\", function () {",
" let jsonData = pm.response.json();",
" console.log(jsonData);",
" pm.expect(jsonData).to.have.property('code');",
" pm.expect(jsonData).to.have.property('message');",
"});",
"",
"pm.test(\"Code is MODEL_NOT_SUPPORTED\", function () {",
" let jsonData = pm.response.json();",
" pm.expect(jsonData.code).to.eql(\"MODEL_NOT_SUPPORTED\");",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
},
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/company-info?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": ["{{API_VERSION}}", "one", "accounting", "company-info"],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Get Company Info Count",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 501\"] = responseCode.code === 501;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"Status code is 501\", function () {",
" pm.response.to.have.status(501);",
"});",
"",
"pm.test(\"Body has code and message\", function () {",
" let jsonData = pm.response.json();",
" console.log(jsonData);",
" pm.expect(jsonData).to.have.property('code');",
" pm.expect(jsonData).to.have.property('message');",
"});",
"",
"pm.test(\"Code is MODEL_NOT_SUPPORTED\", function () {",
" let jsonData = pm.response.json();",
" pm.expect(jsonData.code).to.eql(\"MODEL_NOT_SUPPORTED\");",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
},
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/company-info/count?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"company-info",
"count"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Retrieve Company Info",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 501\"] = responseCode.code === 501;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"Status code is 501\", function () {",
" pm.response.to.have.status(501);",
"});",
"",
"pm.test(\"Body has code and message\", function () {",
" let jsonData = pm.response.json();",
" console.log(jsonData);",
" pm.expect(jsonData).to.have.property('code');",
" pm.expect(jsonData).to.have.property('message');",
"});",
"",
"pm.test(\"Code is MODEL_NOT_SUPPORTED\", function () {",
" let jsonData = pm.response.json();",
" pm.expect(jsonData.code).to.eql(\"MODEL_NOT_SUPPORTED\");",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
},
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/company-info/{{companyInfoId}}?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"company-info",
"{{companyInfoId}}"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "List Accounts",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 501\"] = responseCode.code === 501;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"Status code is 501\", function () {",
" pm.response.to.have.status(501);",
"});",
"",
"pm.test(\"Body has code and message\", function () {",
" let jsonData = pm.response.json();",
" console.log(jsonData);",
" pm.expect(jsonData).to.have.property('code');",
" pm.expect(jsonData).to.have.property('message');",
"});",
"",
"pm.test(\"Code is MODEL_NOT_SUPPORTED\", function () {",
" let jsonData = pm.response.json();",
" pm.expect(jsonData.code).to.eql(\"MODEL_NOT_SUPPORTED\");",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
},
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "urlencoded",
"urlencoded": []
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/accounts?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": ["{{API_VERSION}}", "one", "accounting", "accounts"],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Get Account Count",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 501\"] = responseCode.code === 501;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"Status code is 501\", function () {",
" pm.response.to.have.status(501);",
"});",
"",
"pm.test(\"Body has code and message\", function () {",
" let jsonData = pm.response.json();",
" console.log(jsonData);",
" pm.expect(jsonData).to.have.property('code');",
" pm.expect(jsonData).to.have.property('message');",
"});",
"",
"pm.test(\"Code is MODEL_NOT_SUPPORTED\", function () {",
" let jsonData = pm.response.json();",
" pm.expect(jsonData.code).to.eql(\"MODEL_NOT_SUPPORTED\");",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
},
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/accounts/count?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"accounts",
"count"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "List Customers",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"[qbo] customers are listed correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('customers');",
" pm.expect(jsonData.customers[0]).to.not.be.null;",
" pm.expect(jsonData.customers[0]).to.have.property('remoteId');",
" pm.expect(jsonData.customers[0]).to.have.property('customerName');",
" pm.expect(jsonData.customers[0]).to.have.property('email');",
" pm.expect(jsonData.customers[0]).to.have.property('taxNumber');",
" pm.expect(jsonData.customers[0]).to.have.property('customerStatus');",
" pm.expect(jsonData.customers[0]).to.have.property('currency');",
" pm.expect(jsonData.customers[0]).to.have.property('companyId');",
" pm.expect(jsonData.customers[0]).to.have.property('addresses');",
" pm.expect(jsonData.customers[0].addresses).to.be.an('array');",
" if(jsonData.customers[0].addresses.length > 0) {",
" pm.expect(jsonData.customers[0].addresses[0]).to.have.property('addressType');",
" pm.expect(jsonData.customers[0].addresses[0]).to.have.property('street1');",
" }",
" pm.expect(jsonData.customers[0]).to.have.property('phoneNumbers');",
" pm.expect(jsonData.customers[0].phoneNumbers).to.be.an('array');",
" if(jsonData.customers[0].phoneNumbers.length > 0) {",
" pm.expect(jsonData.customers[0].phoneNumbers[0]).to.have.property('phoneNumberType');",
" pm.expect(jsonData.customers[0].phoneNumbers[0]).to.have.property('phoneNumber');",
" }",
" pm.expect(jsonData.customers[0]).to.have.property('remoteCreatedAt');",
" pm.expect(jsonData.customers[0]).to.have.property('remoteUpdatedAt');",
" pm.expect(jsonData.customers[0]).to.have.property('createdAt');",
" pm.expect(jsonData.customers[0]).to.have.property('updatedAt');",
" pm.expect(jsonData.customers[0]).to.have.property('id');",
"});",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
},
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/customers?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": ["{{API_VERSION}}", "one", "accounting", "customers"],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "Get Customers Count",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"[qbo] customer count is displayed correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('count');",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
},
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/{{API_VERSION}}/one/accounting/customers/count?credentialId={{freshbooksCredentialId}}",
"host": ["{{URL}}"],
"path": [
"{{API_VERSION}}",
"one",
"accounting",
"customers",
"count"
],
"query": [
{
"key": "credentialId",
"value": "{{freshbooksCredentialId}}"
}
]
}
},
"response": []
},
{
"name": "List Vendors",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"[qbo] vendors are listed correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('vendors');",
" pm.expect(jsonData.vendors[0]).to.not.be.null;",