Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iTunes search JSON API returning 403 forbidden on server [closed]

For the six weeks or so, we have been able to execute queries against the iTunes search JSON API without issue. Starting this week, we started to see 403 errors after a certain number of requests (about 1K - 2K). We're assuming this is a rate-limiting issue, perhaps a new policy they implemented. Is there another explanation we're overlooking?

like image 841
Crashalot Avatar asked Jun 06 '13 08:06

Crashalot


2 Answers

As you are looking to get price and ratings my guess is that you are doing a lookup, not a search, with the iTunes Search API.

If that assumption is true then you can "batch" lookup requests by listing multiple ADAM IDs in a query by separating them with a comma.

eg. To get results for both of these apps in the US --

https://itunes.apple.com/us/app/9-innings-2013-pro-baseball/id530061728?mt=8

https://itunes.apple.com/us/app/homerun-battle-2-free/id491221570?mt=8

-- you'd do this: https://itunes.apple.com/us/lookup?id=491221570,530061728

I believe the limit is 50 ids per query.

If there are approximately 900K apps currently live in the App Store, some quick math shows that before batching, if you evenly spread out your requests you'd be doing ~625 queries / minute. (900K / 24 hours / 60 minutes == 625)

However, if you batch them in groups of 50 then you are looking at about 13 queries / minute (900K / 50 per request / 24 hours / 60 minutes == 12.5). This should be well within the allowed limit.

...@Crashalot - if you are doing app recommendations, then we should talk.

like image 140
Geniuslink Avatar answered Jan 04 '23 03:01

Geniuslink


I don't believe there's any published rate limits, but I think it's pretty safe to assume they do exist. What's the timescale for the 1-2k of requests you're running - minutes, hours, days?

Apple do recommend you implement caching to prevent needless queries. If you're not doing this already then you should probably look into it. Another option is to use the enterprise partner feed, although you need to be an iTunes affiliate to gain access.

like image 32
lxt Avatar answered Jan 04 '23 04:01

lxt