{ "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": [] } ], "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": "a1cfb454-de0c-4c74-9a45-c14dc9bf2da0", "key": "resq_url", "value": "resq.local", "type": "string" }, { "id": "cf0248b6-ea72-44ca-8de6-ba6a20f9ee9d", "key": "phone_model", "value": "iPhone8", "type": "string" }, { "id": "069c06e7-6a38-4998-aa62-e3789c615253", "key": "os_type", "value": "IOS", "type": "string" }, { "id": "c7c3e8e7-3f49-46c0-932d-25cc281c4d23", "key": "os_version", "value": "11.4", "type": "string" }, { "id": "8bda1ea8-63bf-400a-a0d7-832e13a273f7", "key": "phone_id", "value": "11376660-F8BF-46ED-B30A-EF3F361EE223", "type": "string" }, { "id": "236e99e8-1bb8-412f-9827-3dd955b40172", "key": "phone_number", "value": "9221111111", "type": "string" } ] }