Created
October 2, 2019 15:32
-
-
Save lbroudoux/12c3a2e685f9d723985e9431716bd06e to your computer and use it in GitHub Desktop.
API Pastry Copy.postman_collection.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"info": { | |
"_postman_id": "6d56a960-3eb3-429d-9a31-76602091a4eb", | |
"name": "API Pastry Copy", | |
"description": "version=1.2.0 - API definition of API Pastry sample app\n\nContact Support: \n{\n\nName : Laurent Broudoux\n\nEmail : laurent.broudoux@gmail.com\n\n}", | |
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" | |
}, | |
"item": [ | |
{ | |
"name": "pastry", | |
"item": [ | |
{ | |
"name": "Get list of pastries", | |
"event": [ | |
{ | |
"listen": "test", | |
"script": { | |
"id": "5b60437c-3fc5-42c1-a50a-2768ea62b809", | |
"exec": [ | |
"pm.test(\"Status code is 200\", function () {", | |
" pm.response.to.have.status(200);", | |
"});" | |
], | |
"type": "text/javascript" | |
} | |
} | |
], | |
"request": { | |
"auth": { | |
"type": "noauth" | |
}, | |
"method": "GET", | |
"header": [], | |
"body": { | |
"mode": "raw", | |
"raw": "" | |
}, | |
"url": { | |
"raw": "{{baseUrl}}/pastry", | |
"host": [ | |
"{{baseUrl}}" | |
], | |
"path": [ | |
"pastry" | |
] | |
} | |
}, | |
"response": [ | |
{ | |
"name": "Get list of pastries", | |
"originalRequest": { | |
"method": "GET", | |
"header": [], | |
"body": { | |
"mode": "raw", | |
"raw": "" | |
}, | |
"url": { | |
"raw": "http:///pastry", | |
"host": [ | |
"http:" | |
], | |
"port": "", | |
"path": [ | |
"", | |
"", | |
"pastry" | |
] | |
} | |
}, | |
"status": "OK", | |
"code": 200, | |
"_postman_previewlanguage": "json", | |
"header": [ | |
{ | |
"key": "Content-Type", | |
"value": "application/json" | |
} | |
], | |
"cookie": [], | |
"body": "[\n {\n \"name\": \"Baba Rhum\",\n \"description\": \"Delicieux Baba au Rhum pas calorique du tout\",\n \"size\": \"L\",\n \"price\": 3.2,\n \"status\": \"available\"\n },\n {\n \"name\": \"Divorces\",\n \"description\": \"Delicieux Divorces pas calorique du tout\",\n \"size\": \"M\",\n \"price\": 2.8,\n \"status\": \"available\"\n },\n {\n \"name\": \"Tartelette Fraise\",\n \"description\": \"Delicieuse Tartelette aux Fraises fraiches\",\n \"size\": \"S\",\n \"price\": 2,\n \"status\": \"available\"\n }\n]" | |
} | |
] | |
}, | |
{ | |
"name": "Get Pastry by name", | |
"event": [ | |
{ | |
"listen": "test", | |
"script": { | |
"id": "3f8c3ee7-4970-4598-a4b4-3cb24fea3a66", | |
"exec": [ | |
"var expectedName = globals[\"name\"];", | |
"var jsonData = JSON.parse(responseBody);", | |
"", | |
"var schema = {", | |
" \"type\": \"object\",", | |
" \"properties\": {", | |
" \"name\": { \"type\": \"string\", \"enum\": [expectedName] },", | |
" \"description\": { \"type\": \"string\" },", | |
" \"size\": { \"type\": \"string\" },", | |
" \"price\": { \"type\": \"number\" },", | |
" \"status\": { \"type\": \"string\" }", | |
" }", | |
"};", | |
"", | |
"tests[\"Valid status in response\"] = tv4.validate(jsonData, schema);" | |
], | |
"type": "text/javascript" | |
} | |
} | |
], | |
"request": { | |
"auth": { | |
"type": "noauth" | |
}, | |
"method": "GET", | |
"header": [], | |
"body": { | |
"mode": "raw", | |
"raw": "" | |
}, | |
"url": { | |
"raw": "{{baseUrl}}/pastry/:name", | |
"host": [ | |
"{{baseUrl}}" | |
], | |
"path": [ | |
"pastry", | |
":name" | |
], | |
"variable": [ | |
{ | |
"key": "name", | |
"value": "<string>", | |
"description": "pastry name" | |
} | |
] | |
}, | |
"description": "Get Pastry by name" | |
}, | |
"response": [ | |
{ | |
"name": "Eclair Cafe", | |
"originalRequest": { | |
"method": "GET", | |
"header": [], | |
"body": { | |
"mode": "raw", | |
"raw": "" | |
}, | |
"url": { | |
"raw": "{{baseUrl}}/pastry/:name", | |
"host": [ | |
"{{baseUrl}}" | |
], | |
"path": [ | |
"pastry", | |
":name" | |
], | |
"variable": [ | |
{ | |
"key": "name", | |
"value": "Eclair Cafe" | |
} | |
] | |
} | |
}, | |
"status": "OK", | |
"code": 200, | |
"_postman_previewlanguage": "json", | |
"header": [ | |
{ | |
"key": "Content-Type", | |
"value": "application/json" | |
} | |
], | |
"cookie": [], | |
"body": "{\n \"name\": \"Eclair Cafe\",\n \"description\": \"Delicieux Eclair au Cafe pas calorique du tout\",\n \"size\": \"M\",\n \"price\": 2.5,\n \"status\": \"available\"\n}" | |
}, | |
{ | |
"name": "Millefeuille", | |
"originalRequest": { | |
"method": "GET", | |
"header": [], | |
"body": { | |
"mode": "raw", | |
"raw": "" | |
}, | |
"url": { | |
"raw": "{{baseUrl}}/pastry/:name", | |
"host": [ | |
"{{baseUrl}}" | |
], | |
"path": [ | |
"pastry", | |
":name" | |
], | |
"variable": [ | |
{ | |
"key": "name", | |
"value": "Baba Rhum", | |
"description": "pastry name" | |
} | |
] | |
} | |
}, | |
"_postman_previewlanguage": "json", | |
"header": null, | |
"cookie": [], | |
"body": "{\n \"name\": \"Millefeuille\",\n \"description\": \"Delicieux Millefeuille pas calorique du tout\",\n \"size\": \"L\",\n \"price\": 4.4,\n \"status\": \"available\"\n}" | |
} | |
] | |
}, | |
{ | |
"name": "Patch an existing pastry", | |
"request": { | |
"method": "PATCH", | |
"header": [], | |
"body": { | |
"mode": "raw", | |
"raw": "" | |
}, | |
"url": { | |
"raw": "{{baseUrl}}/pastry/:name", | |
"host": [ | |
"{{baseUrl}}" | |
], | |
"path": [ | |
"pastry", | |
":name" | |
], | |
"variable": [ | |
{ | |
"key": "name", | |
"value": "<string>", | |
"description": "pastry name" | |
} | |
] | |
} | |
}, | |
"response": [ | |
{ | |
"name": "Eclair Cafe", | |
"originalRequest": { | |
"method": "PATCH", | |
"header": [ | |
{ | |
"key": "Content-Type", | |
"name": "Content-Type", | |
"value": "application/json", | |
"type": "text" | |
} | |
], | |
"body": { | |
"mode": "raw", | |
"raw": "{\n \"price\": 2.6\n}" | |
}, | |
"url": { | |
"raw": "{{baseUrl}}/pastry/:name", | |
"host": [ | |
"{{baseUrl}}" | |
], | |
"path": [ | |
"pastry", | |
":name" | |
], | |
"variable": [ | |
{ | |
"key": "name", | |
"value": "Eclair Cafe" | |
} | |
] | |
} | |
}, | |
"_postman_previewlanguage": "json", | |
"header": null, | |
"cookie": [], | |
"body": "{\n \"name\": \"Eclair Cafe\",\n \"description\": \"Delicieux Eclair au Cafe pas calorique du tout\",\n \"size\": \"M\",\n \"price\": 2.6,\n \"status\": \"available\"\n}" | |
}, | |
{ | |
"name": "Eclair Cafe Xml", | |
"originalRequest": { | |
"method": "PATCH", | |
"header": [ | |
{ | |
"key": "Content-Type", | |
"name": "Content-Type", | |
"value": "text/xml", | |
"type": "text" | |
} | |
], | |
"body": { | |
"mode": "raw", | |
"raw": "<pastry>\n\t<price>2.6</price>\n</pastry>" | |
}, | |
"url": { | |
"raw": "{{baseUrl}}/pastry/:name", | |
"host": [ | |
"{{baseUrl}}" | |
], | |
"path": [ | |
"pastry", | |
":name" | |
], | |
"variable": [ | |
{ | |
"key": "name", | |
"value": "Eclair Cafe", | |
"description": "pastry name" | |
} | |
] | |
} | |
}, | |
"_postman_previewlanguage": "xml", | |
"header": null, | |
"cookie": [], | |
"body": "<pastry>\n <name>Eclair Cafe</name>\n <description>Delicieux Eclair au Cafe pas calorique du tout</description>\n <size>M</size>\n <price>2.6</price>\n <status>available</status>\n</pastry>" | |
} | |
] | |
} | |
] | |
} | |
], | |
"event": [ | |
{ | |
"listen": "prerequest", | |
"script": { | |
"id": "f1903bce-6bb8-4fbe-981f-ea6be8264697", | |
"type": "text/javascript", | |
"exec": [ | |
"" | |
] | |
} | |
}, | |
{ | |
"listen": "test", | |
"script": { | |
"id": "a6514992-30a1-4818-b429-72d621057b44", | |
"type": "text/javascript", | |
"exec": [ | |
"" | |
] | |
} | |
} | |
], | |
"variable": [ | |
{ | |
"id": "eddcc8ff-098f-4e47-9bf9-e66c1b8d4024", | |
"key": "baseUrl", | |
"value": "/", | |
"type": "string" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment