Sharing Namespace PHP API Class / Full PHP API Class

Last post 11-15-2007 11:29 PM by BarryR. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 11-14-2007 1:46 PM

    Sharing Namespace PHP API Class / Full PHP API Class

    Hello,

    I was wondering if there is an existing Sharing Namespace php api class? If not - are you planning to provide one? Or is there a full API class, providing all namespaces methods?

    I took a look at IMFS.php from the PHP File Manager, but it is not a complete API class, it lacks, for example, createHostedItem.

    Stan
     

    Filed under: , ,
  • 11-14-2007 3:18 PM In reply to

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

    Re: Sharing Namespace PHP API Class / Full PHP API Class

    Yes, one of our goals is to provide a sample application for handling files, child accounts, and media.  While these real world examples do not cover everything, there is a secondary goal of producing an SDK for each language.  In the File System Manager you are seeing the birth of this SDK in parts.  This will be expanded to all of the namespaces and released as a seperate package.  I hope the examples we have created so far are enough that you can modify them to use the other namespaces.  If there is a particular method you need wrapped for PHP let me know and I will be happy to put a sample together before the SDK is available.

    Best regards,
        Barry R.
     

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
    Filed under: , ,
  • 11-14-2007 3:25 PM In reply to

    Re: Sharing Namespace PHP API Class / Full PHP API Class

    Hello Barry,

    Thanks for the quick reply. Sharing namespace methods wrapped in PHP will be extremely useful, since for me (and probably for others) the primary use for Nirvanix would be content serving, so most content needs to be shared with the CreateHostedItem method (at least as far as I have understood).

    A complete SDK will also be a blessing, do you have a time frame for that?

    Regards,

    Stan

     

  • 11-15-2007 11:29 PM In reply to

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

    Re: Sharing Namespace PHP API Class / Full PHP API Class

    Because of the sheer number of requests I cannot give a time frame for the SDK but PHP in general is very high on the list of priorities.  Below I have put together a sample CreateHostedItem call using the same framework as the PHP File manager.  Feel free to contribute if you create any classes you think others would be willing to use.


    require_once "RestUtils.php";
    require_once "xml2array.php";

    class Sharing
    {
        //Creates a hosted folder or file in your account for public download.
        function CreateHostedItem($sessionToken, $sharePath)
        {
            $DEBUG = true;
            $SHARINGHOST = "http://services.nirvanix.com";
           
            // Set the parameters
            $params = 'sessionToken=' . $sessionToken . '&';
            $params = $params . 'sharePath=' . $sharePath . '&';
           
           
            // retrieve from the REST interface the response xml.
            $xmlstring = curlPost($SHARINGHOST . '/ws/Sharing/CreateHostedItem.ashx', $params);
           
            if ($DEBUG)
            {
                print '<!--CreateHostedItem: ';
                print_r($xmlstring);
                print '-->';
            }
           
            // turn into an object for easier handling.
            $objXML = new xml2Array();
            $arrOutput = $objXML->parse($xmlstring);

            $xml = $arrOutput[0]["children"];
           
            return $xml;
        }

     

    This requires the two rest utilities i use for parsing the XML and making the rest request that are included in the PHP File Manager download.

    Regards,
         Barry R.

    IM Support (Feel free to add me)

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