453 lines
No EOL
9.5 KiB
JSON
Executable file
453 lines
No EOL
9.5 KiB
JSON
Executable file
{
|
|
"info": {
|
|
"_postman_id": "a7eece2c-4939-461c-8b01-6d2ec1020193",
|
|
"name": "Resq Mobile API - API Controller",
|
|
"description": "API call to register a mobile number",
|
|
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
|
},
|
|
"item": [
|
|
{
|
|
"name": "[Normal] Register",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"id": "9170a06a-c4bd-4747-85c4-8f3d27b17984",
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Register\", function () {",
|
|
" var jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.error.status).to.eql(\"success\");",
|
|
" pm.expect(jsonData.data).to.have.property(\"session_id\");",
|
|
" ",
|
|
" // get session id value",
|
|
" let session_id = jsonData.data.session_id;",
|
|
" ",
|
|
" // store the session_id value as an environment variable. The session id is the api_key in calls requiring an api_key",
|
|
" ",
|
|
" pm.environment.set(\"api_key\", session_id);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "formdata",
|
|
"formdata": [
|
|
{
|
|
"key": "phone_model",
|
|
"value": "{{phone_model}}",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "os_type",
|
|
"value": "{{os_type}}",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "os_version",
|
|
"value": "{{os_version}}",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "phone_id",
|
|
"value": "{{phone_id}}",
|
|
"type": "text"
|
|
}
|
|
]
|
|
},
|
|
"url": {
|
|
"raw": "{{resq_url}}/api/register",
|
|
"host": [
|
|
"{{resq_url}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"register"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "[Abnormal] Missing parameters",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"id": "2cf0b49e-cc34-4437-ae6f-9a5da1c45afa",
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Missing all parameters\", function () {",
|
|
" var jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.error.status).to.eql(\"error\");",
|
|
" pm.expect(jsonData.error.message).to.include(\"Missing parameter\");",
|
|
" pm.expect(jsonData.data).to.be.empty;",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{resq_url}}/api/register",
|
|
"host": [
|
|
"{{resq_url}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"register"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "[Normal] Confirm Number",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"id": "4a6c099e-3484-4047-83db-a29ab500f27a",
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Confirm number\", function () {",
|
|
" var jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.error.status).to.eql(\"success\");",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "formdata",
|
|
"formdata": [
|
|
{
|
|
"key": "phone_number",
|
|
"value": "{{phone_number}}",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "api_key",
|
|
"value": "{{api_key}}",
|
|
"type": "text",
|
|
"disabled": true
|
|
}
|
|
]
|
|
},
|
|
"url": {
|
|
"raw": "{{resq_url}}/api/number_confirm?api_key={{api_key}}",
|
|
"host": [
|
|
"{{resq_url}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"number_confirm"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "api_key",
|
|
"value": "{{api_key}}"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "[Normal] Get Status",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"id": "dabc1451-e75d-46c6-b3fa-5992b62a065f",
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Status of mobile session\", function () {",
|
|
" var jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.error.status).to.eql(\"success\");",
|
|
" pm.expect(jsonData.data.status).to.eql(\"unconfirmed\");",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{resq_url}}/api/status?api_key={{api_key}}",
|
|
"host": [
|
|
"{{resq_url}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"status"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "api_key",
|
|
"value": "{{api_key}}"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "[Normal] Update Info",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"id": "27592b25-ba3d-4218-813f-3a9ab710fccc",
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Update Info\", function () {",
|
|
" var jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.error.status).to.eql(\"success\");",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "formdata",
|
|
"formdata": [
|
|
{
|
|
"key": "first_name",
|
|
"value": "{{first_name}}",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "last_name",
|
|
"value": "{{last_name}}",
|
|
"type": "text"
|
|
}
|
|
]
|
|
},
|
|
"url": {
|
|
"raw": "{{resq_url}}/api/info?api_key={{api_key}}",
|
|
"host": [
|
|
"{{resq_url}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"info"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "api_key",
|
|
"value": "{{api_key}}"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "[Normal] Get Info",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"id": "24efd1b8-ad00-4cb0-beb5-85c014d8a09a",
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Get Info\", function () {",
|
|
" var jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.error.status).to.eql(\"success\");",
|
|
" pm.expect(jsonData.data.first_name).to.eql(\"Stiltzkin\");",
|
|
" pm.expect(jsonData.data.last_name).to.eql(\"Moogle\");",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{resq_url}}/api/info?api_key={{api_key}}",
|
|
"host": [
|
|
"{{resq_url}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"info"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "api_key",
|
|
"value": "{{api_key}}"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "[Normal] List Vehicle Manufacturers",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"id": "86275f4c-dd2b-42c8-9ac2-c7d7a7d2edfe",
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"List vehicle manufacturers\", function () {",
|
|
" var jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.error.status).to.eql(\"success\");",
|
|
" pm.expect(jsonData.data.manufacturers).to.have.lengthOf(43);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{resq_url}}/api/vehicle/mfgs?api_key={{api_key}}",
|
|
"host": [
|
|
"{{resq_url}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"vehicle",
|
|
"mfgs"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "api_key",
|
|
"value": "{{api_key}}"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "[Normal] List Vehicle Makes",
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": ""
|
|
}
|
|
},
|
|
"response": []
|
|
}
|
|
],
|
|
"event": [
|
|
{
|
|
"listen": "prerequest",
|
|
"script": {
|
|
"id": "2d197aae-8a0c-410b-b188-4f788959d2c2",
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
""
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"id": "050072f2-bd10-4001-a44f-3e486904a34e",
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
""
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"variable": [
|
|
{
|
|
"id": "09fcc1bc-23c3-48cb-8586-49a7cf9437d5",
|
|
"key": "resq_url",
|
|
"value": "resq.local",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"id": "25934577-a793-4004-badf-63212546aa52",
|
|
"key": "phone_model",
|
|
"value": "iPhone8",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"id": "4e0d2bcf-84bd-4516-b0ef-d28413b62acb",
|
|
"key": "os_type",
|
|
"value": "IOS",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"id": "41b11f18-f02c-4721-bee0-7b7e5d277c42",
|
|
"key": "os_version",
|
|
"value": "11.4",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"id": "d2fb7606-9d27-4a1c-9701-93d807e02796",
|
|
"key": "phone_id",
|
|
"value": "11376660-F8BF-46ED-B30A-EF3F361EE223",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"id": "2cd58196-a907-4c21-9753-75a6090f4f1b",
|
|
"key": "phone_number",
|
|
"value": "9221111111",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"id": "211fab6f-e9f0-4436-a3a0-351b3bf11eb2",
|
|
"key": "first_name",
|
|
"value": "Stiltzkin",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"id": "2943ce9b-545f-489a-bee6-d3553312fd4c",
|
|
"key": "last_name",
|
|
"value": "Moogle",
|
|
"type": "string"
|
|
}
|
|
]
|
|
} |