Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Instagram Real-Time API Callback URL Escaping [duplicate]

Tags:

curl

instagram

I'm using Instagram's Real-Time API to receive live updates when users post a picture. This was all set up and working perfectly. Randomly today it has decided not to work.

Debugging steps already taken:

  1. Client / Application is registered with Instagram
  2. Verify at least one user is already subscribed... I know this because when I verify the list I get this response (example.com substituted for actual domain).

    { "meta": {"code":200}, "data: [{ "object":"user", "object_id":null, "aspect":"media", "callback_url":"http:\/\/example.com\/common\/instagram\/subscriptions", "type":"subscription", "id":"4270301" }] }

  3. Create new application and start from scratch (same results)

Clearly, something weird is happening with the callback_url though. You can see the sample response does not have the backslashes. I also get the same situation when trying to subscribe a new user via curl, formatted exactly like Instagram's example. Instagram is trying to use "http:\/\/example.com\/common\/instagram\/subscriptions" and returns "Unable to reach callback URL".

I have read a bunch of other questions regarding the API, but no one seems to report anything like this. There have now been multiple other reports of similar issues (see Instagram API - Unable to reach callback URL, Node.js Instagram APISubscriptionError, etc.). At this point my only guess is that the problem is on Instagram's side, but hopefully me overlooking something or making a silly mistake.

Endless thanks to whoever can point me in the right direction. Cheers.

enter image description here

like image 547
ebuat3989 Avatar asked Apr 16 '26 10:04

ebuat3989


1 Answers

The callback url is fine. The extra \s you see are due to the way JSON encodes the / character. Check out the escape rules here: http://www.json.org/

The real problem is that Instagram's real-time subscriptions API seems to be having issues for the last couple days. See @DanShev's comment for the links.

In the mean time, I have a system in place to periodically look through my users' photos for photos that are of interest to me. My code (in Python) looks something like this:

from instagram import client
users = InstagramUser.objects.all()
for user in users:
    api = client.InstagramAPI(access_token=user.access_token)
    user_media, paginate_url = api.user_recent_media(user_id=user.instagram_user_id)
    for media in user_media:
        # Check if this is a media we've already gotten via subscription update
        # Do somethign with the media
like image 184
johnboiles Avatar answered Apr 19 '26 19:04

johnboiles



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!