Hi Chloe,
Thank you in advance for your help.
When I make an API Event Calendar get request by simply typing the URL into the browser with a valid metro_area_id and API key below I get a good response, total entries = 1536
API response is good, has data content with totalEntries = 1594
But when I try to get a response by using axios.get with the same URL and variables with the same value passed in for metro_area_id & api key I get a response but the total entries = 0, so I get no data. Please see code and response below.
function findEventLoc(locId, dateFrom, dateTo){
params: {
apikey: 'bguT074ohahXwEwu',
metro_area_id: locId,
min_date: dateFrom,
max_date: dateTo
}
})
.then(function (response) {
$(function() {
console.log(response);
})
})
.catch(function (error) {
console.log(error);
})
}
Response Object, no data content,
totalEntries = 0;
- Object
- data:
- resultsPage:
- status: "ok"
- results: {}
- perPage: 50
- page: 1
- totalEntries: 0
- __proto__: Object
- __proto__: Object
- status: 200
- statusText: ""
- headers: {cache-control: "private, max-age=3600", content-length: "86", content-type: "application/json; charset=utf-8", expires: "Wed, 12 Feb 2020 19:56:14 GMT"}
- config:
- url: "https://api.songkick.com/api/3.0/metro_areas/{metro_area_id}/calendar.json?apikey={your_api_key}"
- method: "get"
- params: {apikey: "bguT074ohahXwEwu", metro_area_id: 24475, min_date: "2020-02-12", max_date: "2020-02-29"}
- headers: {Accept: "application/json, text/plain, */*"}
- transformRequest: [ƒ]
- transformResponse: [ƒ]
- timeout: 0
- adapter: ƒ (e)
- xsrfCookieName: "XSRF-TOKEN"
- xsrfHeaderName: "X-XSRF-TOKEN"
- maxContentLength: -1
- validateStatus: ƒ (e)
- data: undefined
- __proto__: Object
- request: XMLHttpRequest
- onreadystatechange: ƒ ()
- readyState: 4
- timeout: 0
- withCredentials: false
- upload: XMLHttpRequestUpload {onloadstart: null, onprogress: null, onabort: null, onerror: null, onload: null, …}
- responseURL: "https://api.songkick.com/api/3.0/metro_areas/%7Bmetro_area_id%7D/calendar.json?apikey={your_api_key}&apikey=bguT074ohahXwEwu&metro_area_id=24475&min_date=2020-02-12&max_date=2020-02-29"
- status: 200
- statusText: ""
- responseType: ""
- response: "{"resultsPage":{"status":"ok","results":{},"perPage":50,"page":1,"totalEntries":0}}"
- responseText: "{"resultsPage":{"status":"ok","results":{},"perPage":50,"page":1,"totalEntries":0}}"
- responseXML: null
- onloadstart: null
- onprogress: null
- onabort: ƒ ()
- onerror: ƒ ()
- onload: null
- ontimeout: ƒ ()
- onloadend: null
- __proto__: XMLHttpRequest
- __proto__: Object
I can't seem to figure this out, in another part of my code I use the events API call in a similar way to search an artists name and it works fine, I get a good response with data but when I use the calendar API call above I get no entries.
function findEvents(userInput, dateFrom, dateTo) {
params: {
apikey: 'bguT074ohahXwEwu',
artist_name: userInput,
min_date: dateFrom,
max_date: dateTo
}
})
.then(function (response) {
$(function() {
// The function getData is called here and saved to a variable
console.log(response);
Thanks very much,
Conal