I am integrating the instagram API with ruby gem "Instagram". I have written a piece of code to create an subscription My code is as following.'
token = InstagramToken.find_by_id(params[:id])
client = Instagram::Client.new(:client_id => client_id, :client_secret => client_secret, :access_token => access_token)
client.create_subscription("user", "callback_url" => "http://localhost:300/platforms/instagram/subscribed", "object_id" => params[:profile_id])
The above code giving me an error.
POST https://api.instagram.com/v1/subscriptions.json: 500: Something is technically wrong.
Is something wrong with my code or something wild is happening from the instagram side.
FWIW I get this from time to time. It always goes away eventually, so I don't think it's a code issue.
@bergonom how long is eventually for you? I've just now seen this error for the first time whilst trying to list my subscriptions.
The error usually goes away nearly instantaneously for me. I put in a begin/rescue block to catch the error, then retry after a second delay. The error almost always disappears on that second try.
I wish I knew the true reason why the error is thrown but it just seems sort of random.
Quick summary of HTTP status codes:
This gem has the responsibility of forming a good request and processing the result, so a 5XX error is outside the scope of what a bug report on this gem can solve.