UNSOLVED

zulu1231

updated

15 years ago

Z

zulu1231

16 Posts

0

11540

June 16th, 2011 02:00

Atmos- RESTfUL API -C#.NET

Hi all,

     I  am new to atmos and trying to access it using REST API.

     Trying to create a .net application using the predefined  wrapper bindings to access atmos.

     Is there any document to start up things on how to create a client application using REST API?

     Please help! Thanks in advance.

  • rbala1

    1 Rookie

    •

    222 Posts

    855

    0

    Posted June 16th, 2011 07:00

    There is indeed a quick start guide for .NET located here:

    https://community.emc.com/docs/DOC-10404

    Raj

  • zulu1231

    16 Posts

    855

    0

    Posted June 17th, 2011 02:00

    Hey bala,

              Thanks for the reply. Actually we have a file system and need to copy the files from there  to Atmos.

            

              Atmos exposes REST API so we trying to create a tool which does the migration.

              Link which you have shared creates new object in the Atmos. But is there any other guide or document which helps to connect Atmos and do the copy operation.

              Also the tool should be a web application or it can also be a windows application??

             Please reply.  Thanks in adance.

  • rbala1

    1 Rookie

    •

    222 Posts

    853

    0

    Posted June 17th, 2011 08:00

    The example does indeed only depict interacting with Atmos.  Unfortunately, we don't have examples of all the possible ways in which data can be sourced to write to Atmos.

    The Atmos REST API can be accessed from any number of platforms whether web, desktop client, mobile, etc irrespective of operating system.  Our .NET wrapper will be limited to .NET compatible apps and development environments.

  • zulu1231

    16 Posts

    853

    0

    Posted June 19th, 2011 23:00

    Actually i have downloaded the .net wrapper bindings but i could not find any inbuild method to copy files. So i am assuming that after making the connection to ATmos do i have to use the microsoft .net System.IO.File.Copy( fileToCopy, newLocation ); to do the copy operation? is it the way to do this? Please help!!!

    Thanks in advance!!!

  • rbala1

    1 Rookie

    •

    222 Posts

    853

    0

    Posted June 20th, 2011 06:00

    That' won't work because the destination of the file copy operation is a file system.

    If you're using the UploadHelper class in the .NET Atmos wrapper you should read the file into a byte array and use that variable in either the CreateObject or CreateObjectOnPath method to actually create the object on Atmos.

    Raj

  • rbala1

    1 Rookie

    •

    222 Posts

    853

    0

    Posted June 20th, 2011 08:00

    Here's a complete example using C# that reads a file into a byte array and then uses that to create an object on Atmos:

    (You'll need to use your own uid, shared secret, host and port information)

    using System;
    using System.IO;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using EsuApiLib;

    namespace ConsoleApplication1

    {
        class Program
        {
            static void Main(string[] args)
           
         
            {
                string uid = "YOUR_UID";
                string sharedSecret = "YOUR_SECRET";
                string host = "YOUR_ATMOS_IP_OR_DNS";
                int port = YOUR_PORT;

                byte[] array = File.ReadAllBytes("C:\\file.jpg");

                EsuApiLib.Rest.EsuRestApi api = new EsuApiLib.Rest.EsuRestApi(host, port, uid, sharedSecret);

                ObjectPath path = new ObjectPath("/path/to/object.jpg");

                ObjectId oid = api.CreateObjectOnPath(path, null, null, array, null);
                           
                Console.WriteLine(oid);
               
            }
        }
    }

  • zulu1231

    16 Posts

    853

    0

    Posted June 20th, 2011 22:00

    Let me go back to basics. My understanding is like Atmos is also a FileStorage device(FileSystem). Is it right? if so why is that System.Io.file.Copy()is not possible? So for migrating files from existing file system to atmos  we need to use Uploadhelper or read the file as byte[] ? Existing system have many folders and sub folder where all files are kept. we need to migrate those including file attributes.!!!

    Let me be more specific. While accessing Atmos using our Client application UI we can make use of the uploadhelper file to copy files. But now we have a file system which has 1000s of folder and sub folder with many files. Now we are trying to create a utility to migrate those files to Atoms. i am working on the utility and for this scenario we need to migrate files using the uploadheader as you mentioned in the above code??If this is the case how to copy directories??Please help!!!!

  • rbala1

    1 Rookie

    •

    222 Posts

    853

    0

    Posted June 21st, 2011 06:00

    Hello,

    Atmos is an object storage platform that is best utilized through its RESTful web services API.  If you're using Atmos in your own datacenter then you may have access to the Atmos CIFS interface that will allow you to copy files and folders to it using standard copy operations that don't involve using the REST API.  This CIFS interface is not available from public cloud versions of Atmos including Atmos Online and our service provider partners.

    So there are two ways to read/write objects to Atmos:

    1.  Using the Atmos REST API

    • Requires using either the Atmos language bindings or using the HTTP REST interface directly

    2.  Using the Atmos CIFS/NFS interfaces

    • Only available in local, on-premise deployments of Atmos

    How do you plan on using Atmos after you copy files and folders to it?  How will users access content stored on Atmos?

    Raj

  • rbala1

    1 Rookie

    •

    222 Posts

    317

    0

    Posted June 21st, 2011 07:00

    You can use the same wrapper for both namespace and object interface methods, but you should focus on the methods that require an object of type ObjectPath argument if your intent is to use the namespace interface.

    You can determine which methods are namespace specific by the method name itself.  For instance you should use CreateObjectOnPath rather than CreateObject.  Both methods return an ObjectId, but CreateObjectOnPath interally utilizes the namespace interface.

    Other methods are generic and do not apply to a specific interface.  For example SetUserMetadata is not limited to either namespace or object, but rather it can be used with both.  Both interfaces support metadata, ACLs, shareableURLs, etc.

    The namespace interface is designed for applications that need file system semantics like directories, user-defined filenames, etc.  The object interface is designed for applications that simply need a unique identifier that is used to subsequently access the object later.

    The UploadHelper class is certainly where you should focus efforts in terms of integrating with Atmos for the purpose of migrating files and folders.

    Raj

  • zulu1231

    16 Posts

    853

    0

    Posted June 21st, 2011 07:00

    Hi Raj,

              Thanks for the reply. Actually at the end, users will access atmos using Atmos REST API. But for migrating the files and folders from the existing Filesystem we decided to create a tool which copies files to Atmos using REST. i am trying to create tool which uses the Atmos namspace API so that we will keep the folder structure and copy the files using uploadhelper method as u described in the sample code. So for atmos namespace API same wrapper c# bindings are used or different one...? actually what is the major difference between namespace api and object api.? using namespace api atmos will return object id rht?also is there any other way to migrate file (apart from uploadhelper method) using Rest API.??

    Please help !!!! Thanks in advance!!!