最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Find out whether a user has a public or private profile on instagram using API? - Stack Overflow

programmeradmin5浏览0评论

I've done a fair bit of searching on the Instagram API docs and can't find a way to determine whether or not a user has a public or protected profile?

This also has to be done without an access_token. I have a client_id to use.

Just for a bit of context, I'm just building a small practice app which reads a csv of usernames in PHP and then makes a call to the API to determine whether it is public or private.

I've done a fair bit of searching on the Instagram API docs and can't find a way to determine whether or not a user has a public or protected profile?

This also has to be done without an access_token. I have a client_id to use.

Just for a bit of context, I'm just building a small practice app which reads a csv of usernames in PHP and then makes a call to the API to determine whether it is public or private.

Share Improve this question asked Jan 13, 2014 at 21:24 jonnyhocksjonnyhocks 1311 gold badge3 silver badges9 bronze badges 1
  • 1 Updated information here: Instagram Basic Display API: How to check if user's Instagram account is public or private? – showdev Commented Nov 17, 2020 at 18:51
Add a comment  | 

2 Answers 2

Reset to default 13

Use the GET relationship endpoint.

https://api.instagram.com/v1/users/user-id/relationship

This endpoint returns a BOOL value "target_user_is_private".

You can use the User Media endpoint with client_id:

https://api.instagram.com/v1/users/USER_ID/media/recent/?client_id=YOUR-CLIENT_ID

If the user is private you will get a response like this:

{"meta":{"error_type":"APINotAllowedError","code":400,"error_message":"you cannot view this resource"}}

If the user is public, then you will get API response with "code":200 with user recent media data - "data":[...]

发布评论

评论列表(0)

  1. 暂无评论