resq/postman/Resq Mobile API - API Controller.postman_collection.json

878 lines
No EOL
18 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 a global variable. The session id is the api_key in calls requiring an api_key",
" ",
" pm.globals.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",
"event": [
{
"listen": "test",
"script": {
"id": "74a802f4-f8ea-4059-a18a-206d29a50199",
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"List Vehicle Makes\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.error.status).to.eql(\"success\");",
" pm.expect(jsonData.data.manufacturer.name).to.eql(\"VOLKSWAGEN\");",
" pm.expect(jsonData.data.makes).to.have.lengthOf(27);",
" pm.expect(jsonData.data.makes[0].make).to.eql(\"BEETLE 2013 - 2018\");",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{resq_url}}/api/vehicle/mfgs/{{mfg_id}}/makes?api_key={{api_key}}",
"host": [
"{{resq_url}}"
],
"path": [
"api",
"vehicle",
"mfgs",
"{{mfg_id}}",
"makes"
],
"query": [
{
"key": "api_key",
"value": "{{api_key}}"
}
]
}
},
"response": []
},
{
"name": "[Normal] Add Vehicle",
"event": [
{
"listen": "test",
"script": {
"id": "efd6f228-c8d6-4e52-a9d1-fca7b5e3220e",
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Add vehicle\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.error.status).to.eql(\"success\");",
" pm.expect(jsonData.data).to.have.property(\"cv_id\");",
" ",
" // store customer vehicle id for update vehicle",
" let cv_id = jsonData.data.cv_id;",
" pm.globals.set(\"cv_id\", cv_id);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "make_id",
"value": "{{make_id}}",
"type": "text"
},
{
"key": "name",
"value": "{{name}}",
"type": "text"
},
{
"key": "plate_num",
"value": "{{plate_num}}",
"type": "text"
},
{
"key": "model_year",
"value": "{{model_year}}",
"type": "text"
},
{
"key": "color",
"value": "{{color}}",
"type": "text"
},
{
"key": "condition",
"value": "{{condition}}",
"type": "text"
},
{
"key": "fuel_type",
"value": "{{fuel_type}}",
"type": "text"
}
]
},
"url": {
"raw": "{{resq_url}}/api/vehicles?api_key={{api_key}}",
"host": [
"{{resq_url}}"
],
"path": [
"api",
"vehicles"
],
"query": [
{
"key": "api_key",
"value": "{{api_key}}"
}
]
}
},
"response": []
},
{
"name": "[Normal] Update Vehicle",
"event": [
{
"listen": "test",
"script": {
"id": "8cd334bb-4032-47f3-9dcd-8c893135ac7d",
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Update vehicle\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.error.status).to.eql(\"success\");",
" pm.expect(jsonData.data.cv_id).to.eql(pm.globals.get(\"cv_id\"));",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "make_id",
"value": "{{make_id}}",
"type": "text"
},
{
"key": "name",
"value": "{{name}}",
"type": "text"
},
{
"key": "plate_num",
"value": "{{plate_num}}",
"type": "text"
},
{
"key": "model_year",
"value": "{{model_year}}",
"type": "text"
},
{
"key": "color",
"value": "{{color}}",
"type": "text"
},
{
"key": "condition",
"value": "{{condition}}",
"type": "text"
},
{
"key": "fuel_type",
"value": "{{fuel_type}}",
"type": "text"
},
{
"key": "wty_code",
"value": "{{wty_code}}",
"type": "text"
},
{
"key": "wty_expire",
"value": "{{wty_expire}}",
"type": "text"
},
{
"key": "is_motolite",
"value": "1",
"type": "text"
},
{
"key": "is_active",
"value": "1",
"type": "text"
}
]
},
"url": {
"raw": "{{resq_url}}/api/vehicles/{{cv_id}}?api_key={{api_key}}",
"host": [
"{{resq_url}}"
],
"path": [
"api",
"vehicles",
"{{cv_id}}"
],
"query": [
{
"key": "api_key",
"value": "{{api_key}}"
}
]
}
},
"response": []
},
{
"name": "[Normal] List Vehicles",
"event": [
{
"listen": "test",
"script": {
"id": "82efd001-0a54-4c45-b8b5-d996a197a3a6",
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"List vehicles\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.error.status).to.eql(\"success\");",
" pm.expect(jsonData.data.vehicles.length).to.be.gt(0);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{resq_url}}/api/vehicles?api_key={{api_key}}",
"host": [
"{{resq_url}}"
],
"path": [
"api",
"vehicles"
],
"query": [
{
"key": "api_key",
"value": "{{api_key}}"
}
]
}
},
"response": []
},
{
"name": "[Normal] List Promos",
"event": [
{
"listen": "test",
"script": {
"id": "5263af3d-5f82-4bef-9575-c0771e78fe1e",
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"List promos\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.error.status).to.eql(\"success\");",
" //pm.expect(jsonData.data.makes).to.have.lengthOf(9);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{resq_url}}/api/promos?api_key={{api_key}}",
"host": [
"{{resq_url}}"
],
"path": [
"api",
"promos"
],
"query": [
{
"key": "api_key",
"value": "{{api_key}}"
}
]
}
},
"response": []
},
{
"name": "[Normal] Get Compatible Batteries",
"event": [
{
"listen": "test",
"script": {
"id": "8d860fb0-7e8b-4ac9-b229-15df1ade3677",
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Get compatible batteries\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.error.status).to.eql(\"success\");",
" ",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{resq_url}}/api/vehicles/{{make_id}}/compatible_batteries?api_key={{api_key}}",
"host": [
"{{resq_url}}"
],
"path": [
"api",
"vehicles",
"{{make_id}}",
"compatible_batteries"
],
"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": "b92a8775-f072-45d6-ba3c-c5c1e697026b",
"key": "resq_url",
"value": "resq.local",
"type": "string"
},
{
"id": "279d5bec-f9d3-431c-8ef7-8bce23f18f0f",
"key": "phone_model",
"value": "iPhone8",
"type": "string"
},
{
"id": "a747bcd5-9367-4394-97b1-c3caca435f8d",
"key": "os_type",
"value": "IOS",
"type": "string"
},
{
"id": "b3833b45-b18b-4aaf-8aa5-064caf7a3e6e",
"key": "os_version",
"value": "11.4",
"type": "string"
},
{
"id": "a515f94f-c3f9-4bbf-9f17-277fa06ab1b3",
"key": "phone_id",
"value": "11376660-F8BF-46ED-B30A-EF3F361EE223",
"type": "string"
},
{
"id": "fe0a71cc-64eb-4f69-817b-0a98782749b6",
"key": "phone_number",
"value": "9221111111",
"type": "string"
},
{
"id": "c26c982a-7879-4324-9095-229913ee1370",
"key": "first_name",
"value": "Stiltzkin",
"type": "string"
},
{
"id": "c3e57918-f00a-4e6d-9182-f4a86e2f2598",
"key": "last_name",
"value": "Moogle",
"type": "string"
},
{
"id": "56657131-867e-430d-a7cf-ec2bbb4ce14a",
"key": "mfg_id",
"value": "1435",
"type": "string"
},
{
"id": "7c6a8217-98e5-4ea1-a3ad-608345e9895c",
"key": "make_id",
"value": "22043",
"type": "string"
},
{
"id": "971f7ee1-d1b3-43da-afce-f32a1344b59f",
"key": "name",
"value": "Beetle 1.2 TSI MT (Gas)",
"type": "string"
},
{
"id": "9f1d9e61-1142-45a3-837a-d0c67d6d7731",
"key": "plate_num",
"value": "MGL1234",
"type": "string"
},
{
"id": "9d01f14b-8a98-41a2-9c50-bb74988219c5",
"key": "model_year",
"value": "2016",
"type": "string"
},
{
"id": "f0d9c73d-a485-47da-9f55-5ab8e6ec67b8",
"key": "color",
"value": "White",
"type": "string"
},
{
"id": "2734e723-5e3e-493b-b2ac-baf324ee6c56",
"key": "condition",
"value": "Brand New",
"type": "string"
},
{
"id": "43d61623-17d2-4502-b225-74b40af420c0",
"key": "fuel_type",
"value": "Gas",
"type": "string"
},
{
"id": "85fb5ff9-e4b8-4400-9093-54f4258a6780",
"key": "wty_code",
"value": "MKUP0123456",
"type": "string"
},
{
"id": "34611113-838e-4e43-9964-d69cb3d900aa",
"key": "wty_expire",
"value": "20201125",
"type": "string"
}
]
}