I was working on weather app and found the mashape api for weather data. However, it provides the endpoint as a URL (ok, I understand that), but the sample it provides is in curl (see below). I’m stuck trying to figure out how to convert this into something like the examples we saw here in FCC using $.getJSON like first section below. However, it gets an error that application key is missing. Any suggestions on my potentially obvious noobiness issue?
=====MY JSON JavaScript attempt==========
function getWeather() {
$("#weatherContent").html(’’);
$.getJSON(“https://simple-weather.p.mashape.com/weatherdata?lat=1.0&lng=1.0&X-Mashape-Key=9OeNI1Ztu3mshtAHIYTSI6Q6CYbMp1ZkQ4QjsnMozBMMkKgGJX”, function(weatherResponse) {
})
}
======The CURL example provided=======================
curl --get --include ‘https://simple-weather.p.mashape.com/weatherdata?lat=1.0&lng=1.0’
-H ‘X-Mashape-Key: 9OeNI1Ztu3mshtAHIYTSI6Q6CYbMp1ZkQ4QjsnMozBMMkKgGJX’
-H ‘Accept: application/json’
Thanks in advance.
Tom