Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: batch support #6

Closed
vladc opened this issue Sep 13, 2019 · 5 comments
Closed

Bug: batch support #6

vladc opened this issue Sep 13, 2019 · 5 comments

Comments

@vladc
Copy link

vladc commented Sep 13, 2019

Batch requests are handled differently with this proxy then you would expect when compared to the normal IP-API batch request. This proxy will break apart a batch request it receives and execute each request individually.

Is there a reason for why batch requests are broken apart like this?

@BenB196
Copy link
Owner

BenB196 commented Sep 13, 2019

Hi vladc,

Yes, this has to do with a weird functionality of the IP-API batch request. I pointed it out here in the back end package, but here is the quote:

An observation about the batch query. It sometime appears to return less data then the single query on the exact same query even when the same fields are passed. This is something that appears to be on the IP-API end, not the package end.

I will add this to the docs so that it is more clear on why this is so. Also, if you would like to confirm this, weird functionality, if you were to run a batch query against IP-API specifying all fields, and then rerun those queries as single requests with all fields, you should see that some fields are in fact omitted from the batch query results.

@vladc
Copy link
Author

vladc commented Sep 13, 2019

BenB196,

The same data is returned, but the batch endpoint does not support the "reverse" field.

% curl -s http://ip-api.com/batch?fields=16510975 --data '[{"query": "24.48.0.1"}]' | jq .[0] | md5sum
a9540666a90c6e9fbf22f93fab39df91  -

% curl -s http://ip-api.com/json/24.48.0.1?fields=16510975 | jq . | md5sum
a9540666a90c6e9fbf22f93fab39df91  -

If you need to support the reverse field for the batch feature, you can do the lookup locally.

@BenB196
Copy link
Owner

BenB196 commented Sep 13, 2019

Ok, if that is the case then, I will add support for this. Please see: BenB196/ip-api-go-pkg#1

BenB196 added a commit that referenced this issue Sep 14, 2019
Also added support for reverse lookups on batch queries, resolving issue #6.
@BenB196
Copy link
Owner

BenB196 commented Sep 14, 2019

Hi vladc,

This issue will be fixed in v0.0.6. I have made it so that if you perform a batch query against the proxy. The proxy will first execute a regular batch query against IP-API. Then it will perform reverse lookups locally and merge the results together. Thank you for pointing out this difference.

@BenB196
Copy link
Owner

BenB196 commented Sep 14, 2019

Release v0.0.6 is now live, and this should be fixed.

@BenB196 BenB196 closed this as completed Sep 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants