{ "info": { "_postman_id": "8ab64d67-b768-4858-8079-6d562e9c77e5", "name": "ContosoAPI", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { "name": "Client Credentials Flow", "event": [ { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } }, { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 200\", function () {\r", " pm.response.to.have.status(200);\r", "});\r", "\r", "var obj = pm.response.json();\r", "pm.environment.set(\"token\", obj.access_token)" ], "type": "text/javascript" } } ], "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "method": "GET", "header": [], "body": { "mode": "urlencoded", "urlencoded": [ { "key": "client_id", "value": "{{ClientId}}", "type": "text" }, { "key": "client_secret", "value": "{{ClientSecret}}", "type": "text" }, { "key": "grant_type", "value": "client_credentials", "type": "text" }, { "key": "scope", "value": "api://{{ClientId}}/.default", "type": "text" } ] }, "url": { "raw": "https://login.microsoftonline.com/{{TenantId}}/oauth2/v2.0/token", "protocol": "https", "host": [ "login", "microsoftonline", "com" ], "path": [ "{{TenantId}}", "oauth2", "v2.0", "token" ] } }, "response": [] }, { "name": "Get weather", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 200\", function () {\r", " pm.response.to.have.status(200);\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "default" } ], "url": { "raw": "https://localhost:7250/WeatherForecast", "protocol": "https", "host": [ "localhost" ], "port": "7250", "path": [ "WeatherForecast" ] } }, "response": [] } ] }