はじめに
InstagramのAPIを使用していると、
様々なエラーが返ってくるのでここにその内容をまとめておきます。
ちなみにエラーで返ってくるJSONは整形してます。
ユーザー系
対象PATH: https://api.instagram.com/v1/users/{user-id}/?access_token=ACCESS-TOKEN
ドキュメント: https://www.instagram.com/developer/endpoints/users/#get_users
対象ユーザーの情報を使用したアクセストークンで参照できない時のエラー
JSON
{
"meta": {
"code": 400,
"error_type": "APINotAllowedError",
"error_message": "you cannot view this resource"
}
}
対象ユーザーが既に存在しない場合のエラー
JSON
{
"meta": {
"code": 400,
"error_type": "APINotFoundError",
"error_message": "this user does not exist"
}
}
タグ系
対象PATH: https://api.instagram.com/v1/tags/{tag-name}?access_token=ACCESS-TOKEN
ドキュメント: https://www.instagram.com/developer/endpoints/tags/#get_tags_response
検索できないハッシュタグを叩こうとしたときに返ってくるエラー
- logodesign
- lolita
- footfetish
- like
- hentai
- booty
- thighs
- sexi
- seduction
- girlsofinstagram
- popular
など(2017/10/05)
JSON
{
"meta": {
"code": 400,
"error_type": "APINotAllowedError",
"error_message": "This tag cannot be viewed"
}
}
ちなみにこれらのタグはInstagramで検索しようとしてもエラーになる。
検索できないハッシュタグについて
下記の記事におそらくタグが検索できないのは下記の理由からではないかという内容のものがあったので引用します。
Instagram is pretty strict when it comes to "violent, nude, partially nude, discriminatory, unlawful, infringing, hateful, pornographic or sexually suggestive" posts and is fairly clear in its Community Guidelines about what's right and what's not right.
Instagramは、「暴力的、ヌード、部分的にヌード、差別的、違法、侵害的、憎悪、嫌悪感、性的嗜好性」の投稿についてはかなり厳しい
“We’ve stopped serving feeds (both in app and API) for some tags that were too generic and didn’t provide enough end-user value.”
「タグがあまりにも一般的でエンドユーザーの価値が十分でないタグについては、フィードの配信を停止しました(アプリとAPIの両方)。
ちなみにここで禁止されてるタグをおおよそ把握できるそうです。
共通系
1時間あたりの使用制限を超えたときに返ってくるエラー
JSON
{
"error_type": "OAuthRateLimitException",
"code": 429,
"error_message": "You have exceeded the maximum number of requests per hour. You have performed a total of 5058 requests in the last hour. Our general maximum limit is set at 5000 requests per hour."
}
トークンが無効なときに返ってくるエラー
JSON
{
"meta": {
"code": 400,
"error_type": "OAuthAccessTokenException",
"error_message": "The access_token provided is invalid."
}
}
アプリがバンされたときに返ってくるエラー
JSON
{
"error_type": "OAuthException",
"code": 400,
"error_message": "Client Disabled"
}