example image
json example
{
“info”: {
“name”: “POST Create Data Variants”,
“schema”: “https://schema.getpostman.com/json/collection/v2.1.0/collection.json”
},
“item”: [
{
“name”: “POST Create Data - Success”,
“request”: {
“method”: “POST”,
“header”: [
{
“key”: “Authorization”,
“value”: “Bearer {{auth_token}}”
},
{
“key”: “Content-Type”,
“value”: “application/json”
}
],
“url”: {
“raw”: “{{base_url}}/api/data”,
“host”: [
“{{base_url}}”
],
“path”: [
“api”,
“data”
]
},
“body”: {
“mode”: “raw”,
“raw”: “{ "name": "Success Item", "value": "12345" }”,
“options”: {
“raw”: {
“language”: “json”
}
}
}
},
“event”: [
{
“listen”: “test”,
“script”: {
“type”: “text/javascript”,
“exec”: [
“pm.test("Status code is 200", function () {”,
" pm.response.to.have.status(200);“,
“});”,
“pm.test("Message is OK", function () {”,
" var json = pm.response.json();”,
" pm.expect(json.message).to.eql("OK");“,
“});”
]
}
},
{
“listen”: “test1”,
“script”: {
“type”: “text/javascript”,
“exec”: [
“pm.test("Message is OK", function () {”,
" var json = pm.response.json();”,
" pm.expect(json.message).to.eql("OK");",
“});”
]
}
}
]
}
]
}