GetOptimalUrls, repeat calls with different ip restrictions possible?

Last post 04-05-2008 2:30 AM by BarryR. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 04-04-2008 10:49 PM

    GetOptimalUrls, repeat calls with different ip restrictions possible?

    Hello,

     

    I tried a search but didn't find this particular question answered.  I know you can restrict the download of shared files to a single ip for a limited amount of time.  My question is if I were to make repeated calls to this function for the same file and use different IP's and overlapping time limit restrictions, would they all be honored?  Or would each successive call of GetOptimalUrls for the file replace the previous one?


    Filed under:
  • 04-04-2008 11:20 PM In reply to

    Re: GetOptimalUrls, repeat calls with different ip restrictions possible?

    I just tried it myself and answered my own question.  Each call is given a distinct Download Token  for the ip/time limit restrictions so each successive call generates it's own Download Token that has the attributes you give it.

     

    Also I'm using the Perl sample code from here and it was missing GetOptimalUrls from REST::IMFS.pm so I added it.

     

    sub GetOptimalUrls {
        ###########Parameters for the Method call###################
        my ($sessionToken,$filePath,$expiration,$consumerIP,$ipRestricted,$expected)=@_;
        ###########Variables handling XML parsing###################
        my ($twig,$root);
        ###########Variables handling to Get Upload Node##############
        my ($url,$req,$res,$result);

        $url='https://services.nirvanix.com/ws/IMFS/GetOptimalUrls.ashx';

        $req=LWP::UserAgent->new();

        $res=$req->post($url,[sessionToken=>$sessionToken,
            filePath=>$filePath,
            expiration=>$expiration,
            consumerIP=>$consumerIP,
            ipRestricted=>$ipRestricted]);

        if ($res->is_success) {
            print $res->content;
            $twig=XML::Twig->new();
            $twig->parse($res->content);
            $root=$twig->root;

            if($root->first_child_text('ResponseCode')==$expected){
               print "GetOptimalUrls passed";
               $result=1;
            }
            else{
                print "GetOptimalUrls Failed";
            }
         }
         print $res->content;
         return $result;
    }
    ###############  End Of GetOptimalUrls ##########################

     

     

     

    Filed under:
  • 04-05-2008 2:30 AM In reply to

    • BarryR
    • Top 10 Contributor
    • Joined on 07-20-2007
    • San Diego
    • Posts 630

    Re: GetOptimalUrls, repeat calls with different ip restrictions possible?

     Thanks for the Perl update, let us know if you have any more questions.

    Regards,
         Barry R.

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
Page 1 of 1 (3 items)