Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Instagram comments API can't add 'text' value

Tags:

ios

instagram

My requested URL is https://api.instagram.com/v1/media/MYMEDIA_ID/comments?access_token=MYTOKEN&text=MYTEXT

I get a reply like this:

{
    meta =     {
        code = 400;
        "error_message" = "Missing 'text'";
        "error_type" = APIInvalidParametersError;
    };
}

In the Instagram document it says the comment API takes two parameters: text and access_token. I have provided both, and I get the error saying text is missing.

I have tried with different symbols instead of & but nothing works. Does anybody have experience on how the text parameter should appear on the requested URL?

Thanks a lot !

like image 821
Suraj Pathak Avatar asked Nov 05 '22 05:11

Suraj Pathak


1 Answers

i am using hybridauth, and here is the code, it is working..

function setUserComment($post_id, $message)
{
    $flag = 0;  
    $parameters = array("text" => $message);
    $response  = $this->api->post( "media/$post_id/comments", $parameters );    

    // check the last HTTP status code returned
    if ( $this->api->http_code != 200 ){
        throw new Exception( "Comment failed! {$this->providerId} returned an error. " . $this->errorMessageByStatus( $this->api->http_code ) );
    }
    else{
        $flag = 1;
    }
    return $flag;
}
like image 166
Animesh Nandi Avatar answered Nov 14 '22 23:11

Animesh Nandi