Difference between revisions of "Postman/HELLOMobility"
Jump to navigation
Jump to search
(Add HELLO Mobility Postman collection) |
(Aggiunte chiamate per la gestione dei veicoli di un utente) |
||
Line 46: | Line 46: | ||
"body": { | "body": { | ||
"mode": "raw", | "mode": "raw", | ||
− | "raw": "{\n \"firstName\": \"{{$randomFirstName}}\",\n \"lastName\": \"{{$randomLastName}}\",\n \"phoneNumber\": \" | + | "raw": "{\n \"firstName\": \"{{$randomFirstName}}\",\n \"lastName\": \"{{$randomLastName}}\",\n \"phoneNumber\": \"{{phoneNumber}}\"\n}", |
"options": { | "options": { | ||
"raw": { | "raw": { | ||
Line 316: | Line 316: | ||
"body": { | "body": { | ||
"mode": "raw", | "mode": "raw", | ||
− | "raw": "{\n \"licensePlate\": \" | + | "raw": "{\n \"licensePlate\": \"CA220NE\"\n}", |
"options": { | "options": { | ||
"raw": { | "raw": { | ||
Line 378: | Line 378: | ||
}, | }, | ||
"response": [] | "response": [] | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | { | ||
+ | "name": "menu", | ||
+ | "item": [ | ||
+ | { | ||
+ | "name": "View cars", | ||
+ | "event": [ | ||
+ | { | ||
+ | "listen": "test", | ||
+ | "script": { | ||
+ | "exec": [ | ||
+ | "pm.test(\"Save primary vehicle id\", function () {", | ||
+ | " pm.response.to.have.status(200);", | ||
+ | " var jsonData = pm.response.json();", | ||
+ | " if (jsonData) {", | ||
+ | " // Filter in order to get primary vehicles", | ||
+ | " var primaryVehicles = jsonData.filter(vehicle => vehicle.primary === true);", | ||
+ | " if (primaryVehicles.length > 0) {", | ||
+ | " var primaryVehicle = primaryVehicles[0];", | ||
+ | " pm.environment.set(\"primaryVehicleId\", primaryVehicle.id);", | ||
+ | " pm.environment.set(\"licensePlate\", primaryVehicle.licensePlate);", | ||
+ | " }", | ||
+ | " }", | ||
+ | "});" | ||
+ | ], | ||
+ | "type": "text/javascript" | ||
+ | } | ||
+ | } | ||
+ | ], | ||
+ | "request": { | ||
+ | "method": "GET", | ||
+ | "header": [ | ||
+ | { | ||
+ | "key": "QUISQUE-APP-ID", | ||
+ | "value": "{{applicationId}}", | ||
+ | "type": "text" | ||
+ | }, | ||
+ | { | ||
+ | "key": "QUISQUE-SESSION-ID", | ||
+ | "value": "{{clientSessionId}}", | ||
+ | "type": "text" | ||
+ | } | ||
+ | ], | ||
+ | "url": { | ||
+ | "raw": "{{url}}{{api}}{{v2}}/me/vehicles", | ||
+ | "host": [ | ||
+ | "{{url}}{{api}}{{v2}}" | ||
+ | ], | ||
+ | "path": [ | ||
+ | "me", | ||
+ | "vehicles" | ||
+ | ] | ||
+ | } | ||
+ | }, | ||
+ | "response": [] | ||
+ | }, | ||
+ | { | ||
+ | "name": "Remove vehicle", | ||
+ | "event": [ | ||
+ | { | ||
+ | "listen": "test", | ||
+ | "script": { | ||
+ | "exec": [ | ||
+ | "" | ||
+ | ], | ||
+ | "type": "text/javascript" | ||
+ | } | ||
+ | } | ||
+ | ], | ||
+ | "request": { | ||
+ | "method": "DELETE", | ||
+ | "header": [ | ||
+ | { | ||
+ | "key": "QUISQUE-APP-ID", | ||
+ | "value": "{{applicationId}}", | ||
+ | "type": "text" | ||
+ | }, | ||
+ | { | ||
+ | "key": "QUISQUE-SESSION-ID", | ||
+ | "value": "{{clientSessionId}}", | ||
+ | "type": "text" | ||
+ | } | ||
+ | ], | ||
+ | "url": { | ||
+ | "raw": "{{url}}{{api}}{{v2}}/me/vehicles/{{primaryVehicleId}}", | ||
+ | "host": [ | ||
+ | "{{url}}{{api}}{{v2}}" | ||
+ | ], | ||
+ | "path": [ | ||
+ | "me", | ||
+ | "vehicles", | ||
+ | "{{primaryVehicleId}}" | ||
+ | ] | ||
+ | } | ||
+ | }, | ||
+ | "response": [] | ||
+ | }, | ||
+ | { | ||
+ | "name": "Updadte vehicle information", | ||
+ | "event": [ | ||
+ | { | ||
+ | "listen": "test", | ||
+ | "script": { | ||
+ | "exec": [ | ||
+ | "" | ||
+ | ], | ||
+ | "type": "text/javascript" | ||
+ | } | ||
+ | } | ||
+ | ], | ||
+ | "request": { | ||
+ | "method": "PUT", | ||
+ | "header": [ | ||
+ | { | ||
+ | "key": "QUISQUE-APP-ID", | ||
+ | "value": "{{applicationId}}", | ||
+ | "type": "text" | ||
+ | }, | ||
+ | { | ||
+ | "key": "QUISQUE-SESSION-ID", | ||
+ | "value": "{{clientSessionId}}", | ||
+ | "type": "text" | ||
+ | } | ||
+ | ], | ||
+ | "body": { | ||
+ | "mode": "raw", | ||
+ | "raw": "{\n \"primary\": true,\n \"name\": \"{{$randomFirstName}}\"\n}", | ||
+ | "options": { | ||
+ | "raw": { | ||
+ | "language": "json" | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | "url": { | ||
+ | "raw": "{{url}}{{api}}{{v2}}/me/vehicles/{{primaryVehicleId}}", | ||
+ | "host": [ | ||
+ | "{{url}}{{api}}{{v2}}" | ||
+ | ], | ||
+ | "path": [ | ||
+ | "me", | ||
+ | "vehicles", | ||
+ | "{{primaryVehicleId}}" | ||
+ | ] | ||
+ | } | ||
+ | }, | ||
+ | "response": [ | ||
+ | { | ||
+ | "name": "Set vehicle as primary", | ||
+ | "originalRequest": { | ||
+ | "method": "PUT", | ||
+ | "header": [ | ||
+ | { | ||
+ | "key": "QUISQUE-APP-ID", | ||
+ | "value": "{{applicationId}}", | ||
+ | "type": "text" | ||
+ | }, | ||
+ | { | ||
+ | "key": "QUISQUE-SESSION-ID", | ||
+ | "value": "{{clientSessionId}}", | ||
+ | "type": "text" | ||
+ | } | ||
+ | ], | ||
+ | "body": { | ||
+ | "mode": "raw", | ||
+ | "raw": "{\n \"primary\": true\n}", | ||
+ | "options": { | ||
+ | "raw": { | ||
+ | "language": "json" | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | "url": { | ||
+ | "raw": "{{url}}{{api}}{{v2}}/me/vehicles/{{primaryVehicleId}}", | ||
+ | "host": [ | ||
+ | "{{url}}{{api}}{{v2}}" | ||
+ | ], | ||
+ | "path": [ | ||
+ | "me", | ||
+ | "vehicles", | ||
+ | "{{primaryVehicleId}}" | ||
+ | ] | ||
+ | } | ||
+ | }, | ||
+ | "_postman_previewlanguage": null, | ||
+ | "header": null, | ||
+ | "cookie": [], | ||
+ | "body": null | ||
+ | }, | ||
+ | { | ||
+ | "name": "Change vehicle name", | ||
+ | "originalRequest": { | ||
+ | "method": "PUT", | ||
+ | "header": [ | ||
+ | { | ||
+ | "key": "QUISQUE-APP-ID", | ||
+ | "value": "{{applicationId}}", | ||
+ | "type": "text" | ||
+ | }, | ||
+ | { | ||
+ | "key": "QUISQUE-SESSION-ID", | ||
+ | "value": "{{clientSessionId}}", | ||
+ | "type": "text" | ||
+ | } | ||
+ | ], | ||
+ | "body": { | ||
+ | "mode": "raw", | ||
+ | "raw": "{\n \"name\": \"{{$randomFirstName}}\"\n}", | ||
+ | "options": { | ||
+ | "raw": { | ||
+ | "language": "json" | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | "url": { | ||
+ | "raw": "{{url}}{{api}}{{v2}}/me/vehicles/{{primaryVehicleId}}", | ||
+ | "host": [ | ||
+ | "{{url}}{{api}}{{v2}}" | ||
+ | ], | ||
+ | "path": [ | ||
+ | "me", | ||
+ | "vehicles", | ||
+ | "{{primaryVehicleId}}" | ||
+ | ] | ||
+ | } | ||
+ | }, | ||
+ | "_postman_previewlanguage": null, | ||
+ | "header": null, | ||
+ | "cookie": [], | ||
+ | "body": null | ||
+ | } | ||
+ | ] | ||
} | } | ||
] | ] |
Latest revision as of 13:34, 20 May 2021
{
"info": {
"_postman_id": "44630425-bb87-451f-80b3-4e2698f32568",
"name": "Hello API",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "onboarding",
"item": [
{
"name": "Create sign up request",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Sign up request created\", function () {",
" pm.response.to.have.status(201);",
" var jsonData = pm.response.json();",
" pm.environment.set(\"requestId\", jsonData.id);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [
{
"key": "QUISQUE-APP-ID",
"value": "{{applicationId}}",
"type": "text"
},
{
"key": "QUISQUE-SESSION-ID",
"value": "{{clientSessionId}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"firstName\": \"{{$randomFirstName}}\",\n \"lastName\": \"{{$randomLastName}}\",\n \"phoneNumber\": \"{{phoneNumber}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{url}}{{api}}{{v1}}/hello/sign-up-requests",
"host": [
"{{url}}{{api}}{{v1}}"
],
"path": [
"hello",
"sign-up-requests"
]
}
},
"response": []
},
{
"name": "Send again PIN code",
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [
{
"key": "QUISQUE-APP-ID",
"value": "{{applicationId}}",
"type": "text"
},
{
"key": "QUISQUE-SESSION-ID",
"value": "{{clientSessionId}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"firstName\": \"{{$randomFirstName}}\",\n \"lastName\": \"{{$randomLastName}}\",\n \"phoneNumber\": \"{{phoneNumber}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{url}}{{api}}{{v1}}/hello/sign-up-requests",
"host": [
"{{url}}{{api}}{{v1}}"
],
"path": [
"hello",
"sign-up-requests"
]
}
},
"response": []
},
{
"name": "Verify PIN",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Create user\", function () {",
" pm.response.to.have.status(200);",
" pm.environment.set(\"apiKey\", pm.response.json().apiKey);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "PUT",
"header": [
{
"key": "QUISQUE-APP-ID",
"value": "{{applicationId}}",
"type": "text"
},
{
"key": "QUISQUE-SESSION-ID",
"value": "{{clientSessionId}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"pin\": \"{{pin}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{url}}{{api}}{{v1}}/hello/sign-up-requests/{{requestId}}",
"host": [
"{{url}}{{api}}{{v1}}"
],
"path": [
"hello",
"sign-up-requests",
"{{requestId}}"
]
}
},
"response": []
},
{
"name": "Get sign up request information",
"request": {
"auth": {
"type": "noauth"
},
"method": "GET",
"header": [
{
"key": "QUISQUE-APP-ID",
"value": "{{applicationId}}",
"type": "text"
},
{
"key": "QUISQUE-SESSION-ID",
"value": "{{clientSessionId}}",
"type": "text"
}
],
"url": {
"raw": "{{url}}{{api}}{{v1}}/hello/sign-up-requests/{{requestId}}",
"host": [
"{{url}}{{api}}{{v1}}"
],
"path": [
"hello",
"sign-up-requests",
"{{requestId}}"
]
}
},
"response": []
},
{
"name": "[DEV ONLY] - Get sign up PIN",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"PIN received\", function () {",
" pm.response.to.have.status(200);",
" pm.environment.set(\"pin\", pm.response.json().pin);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "GET",
"header": [
{
"key": "QUISQUE-APP-ID",
"value": "{{applicationId}}",
"type": "text"
}
],
"url": {
"raw": "{{url}}{{api}}{{v1}}/maintenance/phone-number-pin/{{requestId}}",
"host": [
"{{url}}{{api}}{{v1}}"
],
"path": [
"maintenance",
"phone-number-pin",
"{{requestId}}"
]
}
},
"response": []
},
{
"name": "Set password",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "QUISQUE-APP-ID",
"value": "{{applicationId}}",
"type": "text"
},
{
"key": "QUISQUE-SESSION-ID",
"value": "{{clientSessionId}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"password\": \"{{$randomPassword}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{url}}{{api}}{{v2}}/me/password",
"host": [
"{{url}}{{api}}{{v2}}"
],
"path": [
"me",
"password"
]
}
},
"response": []
}
]
},
{
"name": "completamento profilo",
"item": [
{
"name": "Search vehicle information",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "QUISQUE-APP-ID",
"value": "{{applicationId}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"licensePlate\": \"CA220NE\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{url}}{{api}}{{v1}}/vehicles",
"host": [
"{{url}}{{api}}{{v1}}"
],
"path": [
"vehicles"
]
}
},
"response": []
},
{
"name": "Add vehicle",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "QUISQUE-APP-ID",
"value": "{{applicationId}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"licensePlate\": \"ca220ne\",\n \"name\": \"{{$randomFirstName}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{url}}{{api}}{{v2}}/me/vehicles",
"host": [
"{{url}}{{api}}{{v2}}"
],
"path": [
"me",
"vehicles"
]
}
},
"response": []
}
]
},
{
"name": "menu",
"item": [
{
"name": "View cars",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Save primary vehicle id\", function () {",
" pm.response.to.have.status(200);",
" var jsonData = pm.response.json();",
" if (jsonData) {",
" // Filter in order to get primary vehicles",
" var primaryVehicles = jsonData.filter(vehicle => vehicle.primary === true);",
" if (primaryVehicles.length > 0) {",
" var primaryVehicle = primaryVehicles[0];",
" pm.environment.set(\"primaryVehicleId\", primaryVehicle.id);",
" pm.environment.set(\"licensePlate\", primaryVehicle.licensePlate);",
" }",
" }",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "QUISQUE-APP-ID",
"value": "{{applicationId}}",
"type": "text"
},
{
"key": "QUISQUE-SESSION-ID",
"value": "{{clientSessionId}}",
"type": "text"
}
],
"url": {
"raw": "{{url}}{{api}}{{v2}}/me/vehicles",
"host": [
"{{url}}{{api}}{{v2}}"
],
"path": [
"me",
"vehicles"
]
}
},
"response": []
},
{
"name": "Remove vehicle",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "DELETE",
"header": [
{
"key": "QUISQUE-APP-ID",
"value": "{{applicationId}}",
"type": "text"
},
{
"key": "QUISQUE-SESSION-ID",
"value": "{{clientSessionId}}",
"type": "text"
}
],
"url": {
"raw": "{{url}}{{api}}{{v2}}/me/vehicles/{{primaryVehicleId}}",
"host": [
"{{url}}{{api}}{{v2}}"
],
"path": [
"me",
"vehicles",
"{{primaryVehicleId}}"
]
}
},
"response": []
},
{
"name": "Updadte vehicle information",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PUT",
"header": [
{
"key": "QUISQUE-APP-ID",
"value": "{{applicationId}}",
"type": "text"
},
{
"key": "QUISQUE-SESSION-ID",
"value": "{{clientSessionId}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"primary\": true,\n \"name\": \"{{$randomFirstName}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{url}}{{api}}{{v2}}/me/vehicles/{{primaryVehicleId}}",
"host": [
"{{url}}{{api}}{{v2}}"
],
"path": [
"me",
"vehicles",
"{{primaryVehicleId}}"
]
}
},
"response": [
{
"name": "Set vehicle as primary",
"originalRequest": {
"method": "PUT",
"header": [
{
"key": "QUISQUE-APP-ID",
"value": "{{applicationId}}",
"type": "text"
},
{
"key": "QUISQUE-SESSION-ID",
"value": "{{clientSessionId}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"primary\": true\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{url}}{{api}}{{v2}}/me/vehicles/{{primaryVehicleId}}",
"host": [
"{{url}}{{api}}{{v2}}"
],
"path": [
"me",
"vehicles",
"{{primaryVehicleId}}"
]
}
},
"_postman_previewlanguage": null,
"header": null,
"cookie": [],
"body": null
},
{
"name": "Change vehicle name",
"originalRequest": {
"method": "PUT",
"header": [
{
"key": "QUISQUE-APP-ID",
"value": "{{applicationId}}",
"type": "text"
},
{
"key": "QUISQUE-SESSION-ID",
"value": "{{clientSessionId}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"{{$randomFirstName}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{url}}{{api}}{{v2}}/me/vehicles/{{primaryVehicleId}}",
"host": [
"{{url}}{{api}}{{v2}}"
],
"path": [
"me",
"vehicles",
"{{primaryVehicleId}}"
]
}
},
"_postman_previewlanguage": null,
"header": null,
"cookie": [],
"body": null
}
]
}
]
},
{
"name": "Sign In",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Sign in OK\", function () {",
" pm.response.to.have.status(200);",
" pm.environment.set(\"apiKey\", pm.response.json().apiKey);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [
{
"key": "QUISQUE-APP-ID",
"value": "{{applicationId}}",
"type": "text"
},
{
"key": "QUISQUE-SESSION-ID",
"value": "{{clientSessionId}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"username\": \"{{phoneNumber}}\",\n \"password\": \"Hello\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{url}}{{api}}{{v2}}/keys",
"host": [
"{{url}}{{api}}{{v2}}"
],
"path": [
"keys"
]
}
},
"response": []
},
{
"name": "Generate sessionId and get configurations",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Session created\", function () {",
" pm.response.to.have.status(200);",
" pm.environment.set(\"clientSessionId\", pm.response.json().sessionId);",
" pm.environment.set(\"url\", pm.response.json().baseUrl);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [
{
"key": "QUISQUE-APP-ID",
"value": "{{applicationId}}",
"type": "text"
},
{
"key": "Accept-Language",
"value": "it",
"type": "text",
"disabled": true
}
],
"body": {
"mode": "raw",
"raw": "{\n \"appName\": \"{{$randomProductName}}\",\n \"appVersion\": \"{{$randomSemver}}\",\n \"os\": \"iOS\",\n \"osVersion\": \"{{$randomSemver}}\",\n \"appBundle\": \"net.hellomobility.whatever\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{url}}{{api}}{{v2}}/configurations",
"host": [
"{{url}}{{api}}{{v2}}"
],
"path": [
"configurations"
]
}
},
"response": []
}
],
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{apiKey}}",
"type": "string"
}
]
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
],
"variable": [
{
"key": "v1",
"value": "/v1"
},
{
"key": "v2",
"value": "/v2"
},
{
"key": "applicationId",
"value": "hellomajvsjnpcmn"
},
{
"key": "api",
"value": "/api"
}
]
}