From f95e6e35059e42e49f92c8ac96b07c09470a5dcd Mon Sep 17 00:00:00 2001 From: Vincent Klaiber Date: Tue, 12 Jun 2018 09:07:13 +0200 Subject: [PATCH] Fixed API rate limiting error This closes #78 and #79 --- CHANGELOG.md | 4 ++++ README.md | 6 ++++++ composer.json | 2 +- src/Instagram.php | 4 ++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2a7ab1..3fe6dd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## 9.0.1 (released 2018-06-12) + +- Fixed API rate limiting error + ## 9.0.0 (released 2018-06-01) - Added user information endpoint diff --git a/README.md b/README.md index eb0c326..522602e 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,12 @@ $instagram->self(); > **Note:** You can only fetch a user's recent media from the given access token. +## Rate Limiting + +The Instagram allows you to call their API 200 times per hour. Try to cache the responses in your application. + +> _The Instagram API uses the same rate limiting as the Graph API (200 calls per user per hour) with one exception: the /media/comments edge limits writes to 60 writes per user per hour. Please refer to the Graph API's rate limiting documentation for more information_ - [Facebook](https://developers.facebook.com/docs/instagram-api/overview/#rate-limiting) + ## License [MIT](LICENSE) © [Vincent Klaiber](https://vinkla.com) diff --git a/composer.json b/composer.json index 331f806..35b170d 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ }, "extra": { "branch-alias": { - "dev-develop": "9.0-dev" + "dev-develop": "9.1-dev" } }, "minimum-stability": "dev", diff --git a/src/Instagram.php b/src/Instagram.php index 043199d..e811f94 100644 --- a/src/Instagram.php +++ b/src/Instagram.php @@ -111,6 +111,10 @@ protected function get(string $path): object $body = json_decode((string) $response->getBody()); + if (isset($body->error_message)) { + throw new InstagramException($body->error_message); + } + if (isset($body->meta->error_message)) { throw new InstagramException($body->meta->error_message); }