Get Upload Node for HTTP Post

Last post 11-16-2007 8:26 PM by BarryR. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 11-16-2007 7:09 PM

    Get Upload Node for HTTP Post

    What are the steps to obtain an upload node token to perform and HTTP Post upload using the Ruby Gem?

     Thanks.

     

    Chad Nantais
    http://chadnantais.com
  • 11-16-2007 8:26 PM In reply to

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

    Re: Get Upload Node for HTTP Post

    Currently the Ruby Gem uses Soap to upload files using the AppendFile method and does not have HTTP uploads implemented yet.  If you wish to use this method you can do the following:



    session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)

    SoapUpload.UploadFile('remote_file', 'local_file', session.account_login)



    The file will automatically be sent in 64k chunks to the server.  If you want to just call GetUploadNode you can modify the session object to have a GetUploadNode call.  I will add this as a method later.



    result = Transport.execute_command_post(APICommand.GetUploadNode, [APIParam.new("sizeBytes", "1000")], account_login)

    upload_token = result.root.elements["//AccessToken"].get_text.value
    node = result.root.elements["//IPAddress"].get_text.value



    If you want to look at the code you can find it in use in the SoapTransfer object.  or you can check the rubydoc which also has the source code included.

    Let me know if you have any further questions about uploads or If you need help getting the Upload node.  The use of GetStorageNode is preferred but to simplify the code i have included code that already exists within the Gem.

    Best,
        Barry R.

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
    Filed under: , , , ,
Page 1 of 1 (2 items)