Difference between revisions of "API: Sample Calls"
From Charitylog Manual
Line 2: | Line 2: | ||
There are a range of tools that can be used for making API calls. Postman is a popular choice, see https://www.postman.com/ | There are a range of tools that can be used for making API calls. Postman is a popular choice, see https://www.postman.com/ | ||
− | Create an environment so don't need to add the keys to the header of every call you make. | + | Create an environment so don't need to add the keys to the header of every call you make. If your tool lets you create the env |
<pre> | <pre> | ||
{ | { | ||
Line 50: | Line 50: | ||
], | ], | ||
"url": { | "url": { | ||
− | "raw": " | + | "raw": "{{host}}/business/configuration", |
"protocol": "https", | "protocol": "https", | ||
"host": [ | "host": [ | ||
Line 92: | Line 92: | ||
], | ], | ||
"url": { | "url": { | ||
− | "raw": " | + | "raw": "{{host}}/clients/id/123", |
"protocol": "https", | "protocol": "https", | ||
"host": [ | "host": [ | ||
Line 130: | Line 130: | ||
], | ], | ||
"url": { | "url": { | ||
− | "raw": " | + | "raw": "{{host}}/clients/id/123/field/name;id;living_arrangements;accommodation", |
"protocol": "https", | "protocol": "https", | ||
"host": [ | "host": [ | ||
Line 175: | Line 175: | ||
], | ], | ||
"url": { | "url": { | ||
− | "raw": " | + | "raw": "{{host}}/referrals/id/1342", |
"protocol": "https", | "protocol": "https", | ||
"host": [ | "host": [ |
Revision as of 10:30, 24 April 2024
There are a range of tools that can be used for making API calls. Postman is a popular choice, see https://www.postman.com/ Create an environment so don't need to add the keys to the header of every call you make. If your tool lets you create the env
{ "host": "https://api.dizions.co.uk/v2", "source": YOUR_SOURCE_KEY, "org": YOUR_ORG_KEY, "user": YOUR_USER_KEY }
See API Authentication for more info.
Copy and paste the the code below into a text editor, and save with a .json extension. The file can then be imported into Postman.
{ "info": { "_postman_id": "10bed371-4395-442e-9a66-6a780d834776", "name": "Sample calls", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { "name": "Getting Started", "item": [ { "name": "Get Business Configuration", "request": { "method": "GET", "header": [ { "key": "Source", "value": "{{source}}", "type": "default" }, { "key": "Org", "value": "{{org}}", "type": "default" }, { "key": "User", "value": "{{user}}", "type": "default" } ], "url": { "raw": "{{host}}/business/configuration", "protocol": "https", "host": [ "{{host}}" ], "path": [ "v2", "business", "configuration" ] } }, "response": [] } ] }, { "name": "clients", "item": [ { "name": "Client by ID with default fields", "request": { "method": "GET", "header": [ { "key": "Org", "value": "{{org}}" }, { "key": "Source", "value": "{{source}}" }, { "key": "User", "value": "{{user}}" }, { "key": "XDEBUG_SESSION", "value": "PHPSTORM" } ], "url": { "raw": "{{host}}/clients/id/123", "protocol": "https", "host": [ "{{host}}" ], "path": [ "v2", "clients", "id", "123" ] } }, "response": [] }, { "name": "Client by ID with specific fields", "request": { "method": "GET", "header": [ { "key": "Org", "value": "{{org}}" }, { "key": "Source", "value": "{{source}}" }, { "key": "User", "value": "{{user}}" }, { "key": "XDEBUG_SESSION", "value": "PHPSTORM" } ], "url": { "raw": "{{host}}/clients/id/123/field/name;id;living_arrangements;accommodation", "protocol": "https", "host": [ "{{host}}" ], "path": [ "v2", "clients", "id", "123", "field", "name;id;living_arrangements;accommodation" ] } }, "response": [] } ] }, { "name": "referrals", "item": [ { "name": "Referral by ID with default fields", "request": { "method": "GET", "header": [ { "key": "Source", "value": "{{source}}" }, { "key": "Org", "value": "{{org}}" }, { "key": "User", "value": "{{user}}" }, { "key": "XDEBUG_SESSION", "value": "PHPSTORM" } ], "url": { "raw": "{{host}}/referrals/id/1342", "protocol": "https", "host": [ "{{host}}" ], "path": [ "v2", "referrals", "id", "1342" ] } }, "response": [] } ] } ] }