简体   繁体   中英

instagram api ruby subscription tag post access object_id

the problem that i have is that when i post a picture on Instagram with the good hastag# of my subscription, i receive the notification in my callback but i can't access the object_id in the params. Here is the line that i receive :

Parameters: {"_json"=>[{"changed_aspect"=>"media", "object"=>"tag", "object_id"=>"mytag", "time"=>1439341303, "subscription_id"=>19499294, "data"=>{}}], "subscription"=>{}}

Here's my ruby code :

def process_subscription

    if params["hub.challenge"]
        render :text => params["hub.challenge"]
    else
        @test_tag_name =  params["object_id"]
    end

end

But the @test_tag_name is always to null. Thank you very much

For those exact params, this would work: params["_json"][0]["object_id"]

But you'll probably need to adjust based on what params["_json"] will return in the general case (I'm not familiar with that API). For example, you should probably iterate over the array it returns rather than grabbing the first element.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM