{ "info": { "_postman_id": "d2f383ea-8ccb-422d-9a82-9832eb6c729a", "name": "MyCRM API Sample", "description": "To use this sample it is necessary to populate the `Variables` section with the values supplied to you by Loan Market Group. This will enable the various samples to interact with your broker account in MyCRM. \n\n**NOTE:** If you are looking to replicate the behaviour of these samples, be sure to check the `Pre-request Script` section where the authorization flow is handled.", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "813965" }, "item": [ { "name": "Advisers", "item": [ { "name": "Relationships", "item": [ { "name": "Get Last Adviser Details", "event": [ { "listen": "test", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/advisers/:id?include=adviserDetails", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "advisers", ":id" ], "query": [ { "key": "include", "value": "adviserDetails" } ], "variable": [ { "key": "id", "value": "{{lastAdviserId}}" } ] } }, "response": [] }, { "name": "Get Last Adviser Org", "event": [ { "listen": "test", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/advisers/:id?include=organisation", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "advisers", ":id" ], "query": [ { "key": "include", "value": "organisation" } ], "variable": [ { "key": "id", "value": "{{lastAdviserId}}" } ] } }, "response": [] }, { "name": "Get Last Adviser Agreement Holder", "event": [ { "listen": "test", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/advisers/:id?include=agreementHolders.organisation", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "advisers", ":id" ], "query": [ { "key": "include", "value": "agreementHolders.organisation" } ], "variable": [ { "key": "id", "value": "{{lastAdviserId}}" } ] } }, "response": [] }, { "name": "Get Last Adviser Contacts", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/advisers/:id?include=contactGroups.contacts", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "advisers", ":id" ], "query": [ { "key": "include", "value": "contactGroups.contacts" } ], "variable": [ { "key": "id", "value": "{{lastAdviserId}}" } ] } }, "response": [] } ] }, { "name": "Field Selection", "item": [ { "name": "Get Adviser Email", "event": [ { "listen": "test", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/advisers?page[size]=100&sort=-id&fields[advisers]=email", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "advisers" ], "query": [ { "key": "page[size]", "value": "100" }, { "key": "sort", "value": "-id" }, { "key": "fields[advisers]", "value": "email" } ] } }, "response": [] } ] }, { "name": "Get Advisers", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Get Contact Groups\", function () {", " pm.response.to.have.status(200);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " if (pm.response.json().data && pm.response.json().data.length) {", " pm.collectionVariables.set('lastAdviserId', pm.response.json().data[0].id);", " }", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/advisers?page[size]=100&sort=-id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "advisers" ], "query": [ { "key": "page[size]", "value": "100" }, { "key": "sort", "value": "-id" } ] } }, "response": [] }, { "name": "Get Last Adviser", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/advisers/:id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "advisers", ":id" ], "variable": [ { "key": "id", "value": "{{lastAdviserId}}" } ] } }, "response": [] }, { "name": "Notification of an Adviser update", "request": { "auth": { "type": "noauth" }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"action\": \"updated\",\n \"resource\": {\n \"type\": \"advisers\",\n \"id\": 1123,\n \"url\": \"https://api.mycrm/jsonapi/advisers/1123\"\n },\n \"webhook\": {\n \"name\": \"Example Adviser Webhook\"\n }\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "https://httpstat.us/200?message=Replace with your webhook endpoint", "protocol": "https", "host": [ "httpstat", "us" ], "path": [ "200" ], "query": [ { "key": "message", "value": "Replace with your webhook endpoint" } ] } }, "response": [] } ] }, { "name": "Adviser Details", "item": [ { "name": "Field Selection", "item": [ { "name": "Get Adviser Details Email Only", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Get Contact Groups\", function () {", " pm.response.to.have.status(200);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " if (pm.response.json().data && pm.response.json().data.length) {", " pm.collectionVariables.set('lastContactId', pm.response.json().data[0].id);", " }", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/adviser-details?page[size]=100&sort=-id&fields[adviser-details]=email", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "adviser-details" ], "query": [ { "key": "page[size]", "value": "100" }, { "key": "sort", "value": "-id" }, { "key": "fields[adviser-details]", "value": "email" } ] } }, "response": [] } ] }, { "name": "Get Adviser Details", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Get Contact Groups\", function () {", " pm.response.to.have.status(200);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " if (pm.response.json().data && pm.response.json().data.length) {", " pm.collectionVariables.set('lastAdviserDetailsId', pm.response.json().data[0].id);", " }", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/adviser-details?page[size]=100&sort=-id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "adviser-details" ], "query": [ { "key": "page[size]", "value": "100" }, { "key": "sort", "value": "-id" } ] } }, "response": [] }, { "name": "Get Last Adviser Details", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/adviser-details/:id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "adviser-details", ":id" ], "variable": [ { "key": "id", "value": "{{lastAdviserDetailsId}}" } ] } }, "response": [] } ] }, { "name": "Contact Groups", "item": [ { "name": "Relationships", "item": [ { "name": "Get Contact Group Referrers", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contact-groups?sort=-id&include=referrer,referrerOrganisation", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contact-groups" ], "query": [ { "key": "sort", "value": "-id" }, { "key": "include", "value": "referrer,referrerOrganisation" } ] } }, "response": [] }, { "name": "Get Contact Groups Contacts", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Get Contact Groups\", function () {", " pm.response.to.have.status(200);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " if (pm.response.json().data && pm.response.json().data.length) {", " pm.collectionVariables.set('lastContactGroupId', pm.response.json().data[0].id);", " }", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contact-groups?sort=-id&include=contacts", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contact-groups" ], "query": [ { "key": "sort", "value": "-id" }, { "key": "include", "value": "contacts" } ] } }, "response": [] }, { "name": "Get Last Contact Group Contacts", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Get Contact Groups\", function () {", " pm.response.to.have.status(200);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " if (pm.response.json().data && pm.response.json().data.length) {", " pm.collectionVariables.set('lastContactId', pm.response.json().data[0].id);", " }", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contact-groups/:id/contacts", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contact-groups", ":id", "contacts" ], "variable": [ { "key": "id", "value": "{{lastContactGroupId}}" } ] } }, "response": [] }, { "name": "Get Contact Group Adviser", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/contact-groups/:id?include=adviser.adviserDetails", "host": [ "{{PublicAPI_Url}}" ], "path": [ "contact-groups", ":id" ], "query": [ { "key": "include", "value": "adviser.adviserDetails" } ], "variable": [ { "key": "id", "value": "{{lastContactGroupId}}" } ] } }, "response": [] } ] }, { "name": "Field selection", "item": [ { "name": "Get Contact Groups Fields", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Get Contact Groups\", function () {", " pm.response.to.have.status(200);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " if (pm.response.json().data && pm.response.json().data.length) {", " pm.collectionVariables.set('lastContactGroupId', pm.response.json().data[0].id);", " }", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contact-groups?sort=-id&fields[contact-groups]=utmCampaign,updated", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contact-groups" ], "query": [ { "key": "sort", "value": "-id" }, { "key": "fields[contact-groups]", "value": "utmCampaign,updated" } ] } }, "response": [] }, { "name": "Get Last Contact Group Contact Email", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Get Contact Groups\", function () {", " pm.response.to.have.status(200);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " if (pm.response.json().data && pm.response.json().data.length) {", " pm.collectionVariables.set('lastContactId', pm.response.json().data[0].id);", " }", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contact-groups/:id/contacts?fields[contacts]=email", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contact-groups", ":id", "contacts" ], "query": [ { "key": "fields[contacts]", "value": "email" } ], "variable": [ { "key": "id", "value": "{{lastContactGroupId}}" } ] } }, "response": [] } ] }, { "name": "Filtering", "item": [ { "name": "Get Contact Groups Recent Update", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Get Contact Groups\", function () {", " pm.response.to.have.status(200);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " if (pm.response.json().data && pm.response.json().data.length) {", " pm.collectionVariables.set('lastContactGroupId', pm.response.json().data[0].id);", " }", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contact-groups?sort=-id&filter=and(greaterOrEqual(updated,'2021-08-01'),not(equals(utmCampaign,null)))", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contact-groups" ], "query": [ { "key": "sort", "value": "-id" }, { "key": "filter", "value": "and(greaterOrEqual(updated,'2021-08-01'),not(equals(utmCampaign,null)))" } ] } }, "response": [] } ] }, { "name": "Get Contact Groups", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Get Contact Groups\", function () {", " pm.response.to.have.status(200);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " if (pm.response.json().data && pm.response.json().data.length) {", " pm.collectionVariables.set('lastContactGroupId', pm.response.json().data[0].id);", " }", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contact-groups?sort=-id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contact-groups" ], "query": [ { "key": "sort", "value": "-id" } ] } }, "response": [] }, { "name": "Add Contact Group", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Add Contact Group\", function () {", " pm.response.to.have.status(201);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " pm.collectionVariables.set('lastContactGroupId', pm.response.json().data.id);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"type\": \"contact-groups\",\n \"attributes\": {\n \"utmSource\": \"facebook\",\n \"utmMedium\": \"social\",\n \"utmTerm\": \"investment\",\n \"utmContent\": \"lm\",\n \"utmCampaign\": \"mycrm-fb\"\n }\n }\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contact-groups", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contact-groups" ] } }, "response": [] }, { "name": "Get Last Contact Group", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contact-groups/:id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contact-groups", ":id" ], "variable": [ { "key": "id", "value": "{{lastContactGroupId}}" } ] } }, "response": [] }, { "name": "Update Contact Group", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Save Last Contact Group\", function () {", " pm.response.to.have.status(201);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " pm.collectionVariables.set('lastContactGroupId', pm.response.json().data.id);", "});" ], "type": "text/javascript" } } ], "request": { "method": "PATCH", "header": [], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"type\": \"contact-groups\",\n \"id\": \"{{lastContactGroupId}}\",\n \"attributes\": {\n \"name\": \"Stone Patch\",\n \"utmSource\": \"facebook\",\n \"utmMedium\": \"social\",\n \"utmTerm\": \"investment\",\n \"utmContent\": \"lm\",\n \"utmCampaign\": \"mycrm-fb\",\n \"referrerId\": null,\n \"referrerOrgId\": null,\n \"referrerOrgName\": null,\n \"referrerName\": null\n }\n }\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contact-groups/:id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contact-groups", ":id" ], "variable": [ { "key": "id", "value": "{{lastContactGroupId}}" } ] } }, "response": [] }, { "name": "Delete Contact Group", "request": { "method": "DELETE", "header": [], "body": { "mode": "raw", "raw": "", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contact-groups/:id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contact-groups", ":id" ], "variable": [ { "key": "id", "value": "{{lastContactGroupId}}" } ] } }, "response": [] } ] }, { "name": "Contacts", "item": [ { "name": "Relationships", "item": [ { "name": "Get Last Contact Addresses", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contacts/:id?include=contactAddress", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contacts", ":id" ], "query": [ { "key": "include", "value": "contactAddress" } ], "variable": [ { "key": "id", "value": "{{lastContactId}}" } ] } }, "response": [] }, { "name": "Get Last Contact Financials", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contacts/:id?include=ownership,ownership.asset,ownership.liability,ownership.income,ownership.expense", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contacts", ":id" ], "query": [ { "key": "include", "value": "ownership,ownership.asset,ownership.liability,ownership.income,ownership.expense" } ], "variable": [ { "key": "id", "value": "{{lastContactId}}" } ] } }, "response": [] } ] }, { "name": "Filtering", "item": [ { "name": "Get Recent Contacts w marketing consent", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Get Contact Groups\", function () {", " pm.response.to.have.status(200);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " if (pm.response.json().data && pm.response.json().data.length) {", " pm.collectionVariables.set('lastContactId', pm.response.json().data[0].id);", " }", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contacts?page[size]=20&sort=-id&filter=and(equals(hasMarketingConsent,'true'),greaterThan(updated,'2021-07-01'))", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contacts" ], "query": [ { "key": "page[size]", "value": "20" }, { "key": "sort", "value": "-id" }, { "key": "filter", "value": "and(equals(hasMarketingConsent,'true'),greaterThan(updated,'2021-07-01'))" } ] } }, "response": [] } ] }, { "name": "Field Selection", "item": [ { "name": "Get Contacts Email and Consent", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Get Contact Groups\", function () {", " pm.response.to.have.status(200);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " if (pm.response.json().data && pm.response.json().data.length) {", " pm.collectionVariables.set('lastContactId', pm.response.json().data[0].id);", " }", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contacts?page[size]=100&sort=-id&fields[contacts]=email,hasMarketingConsent,updated", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contacts" ], "query": [ { "key": "page[size]", "value": "100" }, { "key": "sort", "value": "-id" }, { "key": "fields[contacts]", "value": "email,hasMarketingConsent,updated" } ] } }, "response": [] } ] }, { "name": "Get Contacts", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Get Contact Groups\", function () {", " pm.response.to.have.status(200);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " if (pm.response.json().data && pm.response.json().data.length) {", " pm.collectionVariables.set('lastContactId', pm.response.json().data[0].id);", " }", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contacts?page[size]=100&sort=-id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contacts" ], "query": [ { "key": "page[size]", "value": "100" }, { "key": "sort", "value": "-id" } ] } }, "response": [] }, { "name": "Get Last Contact", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contacts/:id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contacts", ":id" ], "variable": [ { "key": "id", "value": "{{lastContactId}}" } ] } }, "response": [] }, { "name": "Add Contact", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Save Last Contact\", function () {", " pm.response.to.have.status(201);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " pm.collectionVariables.set('lastContactId', pm.response.json().data.id);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"type\": \"contacts\",\n \"attributes\": {\n \"title\": \"Mr\",\n \"firstName\": \"Fred{{lastContactGroupId}}\",\n \"lastName\": \"Flintstone\",\n \"preferredName\": \"Wilma{{lastContactGroupId}}\",\n \"mobile\": \"041{{lastContactGroupId}}\",\n \"email\": \"wilma.flintstone-{{lastContactGroupId}}@email.com\"\n },\n \"relationships\": {\n \"contactGroup\": {\n \"data\": {\n \"type\": \"contact-groups\",\n \"id\": \"{{lastContactGroupId}}\"\n }\n }\n }\n }\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contacts", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contacts" ] } }, "response": [] }, { "name": "Update Contact", "request": { "method": "PATCH", "header": [], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"type\": \"contacts\",\n \"id\": \"{{lastContactId}}\",\n \"attributes\": {\n \"middleName\": \"Howard\",\n \"mobile\": \"040{{lastContactGroupId}}\",\n \"email\": \"patched-{{lastContactGroupId}}@email.com\",\n \"dateOfBirth\": \"1943-05-13\",\n \"marketingConsent\": true\n }\n }\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contacts/{{lastContactId}}", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contacts", "{{lastContactId}}" ] } }, "response": [] }, { "name": "Update Contact Marketing", "request": { "method": "PATCH", "header": [], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"type\": \"contact-marketing\",\n \"id\": \"{{lastContactId}}\",\n \"attributes\": {\n \"hasMarketingConsent\": false\n }\n }\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contact-marketing/:id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contact-marketing", ":id" ], "variable": [ { "key": "id", "value": "{{lastContactId}}" } ] } }, "response": [] }, { "name": "Get Contact Marketing", "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "method": "GET", "header": [], "body": { "mode": "raw", "raw": "", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contact-marketing/:id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contact-marketing", ":id" ], "variable": [ { "key": "id", "value": "{{lastContactId}}" } ] } }, "response": [] }, { "name": "Delete Contact", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contacts/:id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contacts", ":id" ], "variable": [ { "key": "id", "value": "{{lastContactId}}" } ] } }, "response": [] }, { "name": "Notification of a Contact update", "request": { "auth": { "type": "noauth" }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"action\": \"updated\",\n \"resource\": {\n \"type\": \"contacts\",\n \"id\": 1123,\n \"url\": \"https://api.mycrm/jsonapi/contacts/1123\"\n },\n \"webhook\": {\n \"name\": \"Example Contact Webhook\"\n }\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "https://httpstat.us/200?message=Replace with your webhook endpoint", "protocol": "https", "host": [ "httpstat", "us" ], "path": [ "200" ], "query": [ { "key": "message", "value": "Replace with your webhook endpoint" } ] } }, "response": [] } ] }, { "name": "Deals", "item": [ { "name": "Relationships", "item": [ { "name": "Get Deal Participants", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/deals/:dealId/participants", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "deals", ":dealId", "participants" ], "query": [ { "key": "include", "value": "contacts", "disabled": true } ], "variable": [ { "key": "dealId", "value": "{{lastDealId}}" } ] } }, "response": [] }, { "name": "Get Deal High Level Summary", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/deals/:id?include=dealScenario.highLevelSummary", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "deals", ":id" ], "query": [ { "key": "include", "value": "dealScenario.highLevelSummary" } ], "variable": [ { "key": "id", "value": "{{lastDealId}}" } ] } }, "response": [] }, { "name": "Get Deal Adviser Details", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/deals/:dealId/adviser?include=adviserDetails", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "deals", ":dealId", "adviser" ], "query": [ { "key": "include", "value": "contacts", "disabled": true }, { "key": "include", "value": "adviserDetails" } ], "variable": [ { "key": "dealId", "value": "{{lastDealId}}" } ] } }, "response": [] }, { "name": "Get Deal Include Adviser Details", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/deals/:dealId?include=adviser.adviserDetails", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "deals", ":dealId" ], "query": [ { "key": "include", "value": "contacts", "disabled": true }, { "key": "include", "value": "adviser.adviserDetails" } ], "variable": [ { "key": "dealId", "value": "{{lastDealId}}" } ] } }, "response": [] } ] }, { "name": "Field Selection", "item": [ { "name": "Get Deals Custom Status Name", "event": [ { "listen": "test", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/deals?sort=-id&fields[deals]=updated,customStatusName", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "deals" ], "query": [ { "key": "sort", "value": "-id" }, { "key": "fields[deals]", "value": "updated,customStatusName" } ] } }, "response": [] } ] }, { "name": "Filtering", "item": [ { "name": "Get Deals w recent updates", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Get Deals\", function () {", " pm.response.to.have.status(200);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " if (pm.response.json().data && pm.response.json().data.length) {", " pm.collectionVariables.set('lastDealId', pm.response.json().data[0].id);", " }", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/deals?sort=-id&filter=greaterOrEqual(updated,'2021-08-01')", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "deals" ], "query": [ { "key": "sort", "value": "-id" }, { "key": "filter", "value": "greaterOrEqual(updated,'2021-08-01')" } ] } }, "response": [] } ] }, { "name": "Get Deals", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Get Deals\", function () {", " pm.response.to.have.status(200);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " if (pm.response.json().data && pm.response.json().data.length) {", " pm.collectionVariables.set('lastDealId', pm.response.json().data[0].id);", " }", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/deals?sort=-id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "deals" ], "query": [ { "key": "sort", "value": "-id" } ] } }, "response": [] }, { "name": "Get Last Deal", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/deals/:id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "deals", ":id" ], "variable": [ { "key": "id", "value": "{{lastDealId}}" } ] } }, "response": [] }, { "name": "Notification of a Deal update", "request": { "auth": { "type": "noauth" }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"action\": \"updated\",\n \"resource\": {\n \"type\": \"deals\",\n \"id\": 1123,\n \"url\": \"https://api.mycrm/jsonapi/deals/1123\"\n },\n \"webhook\": {\n \"name\": \"Example Deal Webhook\"\n }\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "https://httpstat.us/200?message=Replace with your webhook endpoint", "protocol": "https", "host": [ "httpstat", "us" ], "path": [ "200" ], "query": [ { "key": "message", "value": "Replace with your webhook endpoint" } ] } }, "response": [] } ] }, { "name": "Deal Notes", "item": [ { "name": "Add Deal Note", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Add Deal\", function () {", " pm.response.to.have.status(201);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " pm.collectionVariables.set('lastDealNoteId', pm.response.json().data.id);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"type\": \"deal-notes\",\n \"attributes\": {\n \"title\": \"A note on the last deal\",\n \"detail\": \"These are some deal note details\"\n },\n \"relationships\": {\n \"deal\": {\n \"data\": {\n \"type\": \"deals\",\n \"id\": \"{{lastDealId}}\"\n }\n }\n }\n }\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{PublicAPI_Url}}/jsonapi/deal-notes", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "deal-notes" ] } }, "response": [] }, { "name": "Update Deal Note", "event": [ { "listen": "test", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "PATCH", "header": [], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"type\": \"deal-notes\",\n \"id\": \"{{lastDealNoteId}}\",\n \"attributes\": {\n \"title\": \"Title update for deal note {{lastDealNoteId}}\",\n \"detail\": \"Body update for deal note {{lastDealNoteId}}\"\n }\n }\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{PublicAPI_Url}}/jsonapi/deal-notes/:id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "deal-notes", ":id" ], "variable": [ { "key": "id", "value": "{{lastDealNoteId}}" } ] } }, "response": [] }, { "name": "Get Last Deal Note", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/deal-notes/:id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "deal-notes", ":id" ], "variable": [ { "key": "id", "value": "{{lastDealNoteId}}" } ] } }, "response": [] } ] }, { "name": "Integrations", "item": [ { "name": "Get Integrations", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/integrations", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "integrations" ] } }, "response": [] }, { "name": "Add Integration", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Save Last Integration\", function () {", " pm.response.to.have.status(201);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " pm.collectionVariables.set('lastIntegrationId', pm.response.json().data.id);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"type\": \"integrations\",\n \"attributes\": {\n \"name\": \"Testing\",\n \"description\": \"Testing Integration\"\n }\n }\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{PublicAPI_Url}}/jsonapi/integrations", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "integrations" ] } }, "response": [] }, { "name": "Delete Integration", "request": { "method": "GET", "header": [], "url": { "raw": "" } }, "response": [] } ] }, { "name": "Deal External Refs", "item": [ { "name": "Filtering", "item": [ { "name": "Get Deals by External Ref", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/deal-external-references?page[size]=100&sort=-id&filter=and(equals(integration.name,'MyIntegrationSource'),equals(externalReference,'ABC1234'))&include=deal", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "deal-external-references" ], "query": [ { "key": "page[size]", "value": "100" }, { "key": "sort", "value": "-id" }, { "key": "filter", "value": "and(equals(integration.name,'MyIntegrationSource'),equals(externalReference,'ABC1234'))" }, { "key": "include", "value": "deal" } ] } }, "response": [] } ] }, { "name": "Get Deal External Refs", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/deal-external-references?sort=-id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "deal-external-references" ], "query": [ { "key": "sort", "value": "-id" } ] } }, "response": [] }, { "name": "Add Deal External Ref", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Add Deal External Ref\", function () {", " pm.response.to.have.status(201);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " pm.collectionVariables.set('lastDealExternalRefId', pm.response.json().data.id);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"type\": \"deal-external-references\",\n \"attributes\": {\n \"externalReference\": \"freddyloan123abc\"\n },\n \"relationships\": {\n \"deal\": {\n \"data\": {\n \"type\": \"deals\",\n \"id\": \"{{lastDealId}}\"\n }\n },\n \"integration\": {\n \"data\": {\n \"type\": \"integrations\",\n \"id\": \"{{lastIntegrationId}}\"\n }\n }\n }\n }\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{PublicAPI_Url}}/jsonapi/deal-external-references", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "deal-external-references" ] } }, "response": [] }, { "name": "Delete Deal External Ref", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/deal-external-references/:id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "deal-external-references", ":id" ], "variable": [ { "key": "id", "value": "{{lastDealExternalRefId}}" } ] } }, "response": [] } ] }, { "name": "Contact External Refs", "item": [ { "name": "Filtering", "item": [ { "name": "Get Contacts by External Ref", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contact-external-references?page[size]=100&sort=-id&filter=and(equals(integration.name,'Testing'),equals(externalReference,'freddy{{lastIntegrationId}}'))&include=contact", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contact-external-references" ], "query": [ { "key": "page[size]", "value": "100" }, { "key": "sort", "value": "-id" }, { "key": "filter", "value": "and(equals(integration.name,'Testing'),equals(externalReference,'freddy{{lastIntegrationId}}'))" }, { "key": "include", "value": "contact" } ] } }, "response": [] } ] }, { "name": "Get Contact External Refs", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contact-external-references?sort=-id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contact-external-references" ], "query": [ { "key": "sort", "value": "-id" } ] } }, "response": [] }, { "name": "Add Contact External Ref", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Add Contact External Ref\", function () {", " pm.response.to.have.status(201);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " pm.collectionVariables.set('lastContactExternalRefId', pm.response.json().data.id);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"type\": \"contact-external-references\",\n \"attributes\": {\n \"externalReference\": \"freddy{{lastIntegrationId}}\"\n },\n \"relationships\": {\n \"contact\": {\n \"data\" : { \n \"type\": \"contacts\", \n \"id\": \"{{lastContactId}}\"\n }\n },\n \"integration\": {\n \"data\": {\n \"type\": \"integrations\",\n \"id\": \"{{lastIntegrationId}}\"\n }\n }\n }\n }\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contact-external-references", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contact-external-references" ] } }, "response": [] }, { "name": "Delete Contact External Ref", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/contact-external-references/:id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "contact-external-references", ":id" ], "variable": [ { "key": "id", "value": "{{lastContactExternalRefId}}" } ] } }, "response": [] } ] }, { "name": "Referrers", "item": [ { "name": "Get Referrers", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/referrers", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "referrers" ] } }, "response": [] } ] }, { "name": "Leads", "item": [ { "name": "Add Lead", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Add Lead\", function () {", " pm.response.to.have.status(201);", " pm.response.to.be.json;", " pm.response.to.not.have.jsonBody('errors');", " pm.collectionVariables.set('lastDealId', pm.response.json().data.id);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"type\": \"leads\",\n \"attributes\": {\n \"title\": \"Mr\",\n \"firstName\": \"Fred\",\n \"preferredName\": null,\n \"lastName\": \"Flintstone\",\n \"email\": \"fred@bedrock.com\",\n \"mobile\": \"0412345678\",\n \"dateOfBirth\": \"2000-07-29\",\n \"gender\": \"Male\",\n \"hasMarketingConsent\": true,\n \"isGuarantor\": false,\n \"isDependant\": false,\n \"isPrimary\": true,\n\n \"streetAddress\": \"111 Eagle St\",\n \"suburb\": \"Brisbane\",\n \"state\": \"Queensland\",\n \"postCode\": \"4000\",\n \"country\": \"Australia\",\n \"addressType\": \"Current\",\n\n \"noteTitle\": \"About the lead\",\n \"noteDetails\": \"This is why it happened\",\n\n \"utmSource\": \"facebook\",\n \"utmMedium\": \"social\",\n \"utmCampaign\": \"mycrm-fb\",\n \"utmTerm\": \"investment\",\n \"utmContent\": \"lm\",\n \n \"sourceSystemUrl\": \"https://www.loanmarket.com.au/brokers/direct/our-team/michael-atherton\",\n\n \"externalReference\": \"ABC1234\",\n \"externalIntegration\": \"MyIntegrationSource\"\n }\n }\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{PublicAPI_Url}}/jsonapi/leads", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "leads" ] } }, "response": [] }, { "name": "Get Last Lead", "event": [ { "listen": "test", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "method": "GET", "header": [], "body": { "mode": "raw", "raw": "", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{PublicAPI_Url}}/jsonapi/leads/:id", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "leads", ":id" ], "variable": [ { "key": "id", "value": "{{lastDealId}}" } ] } }, "response": [] } ] }, { "name": "Structured Leads", "item": [ { "name": "Add Structured Lead", "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\r\n \"data\": {\r\n \"type\": \"structured-leads\",\r\n \"attributes\": {\r\n \"contacts\": [\r\n {\r\n \"lid\": \"Fred\",\r\n \"title\": \"Mr\",\r\n \"firstName\": \"Fred\",\r\n \"preferredName\": \"Fred\",\r\n \"lastName\": \"Flintstone\",\r\n \"email\": \"fred@bedrock.com\",\r\n \"mobile\": \"0412345678\",\r\n \"homePhone\": \"0734912214\",\r\n \"dateOfBirth\": \"1995-07-29\",\r\n \"gender\": \"Male\",\r\n \"hasMarketingConsent\": true,\r\n \"isGuarantor\": false,\r\n \"isDependant\": false,\r\n \"isPrimary\": true,\r\n \"addresses\": [\r\n {\r\n \"lid\": \"FredsAddress\"\r\n }\r\n ],\r\n \"employments\": [\r\n {\r\n \"lid\": \"FredsEmployment\"\r\n }\r\n ]\r\n },\r\n {\r\n \"lid\": \"Wilma\",\r\n \"title\": \"Mrs\",\r\n \"firstName\": \"Wilma\",\r\n \"preferredName\": \"Wilma\",\r\n \"lastName\": \"Flintstone\",\r\n \"email\": \"wilma@bedrock.com\",\r\n \"mobile\": \"0412345673\",\r\n \"homePhone\": \"0734912214\",\r\n \"dateOfBirth\": \"1995-03-29\",\r\n \"gender\": \"Female\",\r\n \"hasMarketingConsent\": true,\r\n \"isGuarantor\": false,\r\n \"isDependant\": false,\r\n \"isPrimary\": false,\r\n \"addresses\": [\r\n {\r\n \"lid\": \"FredsAddress\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"addresses\": [\r\n {\r\n \"lid\": \"FredsAddress\",\r\n \"formattedAddress\": \"6 Homestead Heights, Hallidays Point New South Wales 2430, Australia\",\r\n \"streetAddress\": \"6 Homestead Heights\",\r\n \"suburb\": \"Hallidays Point\",\r\n \"state\": \"New South Wales\",\r\n \"postCode\": \"2430\",\r\n \"country\": \"Australia\",\r\n \"addressType\": \"Current\"\r\n },\r\n {\r\n \"lid\": \"FredsWorkAddress\",\r\n \"formattedAddress\": \"23 King Street, Sydney New South Wales 2000, Australia\",\r\n \"streetAddress\": \"23 King Street\",\r\n \"suburb\": \"Sydney\",\r\n \"state\": \"New South Wales\",\r\n \"postCode\": \"2000\",\r\n \"country\": \"Australia\",\r\n \"addressType\": \"Current\"\r\n }\r\n ],\r\n \"assets\": [\r\n {\r\n \"lid\": \"FlintstoneHome\",\r\n \"assetTypeId\": 1,\r\n \"value\": 1000000.0,\r\n \"propertyZoningId\": 2,\r\n \"propertyTypeId\": 13,\r\n \"propertyPrimaryPurpose\": \"PurchaseOwnerOccupied\",\r\n \"address\": {\r\n \"lid\": \"FredsAddress\"\r\n },\r\n \"ownership\": [\r\n {\r\n \"lid\": \"Fred\"\r\n },\r\n {\r\n \"lid\": \"Wilma\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"expenses\": [\r\n {\r\n \"expenseTypeId\": 2,\r\n \"description\": \"Family Car Lease\",\r\n \"value\": 100,\r\n \"frequency\": \"Monthly\",\r\n \"ownership\": [\r\n {\r\n \"lid\": \"Fred\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"incomes\": [\r\n {\r\n \"incomeTypeId\": 19,\r\n \"description\": \"string\",\r\n \"value\": 50000,\r\n \"frequency\": \"Yearly\",\r\n \"incomeVerification\": \"CurrentPayslips\",\r\n \"ownership\": [\r\n {\r\n \"lid\": \"Fred\"\r\n }\r\n ],\r\n \"employment\": {\r\n \"lid\": \"FredsEmployment\"\r\n }\r\n }\r\n ],\r\n \"liabilities\": [\r\n {\r\n \"liabilityTypeId\": 21,\r\n \"value\": 20000,\r\n \"repayments\": 1500,\r\n \"repaymentFrequency\": \"Weekly\",\r\n \"interestRate\": 1.50,\r\n \"interestTaxDeductible\": true,\r\n \"loanTerm\": 24,\r\n \"loanRepaymentType\": \"InterestOnly\",\r\n \"mortgagePriority\": \"First\",\r\n \"asset\": {\r\n \"lid\": \"FlintstoneHome\"\r\n },\r\n \"ownership\": [\r\n {\r\n \"lid\": \"Fred\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"employments\": [\r\n {\r\n \"lid\": \"FredsEmployment\",\r\n \"employmentStatus\": \"PrimaryEmployment\",\r\n \"employmentType\": \"PAYG\",\r\n \"dateStarted\": \"2022-04-07\",\r\n \"employmentRoleName\": \"Clark\",\r\n \"employmentBasis\": \"FullTime\",\r\n \"isProbation\": false,\r\n \"businessNumber\": \"123456789\",\r\n \"employerName\": \"Best & Less\",\r\n \"employerContactTitle\": \"Mr\",\r\n \"employerContactFirstName\": \"Barney Rubble\",\r\n \"employerContactLastName\": \"Rubble\",\r\n \"employerType\": \"Private\",\r\n \"employerPhone\": \"0733332222\",\r\n \"address\": {\r\n \"lid\": \"FredsWorkAddress\"\r\n }\r\n }\r\n ],\r\n \"utmSource\": \"facebook\",\r\n \"utmMedium\": \"social\",\r\n \"utmCampaign\": \"mycrm-fb\",\r\n \"utmTerm\": \"investment\",\r\n \"utmContent\": \"lm\",\r\n \"sourceSystemUrl\": \"https://www.loanmarket.com.au/brokers/direct/our-team/fred-flintstone\",\r\n \"noteTitle\": \"About the lead (note title)\",\r\n \"noteDetails\": \"This is why it happened\",\r\n \"externalReference\": \"ABC1234\",\r\n \"externalIntegration\": \"MyIntegrationSource\" \r\n }\r\n }\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{PublicAPI_Url}}/jsonapi/structured-leads", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "structured-leads" ] } }, "response": [] }, { "name": "List Asset Types", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/asset-types", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "asset-types" ] } }, "response": [] }, { "name": "List Asset Sub Types", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/asset-sub-types", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "asset-sub-types" ] } }, "response": [] }, { "name": "List Expense Type", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/expense-types", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "expense-types" ] } }, "response": [] }, { "name": "List Income Type", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/income-types", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "income-types" ] } }, "response": [] }, { "name": "List Liability Categories", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/liability-categories", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "liability-categories" ] } }, "response": [] }, { "name": "List Liability Types", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/liability-types", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "liability-types" ] } }, "response": [] }, { "name": "List Property Types", "request": { "method": "GET", "header": [], "url": { "raw": "{{PublicAPI_Url}}/jsonapi/property-types", "host": [ "{{PublicAPI_Url}}" ], "path": [ "jsonapi", "property-types" ] } }, "response": [] } ] } ], "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{OAuth_Token}}", "type": "string" } ] }, "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "// Refresh the OAuth token if necessary", "var tokenDate = new Date(2010,1,1);", "", "var tokenTimestamp = pm.variables.get(\"OAuth_Timestamp\");", "if(tokenTimestamp){", " tokenDate = Date.parse(tokenTimestamp);", "}", "", "var expiresInTime = pm.variables.get(\"ExpiresInTime\");", "if(!expiresInTime){", " expiresInTime = 300000; // Set default expiration time to 5 minutes", "}", "", "if((new Date() - tokenDate) >= expiresInTime) ", "{", " pm.sendRequest({", " url: pm.variables.get(\"Auth_Url\"), ", " method: 'POST',", " header: {", " 'Accept': 'application/json',", " 'Content-Type': 'application/x-www-form-urlencoded',", " 'Authorization': 'Basic ' + btoa(pm.variables.get(\"ClientID\") + ':' + pm.variables.get(\"ClientSecret\"))", " },", " body: {", " mode: 'urlencoded',", " urlencoded: [", " { key: \"grant_type\", value: \"client_credentials\" },", " { key: \"scope\", value: pm.variables.get(\"Scopes\") }", " ]", " }", " }, function (err, res) {", "", " pm.collectionVariables.set(\"OAuth_Token\", res.json().access_token);", " pm.collectionVariables.set(\"OAuth_Timestamp\", new Date());", " ", " // Set the ExpiresInTime variable to the time given in the response if it exists", " if(res.json().expires_in){", " expiresInTime = res.json().expires_in * 1000;", " }", " pm.collectionVariables.set(\"ExpiresInTime\", expiresInTime);", " });", "}", "", "pm.request.headers.add({key: 'accept', value: 'application/vnd.api+json' })", "pm.request.headers.add({key: 'Content-Type', value: 'application/vnd.api+json' })", "pm.request.headers.add({key: 'UserId', value: pm.variables.get(\"AdviserContactId\") })" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ], "variable": [ { "key": "Auth_Url", "value": "" }, { "key": "ClientID", "value": "" }, { "key": "ClientSecret", "value": "" }, { "key": "Scopes", "value": "api" }, { "key": "AdviserContactId", "value": "" }, { "key": "PublicAPI_Url", "value": "" } ] }