positionstack
positionstack copied to clipboard
Request without data but status 200
I make some request and sometimes, some of here return empty datas. This bug seems to be totally random. If y retry, this one can be good and another previously ok this one without datas.
Examples with St. Lucia:
# logger.info(query, results)
2021-02-14 02:41:18 info: St. Lucia [
[
[]
]
]
# logger.info('Status:', response.status);
2021-02-14 02:41:18 info: Status: [
200
]
# logger.info('Body:', response.body);
2021-02-14 02:41:18 info: Body: [
{
"data": [
[]
]
}
]
My code:
const params = {
access_key: env.POSITIONSTACK_API_KEY,
query,
// fields: 'results.country_code',
limit: 1,
country_module: 1,
};
await sleep(retryCounter);
try {
const response = await superagent.get('http://api.positionstack.com/v1/forward').query(params);
const results = response.body.data;
if (results?.length > 0) {
try {
const {
type,
country_code: countryCode,
region_code: regionCode,
country_module: {
global: { alpha2: countryAlpha2 },
},
} = results[0];
logger.debug(
`For ${query}:
type: ${type}, countryCode: ${countryCode}, regionCode: ${regionCode}, country alpha 2: ${countryAlpha2}`
);
return {
type,
countryCode,
regionCode,
countryAlpha2,
};
} catch (error) {
logger.error(error);
logger.info(query, results);
logger.info('Status:', response.status);
logger.info('Body:', response.body);
}
}
When I test on your website, I have datas:

I am seeing the exact same thing from this API, the response code is 200 but the data json object is empty.
I am also having this issue. In my app, I am trying to get city coordinates, and it sometimes get data, sometimes, dont.

i have the same issue, did you guys figure out how to solve it?
Is there no update on this issue? Open for over 2 years and nothing since Nov 2022?
Having this random problem too, checked my sub is active and updated my API key, my code has been working for some time and has not been changed. Looks like a you problem so how about an update?
APIlayer employees are not present on their github repositories, even the "Are you guys still in business" issue from 2021 is unanswered.
On Twitter they're mostly unhelpful, too. Try their support email.
[Disclaimer: I work for a competitor in geocoding, feel free to test our support response time on any channel]