I'm new to JSON requests, cURL, etc. and I can't figure out how to correctly format a JSON request with authorization. I'm trying to call on a Spotify API and they reccomend a cURL request:
GET https://api.spotify.com/v1/search
and
curl -X "GET" "https://api.spotify.com/v1/search?q=tania%20bowra&type=artist" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer ReallyLongKey"
I don't know how to use cURL and GET so I tried to use ajax:
function Search() {
$.ajax({
url: 'https://api.spotify.com/v1/search?q=Muse&type=track%2Cartist&market=US&limit=10&offset=5',
datatype: 'json',
type: 'get',
cache: false,
success: function(Data) {
//stuff
}
});
}
How do I use cURL or add authentication to the ajax method? Thanks in advance, Justin.