NationalMuseumAustralia / Collection-API

The public web API of the National Museum of Australia
10 stars 0 forks source link

Basic API usage without a key #35

Closed staplegun closed 5 years ago

staplegun commented 6 years ago

API keys are issued to help manage the stability of the platform under heavy usage. However this is a major barrier to people just wanting to quickly try out the API. So basic usage should be possible without needing an API key, e.g. usage throttled to 1 call per second per IP address.

Conal-Tuohy commented 6 years ago

done in c21b3d320318ff3c429f95809c47aea48369d2a1

If the client does not present an API key, they are automatically authenticated as a user called anonymous, which is throttled to 1 request per second (over an hour), but allowed to burst up to 10 requests per second.

Conal-Tuohy commented 6 years ago

I tested it with a script that made 15 parallel calls, and it retrieved 10 results and 5 error messages saying that it was over the rate limit.

curl http://nma-dev.conaltuohy.com/object/167766# > 1.json &
curl http://nma-dev.conaltuohy.com/object/167766# > 2.json &
curl http://nma-dev.conaltuohy.com/object/167766# > 3.json &
curl http://nma-dev.conaltuohy.com/object/167766# > 4.json &
curl http://nma-dev.conaltuohy.com/object/167766# > 5.json &
curl http://nma-dev.conaltuohy.com/object/167766# > 6.json &
curl http://nma-dev.conaltuohy.com/object/167766# > 7.json &
curl http://nma-dev.conaltuohy.com/object/167766# > 8.json &
curl http://nma-dev.conaltuohy.com/object/167766# > 9.json &
curl http://nma-dev.conaltuohy.com/object/167766# > 10.json &
curl http://nma-dev.conaltuohy.com/object/167766# > 11.json &
curl http://nma-dev.conaltuohy.com/object/167766# > 12.json &
curl http://nma-dev.conaltuohy.com/object/167766# > 13.json &
curl http://nma-dev.conaltuohy.com/object/167766# > 14.json &
curl http://nma-dev.conaltuohy.com/object/167766# > 15.json &