Netflix API Forums

I Need Help!

RSS Feed

How add movie in queue

  1. I am a php developer. in my app I am trying to add new movie in my queue but can sucessful. Can anybody give me exact idea to add movie to my instant queue....I am waiting for reply....

    Message edited by vikas2931 1 year ago

  2. Jeff Dillon3 years ago

    Hi

    You might find this PHP library helpful.

    http://developer.netflix.com/forum/read/104903

    If you continue to have issues, please provide the request that you are sending and the specific error that you are receiving

    Sincerely,

    Jeff Dillon, Netflix API Support

  3. vikas29313 years ago

    Hi
    I am really thankful for your suggestion .But i just want to know how to add movie to my queue in my app? All things have done properly like retrieving all movies to my queue . but i dont know how to add a new movie to my queue and show updated queue . So please help me?

  4. Jeff Dillon3 years ago

    Hi,

    The link that I provided shows example code of adding a movie to a queue. Also, look at the topic Updating a Queue in our documentation here:

    http://developer.netflix.com/docs/REST_API_Reference

    Hope this helps.

    Jeff Dillon, Netflix API Support

  5. vikas29313 years ago

    thanks i want to know that how can i use POST Instead of GET?

  6. Jeff Dillon3 years ago

    Hi

    Did you get the sample code working? That would be your first step. It demonstrates how to use POST. You would use POST to do updates, and GET to read information.

    Jeff Dillon, Netflix API Support

  7. vikas29313 years ago

    We are trying to add movie in instant / dvd queue. We are using NetFlixlibrary .php . We have created netflex class and we are using curl for posting and below is the function….
    public function addMovie($userid,$movieID)
    { $path = "http://api.netflix.com/users/".$userid."/queues/instant/".$movieID; $title_ref = "http://api.netflix.com/catalog/titles/movies/".$movieID;
    $oauth = new OAuthSimple();
    $arguments = Array(
    oauth_token => $this->Access_token ,
    output=>'json',
    max_results=>'7'
    );
    $signed = $oauth->sign(Array(path=>$path,
    parameters=>$arguments,
    signatures=> Array('consumer_key'=>$this->Customer_key,
    'shared_secret'=>$this->Customer_secret ,
    'access_token'=>$this->Access_token ,
    'access_secret'=>$this->Access_token_secret
    ))); //oath signature that is used


    //Block For giving call to the REST netflex API
    $curl = curl_init();
    curl_setopt($curl,CURLOPT_URL,$signed['signed_url']);
    curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
    curl_setopt($curl,CURLOPT_SETTIMEOUT,2);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $title_ref);
    $buffer = curl_exec($curl);
    if (curl_errno($curl))
    {
    echo ("An error occurred:".curl_error());
    }

    //Block For giving call to the REST netflex API Ends
    $result = json_decode($buffer);
    return $result;
    } // addmovie

    We don’t know how to propery use POST verb. Please let us know what we are missing.

  8. Jeff Dillon3 years ago

    Hi,

    The code looks correct. Are you getting an error?

    Jeff Dillon, Netflix API Support

  9. Nicholas Clarkson3 years ago

    I see a couple of problems:
    $path should be "http://api.netflix.com/users/".$userid."/queues/instant" and not have $movieID appended to it
    $title_ref does not always start with "http://api.netflix.com/catalog/titles/movies/" you should just use the title_id given by the API
    Not familiar with the library you are using but you seem to be passing parameters in the URL and as POSTFIELDS. You can just send the request as a normal GET request and pass method=POST to get the API to treat the add correctly.

  10. vikas29313 years ago

    Hi Nickolas,

    Thanks for your quick response. I have done first two changes suggested by you.
    Now not sure how to use method=POST in my code, and how to pass the title id( $title_ref )

  11. vikas29313 years ago

    Hi Nicholas,

    I'm really lost in it. I'd appreciate if you please make the required changes in the code here and post back to me.

    Thanks
    Vikas

  12. Jeff Dillon3 years ago

    Hi,

    You don't have to use method=POST as you are already using the HTTP POST Verb:

    curl_setopt($curl, CURLOPT_POST, true);

    You mentioned you are already able to read the queue, so you should have the Title_ID

    When you run your code, do you get an error? That would help us to assist you.

    Jeff Dillon, Netflix API Support

  13. vikas29313 years ago

    when we use
    curl_setopt($curl, CURLOPT_POSTFIELDS, $title_ref);
    we get an error 401
    invalid signature.
    when we donot use then we dont get error . so let us know what changes should be made to add movie in above code......

  14. Nicholas Clarkson3 years ago

    I may be wrong on how OAuthSimple works but this is what I see: You are passing these as arguments to be included in the signature:
    oauth_token => $this->Access_token ,
    output=>'json',
    max_results=>'7'

    First, does oauth_token have to be supplied here? Second, you are not including title_ref here so it is not being included in the signature.

    Then with your postfields you only mention title_ref and not output or max_results. Again I am not sure on how OAuthSimple works but it seems title_ref should at least be added to your arguments array.

  15. vikas29313 years ago

    Hi Nicholas,
    I think we dont need oauth_token here because we are already passing token and other keys in $signed array and that is working fine for other functions.
    I'll remove oauth_token. I'll also remove curl_setopt($curl, CURLOPT_POSTFIELDS, $title_ref); line becasue it is giving error Invalid signature.

    In this case where to pass the $title_ref ?

  16. Nicholas Clarkson3 years ago

    Still working on getting a true POST to work, but this does work:
    #!/usr/bin/php
    <?php
    require 'OAuthSimple.php';
    $oauthObject = new OAuthSimple();
    $signatures = array( 'consumer_key' => KEY,
    'shared_secret' => SECRET,
    'oauth_token' => OTOKEN,
    'oauth_secret' => OSECRET);

    $result = $oauthObject->sign(array(
    'path' => 'http://api.netflix.com/users/USER_ID/queues/instant',
    'parameters'=> array(
    'title_ref' => 'http://api.netflix.com/catalog/titles/movies/60023366','method' => 'POST'),
    'signatures'=> $signatures));

    $fp = fopen('/home3/sporadi2/addTest.xml', 'w');
    $ch = curl_init();
    //curl_setopt($ch,CURLOPT_POST,count($fields));
    //curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $result['signed_url']);
    curl_setopt($ch, CURLOPT_ENCODING, "gzip");
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    curl_setopt($ch, CURLOPT_FILE, $fp);
    curl_exec($ch);
    curl_close ($ch);
    fclose($fp);
    ?>

  17. Nicholas Clarkson3 years ago

    Here is a true POST:
    #!/usr/bin/php
    <?php
    require 'OAuthSimple.php';
    $oauthObject = new OAuthSimple();
    $oauthObject->setAction('POST');
    $signatures = array( 'consumer_key' => KEY,
    'shared_secret' => SECRET,
    'oauth_token' => OTOKEN,
    'oauth_secret' => OSECRET);

    $result = $oauthObject->sign(array(
    'path' => 'http://api.netflix.com/users/BQAJAAEDEIZbuZUvAjJeLtSmNRe0WmggDsIfIY-CJEZ-ESi-NRsdToOBAUf2sV-XRvOozUrcj0g./queues/instant',
    'parameters'=> array(
    'title_ref' => 'http://api.netflix.com/catalog/titles/movies/973861'),
    'signatures'=> $signatures));
    $field = 'title_ref=http://api.netflix.com/catalog/titles/movies/973861';
    $fp = fopen('/home3/sporadi2/addTest.xml', 'w');
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch,CURLOPT_POSTFIELDS,$field);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch,CURLOPT_HTTPHEADER,array('Authorization: ' . $result['header']));
    curl_setopt($ch, CURLOPT_URL, 'http://api.netflix.com/users/BQAJAAEDEIZbuZUvAjJeLtSmNRe0WmggDsIfIY-CJEZ-ESi-NRsdToOBAUf2sV-XRvOozUrcj0g./queues/instant');
    curl_setopt($ch, CURLOPT_ENCODING, "gzip");
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    curl_setopt($ch, CURLOPT_FILE, $fp);
    curl_exec($ch);
    curl_close ($ch);
    fclose($fp);
    ?>

  18. vikas29313 years ago

    thanks Nicholas . its working fine now.we will let you know if there is any issue . thanks once again .

  19. vikas29313 years ago

    Hi Nicholas,
    I'm using php to display my dvd and instant queue movies. I have noticed that sometime the records does not display at all.
    Most of the times it works fine. I guess it is when server is slow or net connection is slow.

    Is there any solution to it.
    Please suggest because it may get away my users from my application.

    Thanks
    Vikas

  20. Jeff Dillon3 years ago

    Hi

    Please show the network trace when you have issues. A slow network connection would not cause what you are seeing. Do you get an error or a timeout?

    Jeff Dillon, Netflix API Support

  21. vikas29313 years ago

    Hi Jeff,

    I'm loading two <div> for dvd queue and instant queue respectively.
    I'm calling two different functions for it.

    sometimes what happens for example all the movies in dvd queue are displayed but instant queue area remains blank.
    It does not display any error.

    I have also noticed that in such case if i reload the browser, it works fine.
    Which network trance you want me to show you. Is it my apache server logs or some others

  22. sen2 years ago

    "We are not clothing line experts -- we believed that this distributor was genuine, but the gear may or may not be authentic," he said.air max was recently made aware "that the Egyptian Olympic Committee (EOC) chose a vendor for its athletes' training and village wear who is alleged to have supplied counterfeit footwear and apparel bearing the nike air max pas cher trademarks," Ryan Greenwood, head of corporate communications for Nike United Kingdom & Ireland, said in an emailed statement. When asked about Khallaf’s allegations, the Egyptian Olympic Committee’s secretary-general, Motaz Sonbol, said the committee was shocked to find out the gear was not "directly from airmax pas cher."Yomna Khallaf, a synchronized swimmer on the Egyptian team, said on Twitter that the workout bags she received have a "big Nike logo in the front and the zippers are Adidas.”A lot of the apps that matter to me seem to launch on the iOS platform first, coupled with an asterisk and a note that an Android version is ‘coming soon.’ Android users end up getting treated like second-class citizens.The fact that my new air max 90 pas cher sneakers work with my iPhone, but not my Android devices is the latest example of why the iPhone is still my primary mobile device. I like a lot of things about my Android devices, especially my unlocked Galaxy Nexus and Nexus 7 with Jelly Bean, but waiting around for apps to connect to products and services is getting old. http://www.airmaxnoo.com

  23. beffstaff jackets1 year ago

    We were the first to showcase the <a href="http://www.drdreno.com/"><strong>Beats By Dre</strong></a> kristin collection with you in August of 2009. Since then, the Kristin collection has turned into one of the most coveted and acclaimed lines by Beats. Back in October of last year, Vlad and I previewed <a href="http://www.drdreno.com/"><strong>Beats By Dr Dre</strong></a>’s Spring collection, in which the Kristins were well represented. For Spring 2011 the <a href="http://www.drdreno.com/"><strong>Monster Beats Norge</strong></a> takes center stage in their line yet again.<a href="http://www.drdreno.com/nye-beats-by-dre-c-86.html"><strong>Nye Beats By Dre</strong></a> still offers their Poppy collection for those that want the glitz and fun, their monogram bags for those that want to sport the brand’s recognized logo, but the Kristin collection fits into its own sleek and refined category that I absolutely appreciate and adore.It is the many options that make the Kristin Collection my <a href="http://www.drdreno.com/"><strong>Beats By Dre</strong></a> for this week.

[ Page 1 of 1 ]

New posts are not allowed