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

938 lines
No EOL
20 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.promos).to.have.lengthOf(9);",
" pm.expect(jsonData.data.promos[0].code).to.eql(\"EMPLOY\");",
"});"
],
"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\");",
" pm.expect(jsonData.data.batteries[0].model_name).to.eql(\"GOLD\");",
" pm.expect(jsonData.data.batteries[0].size_name).to.eql(\"DIN55\");",
"});"
],
"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": []
},
{
"name": "[Normal] Request Job Order",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "service_type",
"value": "",
"type": "text"
},
{
"key": "cv_id",
"value": "{{cv_id}}",
"type": "text"
},
{
"key": "trade_in",
"value": "",
"type": "text"
},
{
"key": "long",
"value": "",
"type": "text"
},
{
"key": "lat",
"value": "",
"type": "text"
},
{
"key": "warranty",
"value": "",
"type": "text"
},
{
"key": "mode_of_payment",
"value": "",
"type": "text"
}
]
},
"url": {
"raw": "{{resq_url}}/api/job_order",
"host": [
"{{resq_url}}"
],
"path": [
"api",
"job_order"
]
}
},
"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": "ccac43fa-6d1e-49f2-b045-3e80c6d3934f",
"key": "resq_url",
"value": "resq.local",
"type": "string"
},
{
"id": "acc8f492-7460-41b4-911c-d12826ef2017",
"key": "phone_model",
"value": "iPhone8",
"type": "string"
},
{
"id": "43440cfe-0330-4254-a1e0-be0e7f054e1d",
"key": "os_type",
"value": "IOS",
"type": "string"
},
{
"id": "8b0e4ffb-a6d0-45fd-bae0-2869b3a9a417",
"key": "os_version",
"value": "11.4",
"type": "string"
},
{
"id": "4a6ebdda-c7b6-4f15-8b85-2afbfd7cab7d",
"key": "phone_id",
"value": "11376660-F8BF-46ED-B30A-EF3F361EE223",
"type": "string"
},
{
"id": "6ce89a29-4591-41da-b4f0-2945c9ca1f2d",
"key": "phone_number",
"value": "9221111111",
"type": "string"
},
{
"id": "d0c15f43-5b04-47f4-b26f-9b05e7c58c64",
"key": "first_name",
"value": "Stiltzkin",
"type": "string"
},
{
"id": "3d44e913-b45d-4aaf-9c52-a13e8284a26a",
"key": "last_name",
"value": "Moogle",
"type": "string"
},
{
"id": "c1a8a58a-e36c-4008-b3cb-be03e2c875fe",
"key": "mfg_id",
"value": "1435",
"type": "string"
},
{
"id": "3e6a8c18-a095-4a9d-a230-fda30e649801",
"key": "make_id",
"value": "22043",
"type": "string"
},
{
"id": "ab6c0e13-73e7-4191-94da-178569ed080c",
"key": "name",
"value": "Beetle 1.2 TSI MT (Gas)",
"type": "string"
},
{
"id": "9bd4e6b2-f45e-4e25-a4fa-73c69475d2a1",
"key": "plate_num",
"value": "MGL1234",
"type": "string"
},
{
"id": "aeb30eac-85c6-42c9-940a-dfa07b17484a",
"key": "model_year",
"value": "2016",
"type": "string"
},
{
"id": "e58b31b5-f3ca-4d1d-bc4f-272904013a9f",
"key": "color",
"value": "White",
"type": "string"
},
{
"id": "adaaae50-3591-4fb6-b9d0-d92b4b40dda2",
"key": "condition",
"value": "Brand New",
"type": "string"
},
{
"id": "23d8e583-0b00-4644-98f4-c9ce3307d312",
"key": "fuel_type",
"value": "Gas",
"type": "string"
},
{
"id": "0a9ab79f-75f3-46c2-829d-bb437f656cd5",
"key": "wty_code",
"value": "MKUP0123456",
"type": "string"
},
{
"id": "167fbcaa-0dd1-4b34-aff7-df5c009d8b06",
"key": "wty_expire",
"value": "20201125",
"type": "string"
}
]
}