Difference between revisions of "API: Sample Calls"
(Created page with "{ "info": { "name": "Sample calls", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { "name": "clients", "item": [...") |
|||
Line 1: | Line 1: | ||
+ | |||
+ | |||
{ | { | ||
"info": { | "info": { |
Revision as of 11:34, 24 February 2022
{
"info": {
"name": "Sample calls",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "clients",
"item": [
{
"name": "Client by ID with default fields",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"pm.test(\"Client found\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.length).to.eql(1);",
" pm.expect(jsonData[0].surname).to.eql('Elliott');",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Org",
"value": "Template:Org"
},
{
"key": "Source",
"value": "Template:Source"
},
{
"key": "User",
"value": "Template:User"
},
{
"key": "XDEBUG_SESSION",
"value": "PHPSTORM"
}
],
"url": {
"raw": "https://Template:Host/v2/clients/id/123",
"protocol": "https",
"host": [
"Template:Host"
],
"path": [
"v2",
"clients",
"id",
"123"
]
}
},
"response": []
},
{
"name": "Client by ID with specific fields",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"pm.test(\"Client found\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.length).to.eql(1);",
" pm.expect(jsonData[0].surname).to.eql('Elliott');",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Org",
"value": "Template:Org"
},
{
"key": "Source",
"value": "Template:Source"
},
{
"key": "User",
"value": "Template:User"
},
{
"key": "XDEBUG_SESSION",
"value": "PHPSTORM"
}
],
"url": {
"raw": "https://Template:Host/v2/clients/id/123/field/name;id;living_arrangements;accommodation",
"protocol": "https",
"host": [
"Template:Host"
],
"path": [
"v2",
"clients",
"id",
"123",
"field",
"name;id;living_arrangements;accommodation"
]
}
},
"response": []
}
]
},
{
"name": "referrals",
"item": [
{
"name": "Referral by ID with default fields",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Org",
"value": "Template:Org"
},
{
"key": "Source",
"value": "Template:Source"
},
{
"key": "User",
"value": "Template:User"
},
{
"key": "XDEBUG_SESSION",
"value": "PHPSTORM"
}
],
"url": {
"raw": "https://Template:Host/v2/referrals/id/1342",
"protocol": "https",
"host": [
"Template:Host"
],
"path": [
"v2",
"referrals",
"id",
"1342"
]
}
},
"response": []
}
]
}
]
}