{"info":{"_postman_id":"795e81eb-34f1-40cd-887e-060196c5b507","name":"Weather Applications","description":"<html><head></head><body><h3 id=\"a-collection-of-weather-api-examples-with-visualization\">A collection of Weather API examples with Visualization</h3>\n<p><strong>(MUST MAKE CHANGES BEFORE USE!!!)</strong></p>\n<blockquote>\n<p>Collection currently contains Darksky &amp; Open Weathermap API Endpoints <strong>ONLY</strong></p>\n</blockquote>\n<p>|Author: Blaine Bettencourt |Version: independently set |Methods used: GET</p>\n<hr>\n<p><strong>The description within each folder contains API limits for the free versions of the API endpoint used.</strong>\nDon't forget to set the API keys used in the requests on the variables tab within the this collection settings screen. <em>dark_key</em> for the <em>Darksky API key</em> &amp; <em>open_key</em> for the <em>Open Weathermap API key</em></p>\n<blockquote>\n<p>An environment should be created to be used with this collection. It can have an arbitrary name but has to contain the variables latitude and longitutde with coordinates set to the location being examined. </p>\n</blockquote>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"11914276","collectionId":"795e81eb-34f1-40cd-887e-060196c5b507","publishedId":"T1LPESe4","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2020-08-15T19:45:39.000Z"},"item":[{"name":"OpenWeathermap API","item":[{"name":"current forecast","event":[{"listen":"test","script":{"id":"94846350-d5c6-4d8d-b799-6cc237f4ef99","exec":["// Constants for the API response","const response = pm.response.json();","const keys = Object.keys(response);","const values = Object.values(response);","","// Template for visualization.","let template = `","    <link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css\" integrity=\"sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO\"","        crossorigin=\"anonymous\">","    <style type=\"text/css\">","        body { font-size: 12px; background: #eee; padding: 16px;}","        .card { border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,.15); -webkit-box-shadow: 0 4px 10px rgba(0,0,0,.15); -moz-box-shadow: 0 4px 10px rgba(0,0,0,.15);}","        .card-topper { border-top-right-radius: 8px; border-top-left-radius: 8px; padding: 8px 16px; font-size: 15px; font-weight: 900; text-transform: uppercase;}","        .card-topper.CLOUDS { background-color: #AAAAAA; color: #ffffff;}","        .card-topper.CLEAR { background-color: #6A1FC5; color: #ffffff;}","    </style>","    <div class=\"container-fluid\">","        <div class=\"row\">","            <div class=\"col mb-4\">","                <h1>Open Weathermap Forecast</h1>","            </div>","        </div>","        <div class=\"row\">","        <script>","            // Use the Developer Tools console to validate the the data you received from pm.visualizer.set()","            console.log(\"Summary: \", \"{{description}}\")","         </script>","            <div class=\"col-sm-6 col-lg-4 col-xl-3 mb-5\">","                <div class=\"card\">","                    <div class=\"test card-topper card-img-top {{response.weather.[0].icon}}\">{{response.weather.[0].main}}</div>","                    <div class=\"card-body\">","                        <h2>{{response.main.temp}} ℉</h2>","                        <p>Summary: {{response.weather.[0].description}}<br>The Current windspeed is:  {{response.wind.speed}} mph<br>Bearing:  {{response.wind.deg}} degrees<br>Current Humidity:  {{response.main.humidity}}%</p>","                        <a href=\"www.openweathermap.org/\" class=\"card-link\" target=\"_blank\" rel=\"noopener noreferrer\">Website</a>","                        <a href=\"https://www.google.com/maps/search/?api=1&query={{response.lat}} {{response.lon}}\" class=\"card-link\" target=\"_blank\" rel=\"noopener noreferrer\">Map</a>","                    </div>","                </div>","            </div>","            ","        </div>","    </div>    ","`;","","","// Set visualizer.","pm.visualizer.set(template, {","    // Pass the response body parsed as JSON as `data`.","    response: response, // The const at the top","    keys: keys, // The const at the top","    values: values  // The const at the top","});","","","","// Testing that the status response is OK.","pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","// Response Check","pm.test(\"Response is valid and has a body\", function () {","     pm.response.to.be.ok;","     pm.response.to.be.withBody;","     pm.response.to.be.json;","});","","// Body Check","pm.test(\"Body match for description\", function () {","    pm.expect(pm.response.text()).to.include(\"description\");","});","","// Testing that the response time is OK.","pm.test(\"Response time is less than 200ms\", function () {","    pm.expect(pm.response.responseTime).to.be.below(200);","});","","// Console log of response type being parsed.","console.log(\" \");","console.log(\" Response type: \", typeof response);","console.log(\" Response: \", response);","console.log(\" \");","console.log(\" Keys: \", keys);","console.log(\" Values: \", values);",""],"type":"text/javascript","packages":{}}},{"listen":"prerequest","script":{"id":"94cb1333-fe48-49f0-8989-4484ebf7aa2b","exec":["// Test ISO variable","pm.test('ISO test', function () {","    pm.variables.set(\"ISO\", \"imperial\")","});"],"type":"text/javascript","packages":{}}}],"id":"70ac190c-b8da-412e-919d-c29a78508e53","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"apikey","apikey":{"value":"<api-key>","key":"<key>"},"isInherited":false},"method":"GET","header":[],"url":"https://api.openweathermap.org/data/2.5/weather?lat={{lat}}&lon={{lon}}&appid={{API key}}&units={{ISO}}","description":"<h3 id=\"wwwopenweathermapnet\"><strong><em><a href=\"http://www.openweathermap.net\">www.openweathermap.net</a></em></strong></h3>\n<p><strong>OneCall API Endpoint provided by OpenWeathermap.org</strong></p>\n<hr />\n<blockquote>\n<p>Description: Makes a call to the <em>Open Weathermap API</em> server to get all weather data using their <em>OneCall</em> API endpoint. <strong><em>APPID</em></strong> is for the <strong><em>API key</em></strong> and should be set through the collection's <em>variables tab</em>. The units returned in the data can be changed by switching \"<em>imperial</em>\" with your choice in the pre-request script taking advantage of the <strong>ISO</strong> variable. </p>\n</blockquote>\n<p>GET forecast provides current weather data and uses vizualization to display the important content.</p>\n<p>|Author: Blaine Bettencourt |Version:1.0 |Method: GET forecast</p>\n","urlObject":{"protocol":"https","path":["data","2.5","weather"],"host":["api","openweathermap","org"],"query":[{"key":"lat","value":"{{lat}}"},{"key":"lon","value":"{{lon}}"},{"key":"appid","value":"{{API key}}"},{"key":"units","value":"{{ISO}}"}],"variable":[]}},"response":[],"_postman_id":"70ac190c-b8da-412e-919d-c29a78508e53"},{"name":"one call forecast","event":[{"listen":"test","script":{"id":"94846350-d5c6-4d8d-b799-6cc237f4ef99","exec":["// Constants for the API response","const response = pm.response.json();","const keys = Object.keys(response);","const values = Object.values(response);","","// Template for visualization.","let template = `","    <link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css\" integrity=\"sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO\"","        crossorigin=\"anonymous\">","    <style type=\"text/css\">","        body { font-size: 12px; background: #eee; padding: 16px;}","        .card { border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,.15); -webkit-box-shadow: 0 4px 10px rgba(0,0,0,.15); -moz-box-shadow: 0 4px 10px rgba(0,0,0,.15);}","        .card-topper { border-top-right-radius: 8px; border-top-left-radius: 8px; padding: 8px 16px; font-size: 15px; font-weight: 900; text-transform: uppercase;}","        .card-topper.CLOUDS { background-color: #AAAAAA; color: #ffffff;}","        .card-topper.CLEAR { background-color: #6A1FC5; color: #ffffff;}","    </style>","    <div class=\"container-fluid\">","        <div class=\"row\">","            <div class=\"col mb-4\">","                <h1>Open Weathermap Forecast</h1>","            </div>","        </div>","        <div class=\"row\">","        <script>","            // Use the Developer Tools console to validate the the data you received from pm.visualizer.set()","            console.log(\"Summary: \", \"{{description}}\")","         </script>","            <div class=\"col-sm-6 col-lg-4 col-xl-3 mb-5\">","                <div class=\"card\">","                    <div class=\"test card-topper card-img-top {{response.current.weather.[0].main}}\">{{response.current.weather.[0].main}}</div>","                    <div class=\"card-body\">","                        <h2>{{response.current.temp}} ℉</h2>","                        <p>Summary: {{response.current.weather.[0].description}}<br>The Current windspeed is:  {{response.current.wind_speed}} mph<br>Bearing:  {{response.current.wind_deg}} degrees<br>Current Humidity:  {{response.current.humidity}}%</p>","                        <a href=\"www.openweathermap.org/\" class=\"card-link\" target=\"_blank\" rel=\"noopener noreferrer\">Website</a>","                        <a href=\"https://www.google.com/maps/search/?api=1&query={{response.lat}} {{response.lon}}\" class=\"card-link\" target=\"_blank\" rel=\"noopener noreferrer\">Map</a>","                    </div>","                </div>","            </div>","            ","        </div>","    </div>    ","`;","","","// Set visualizer.","pm.visualizer.set(template, {","    // Pass the response body parsed as JSON as `data`.","    response: response, // The const at the top","    keys: keys, // The const at the top","    values: values  // The const at the top","});","","","","// Testing that the status response is OK.","pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","// Response Check","pm.test(\"Response is valid and has a body\", function () {","     pm.response.to.be.ok;","     pm.response.to.be.withBody;","     pm.response.to.be.json;","});","","// Body Check","pm.test(\"Body match for description\", function () {","    pm.expect(pm.response.text()).to.include(\"description\");","});","","// Testing that the response time is OK.","pm.test(\"Response time is less than 200ms\", function () {","    pm.expect(pm.response.responseTime).to.be.below(200);","});","","// Console log of response type being parsed.","console.log(\" \");","console.log(\" Response type: \", typeof response);","console.log(\" Response: \", response);","console.log(\" \");","console.log(\" Keys: \", keys);","console.log(\" Values: \", values);",""],"type":"text/javascript","packages":{}}},{"listen":"prerequest","script":{"id":"94cb1333-fe48-49f0-8989-4484ebf7aa2b","exec":["// Test ISO variable","pm.test('ISO test', function () {","    pm.variables.set(\"ISO\", \"imperial\")","});"],"type":"text/javascript","packages":{}}}],"id":"198403b7-9bf7-4afb-bf51-aaa0307ca718","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"apikey","apikey":{"value":"<api-key>","key":"<key>"},"isInherited":false},"method":"GET","header":[],"url":"https://api.openweathermap.org/data/3.0/onecall?lat={{lat}}&lon={{lon}}&appid={{API key}}&units={{ISO}}","description":"<h3 id=\"wwwopenweathermapnet\"><strong><em><a href=\"http://www.openweathermap.net\">www.openweathermap.net</a></em></strong></h3>\n<p><strong>OneCall API Endpoint provided by OpenWeathermap.org</strong></p>\n<hr />\n<blockquote>\n<p>Description: Makes a call to the <em>Open Weathermap API</em> server to get all weather data using their <em>OneCall</em> API endpoint. <strong><em>APPID</em></strong> is for the <strong><em>API key</em></strong> and should be set through the collection's <em>variables tab</em>. The units returned in the data can be changed by switching \"<em>imperial</em>\" with your choice in the pre-request script taking advantage of the <strong>ISO</strong> variable. </p>\n</blockquote>\n<p>GET forecast provides current weather data and uses vizualization to display the important content.</p>\n<p>|Author: Blaine Bettencourt |Version:1.0 |Method: GET forecast</p>\n","urlObject":{"protocol":"https","path":["data","3.0","onecall"],"host":["api","openweathermap","org"],"query":[{"key":"lat","value":"{{lat}}"},{"key":"lon","value":"{{lon}}"},{"key":"appid","value":"{{API key}}"},{"key":"units","value":"{{ISO}}"}],"variable":[]}},"response":[],"_postman_id":"198403b7-9bf7-4afb-bf51-aaa0307ca718"}],"id":"0c03ea95-b47f-42b7-aeef-990d9227f857","description":"<h3 id=\"open-weathermap-api-using-the-free-service\">Open WeatherMap API using the FREE service.</h3>\n<p><strong>Free version Service Includes:</strong></p>\n<blockquote>\n<p>Current weather and forecast  </p>\n</blockquote>\n<blockquote>\n<p>Hourly forecast: unavailable</p>\n</blockquote>\n<blockquote>\n<p>Daily forecast: unavailable</p>\n</blockquote>\n<blockquote>\n<p>3 hour forecast: 5 days</p>\n</blockquote>\n<blockquote>\n<p>60 calls/minute</p>\n</blockquote>\n<blockquote>\n<p>1,000,000 calls/month</p>\n</blockquote>\n","event":[{"listen":"prerequest","script":{"id":"1458855b-8676-47f1-9f3c-e97d14315f94","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"3b218e52-7a69-46bd-9076-56fd71304c47","type":"text/javascript","exec":[""]}}],"_postman_id":"0c03ea95-b47f-42b7-aeef-990d9227f857"},{"name":"Darksky API","item":[{"name":"forecastSummary","event":[{"listen":"test","script":{"id":"1fad1116-1a13-4a09-94c3-0eae194b0eb0","exec":["// Constants for the API response","const response = pm.response.json();","const keys = Object.keys(response);","const values = Object.values(response);","","// Template for visualization.","let template = `","    <link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css\" integrity=\"sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO\"","        crossorigin=\"anonymous\">","    <style type=\"text/css\">","        body { font-size: 12px; background: #eee; padding: 16px;}","        .card { border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,.15); -webkit-box-shadow: 0 4px 10px rgba(0,0,0,.15); -moz-box-shadow: 0 4px 10px rgba(0,0,0,.15);}","        .card-topper { border-top-right-radius: 8px; border-top-left-radius: 8px; padding: 8px 16px; font-size: 15px; font-weight: 900; text-transform: uppercase;}","        .card-topper.PARTLY-CLOUDY-DAY { background-color: #AAAAAA; color: #ffffff;}","        .card-topper.CLEAR-DAY { background-color: #6A1FC5; color: #ffffff;}","    </style>","    <div class=\"container-fluid\">","        <div class=\"row\">","            <div class=\"col mb-4\">","                <h1>Darksy Forecast</h1>","            </div>","        </div>","        <div class=\"row\">","        <script>","            // Use the Developer Tools console to validate the the data you received from pm.visualizer.set()","            console.log(\"Summary: \", \"{{response.currently.summary}}\")","         </script>","            <div class=\"col-sm-6 col-lg-4 col-xl-3 mb-5\">","                <div class=\"card\">","                    <div class=\"test card-topper card-img-top {{response.currently.icon}}\">{{response.currently.icon}}</div>","                    <div class=\"card-body\">","                        <h2>{{response.currently.temperature}} ℉</h2>","                        <p>{{response.currently.summary}}<br>The Current windspeed is:  {{response.currently.windSpeed}} mph<br>Wind gusts are:  {{response.currently.windGust}} mph<br>Bearing:  {{response.currently.windBearing}} degrees</p>","                        <a href=\"www.darksky.net/\" class=\"card-link\" target=\"_blank\" rel=\"noopener noreferrer\">Website</a>","                        <a href=\"https://www.google.com/maps/search/?api=1&query={{response.latitude}} {{response.longtitude}}\" class=\"card-link\" target=\"_blank\" rel=\"noopener noreferrer\">Map</a>","                    </div>","                </div>","            </div>","            ","        </div>","    </div>    ","`;","","","// Set visualizer.","pm.visualizer.set(template, {","    // Pass the response body parsed as JSON as `data`.","    response: response, // The const at the top","    keys: keys, // The const at the top","    values: values  // The const at the top   ","});","","","","// Testing that the status response is OK.","pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","// Response Check","pm.test(\"Response is valid and has a body\", function () {","     pm.response.to.be.ok;","     pm.response.to.be.withBody;","     pm.response.to.be.json;","});","","// Body Check","pm.test(\"Body match for summary\", function () {","    pm.expect(pm.response.text()).to.include(\"summary\");","});","","// Testing that the response time is OK.","pm.test(\"Response time is less than 150ms\", function () {","    pm.expect(pm.response.responseTime).to.be.below(150);","});","","// Console log of response type being parsed.","console.log(\" \");","console.log(\" Response type: \", typeof response);","console.log(\" Response: \", response);","console.log(\" \");","console.log(\" Keys: \", keys);","console.log(\" Values: \", values);",""],"type":"text/javascript"}},{"listen":"prerequest","script":{"id":"c86ca349-25c5-46b7-961e-434c0715a4e1","exec":["// Log to the console the DataView","console.log(\"Sending API....\", this.DataView);","","// Use ISO variable to easily switch states","pm.test(\"ISO test\", function () {","    pm.variables.set(\"ISO\", \"minutely,hourly,daily,alerts,flags\");","});",""],"type":"text/javascript"}}],"id":"c09d07af-6bb3-4aa4-9c90-fd7fd2717ed6","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"https://api.darksky.net/forecast/<api-key>/{{latitude}},{{longitude}}?exclude={{ISO}}","description":"<h3 id=\"wwwdarkskynet\"><strong><em><a href=\"http://www.darksky.net\">www.darksky.net</a></em></strong></h3>\n<p><strong>The <em>Darksky API</em>   is the largest weather API in use and easiest to use.</strong></p>\n<p><em>Darksky API is now owned by APPLE INC.</em></p>\n<hr />\n<blockquote>\n<p>Description: method is a GET method that makes a call to the Darksky forecast API for the <strong>current forecast only</strong>. To change the data returned change the <strong>ISO</strong> variable within the <em>pre-request script</em> tab.</p>\n</blockquote>\n<p>This Darksky API Postman implementation with visualization displays the data in question on a card to easily view what is important currently with the weather. The <strong><em>API key</em></strong> goes in between the slashes \"//\" in the URL request after <em><a href=\"https://api.darksky.net/forecast\">https://api.darksky.net/forecast</a></em>. It can be set using the <em>collection's variables tab</em>.</p>\n<p>|Author : Blaine Bettencourt\n|Version: 1.0\n|Method: GET forecastSummary</p>\n","urlObject":{"protocol":"https","path":["forecast","<api-key>","{{latitude}},{{longitude}}"],"host":["api","darksky","net"],"query":[{"key":"exclude","value":"{{ISO}}"}],"variable":[]}},"response":[],"_postman_id":"c09d07af-6bb3-4aa4-9c90-fd7fd2717ed6"}],"id":"0c1f2c29-37db-4db0-87e6-d964eb7a1690","description":"<h3 id=\"free-trial-version-of-the-darksky-api-is-no-longer-available-to-new-users\">FREE TRIAL VERSION OF THE DARKSKY API IS NO LONGER AVAILABLE TO NEW USERS</h3>\n<blockquote>\n<p>The free version of the Darksky API endpoint allows up to 1,000 free calls per day to evaluate the Dark Sky API.</p>\n</blockquote>\n<p>Make sure to set the <strong><em>API key</em></strong> in the collection variable tab.</p>\n","event":[{"listen":"prerequest","script":{"id":"a814b58f-4131-4da4-b92a-e149eca7cf73","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"b6b06498-2c3b-47e5-a21f-4ad158206dd6","type":"text/javascript","exec":[""]}}],"_postman_id":"0c1f2c29-37db-4db0-87e6-d964eb7a1690"}],"event":[{"listen":"prerequest","script":{"id":"7ee1556b-13ae-4468-b093-280c2b8954bd","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"20772deb-4c35-4a2b-833b-0f23796e21ec","type":"text/javascript","exec":[""]}}],"variable":[{"key":"dark_key","value":"<api-key>"},{"key":"open_key","value":"<api-key>"}]}