Latest post Sun, Sep 13 2020 9:38 AM by rens van der Zwan. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • Sun, Jun 28 2020 9:52 PM

    • jamieparry
    • Not Ranked
    • Joined on Wed, Jan 20 2010
    • Posts 4
    • Points 70

    reading available nexis workspaces

    very basic request here

    i want to make a commandline tool in python that just lists all our current nexis workspaces

    what would be the api call to do that please?

    i tried to follow the guidelines in the docs but didn't get very far i'm afraid.

    I'm used to making api calls on the baselight and from web services (that i've written in flask) but so far i haven't fully "got" what i need to do with nexis (ie what users are allowed to do what etc etc)

    all i want is a list though so surely i don't need massive root rights for just that?

    i have access through the nexis client manager so i know i can list things that way but, y'know..workflow yadda yadda..

    :-)

    any guidance would be very much appreciated. thankyou

    jamie

  • Mon, Aug 3 2020 2:03 PM In reply to

    Re: reading available nexis workspaces

    Not sure about Python, but this is what you need to do:

     

    The Nexis API is a REST service. First you need to use a login call to https://<nexis-host>/api/login . This gives you a token. With the token you can call https://<nexis-host>/api/workspaces. This gives you a list of all the workspaces and a large list of metadata to choose from.

    You might want to start with a tool like Postman. Its a direct way of testing the Nexis API. 

    I am fairly certain you need a administrator account to make a succesfull call to workspaces. You get a "Unable to complete operation. Protected." response if not.

    Example of the response (with only two workpace):

    {

        "workspace": [

            {

                "outID": "18968575579267",

                "ioName": "Workspace Name 1",

                "ioDescription": "",

                "outStorageGroupName": "storage group1",

                "ioStorageGroupID": "65537",

                "outSubGroupName": "Default",

                "ioSubGroupID": "0",

                "ioByteCount": "4000000000000",

                "outDeletePending": "0",

                "outUsedByteCount": "1793450558984",

                "outPercentUsed": "4483",

                "outPercentUsedString": "44.83%",

                "outReservedByteCount": "4000000000000",

                "outAvailableByteCount": "2206549441016",

                "outAllocatedByteCount": "2261255192576",

                "outFileCount": "19581",

                "outDirectoryCount": "89",

                "outDirInfoControls": "0",

                "outStatusString": "",

                "outConfigChanges": "5",

                "outStatus": "0",

                "outMinimumByteCount": "1793450558984",

                "outMaximumByteCount": "310784491381760",

                "outCnfgChunkSizePO2": "22",

                "ioProtectionMode": "1",

                "ioProtectionModeLocal": "4",

                "outSupportedProtectionMode": "1",

                "outPerformance": "1"

            },

            {

                "outID": "19241453456208",

                "ioName": "Workspace Name 2",

                "ioDescription": "",

                "outStorageGroupName": "storage group1",

                "ioStorageGroupID": "65537",

                "outSubGroupName": "Default",

                "ioSubGroupID": "0",

                "ioByteCount": "19000000000000",

                "outDeletePending": "0",

                "outUsedByteCount": "9851224613557",

                "outPercentUsed": "5184",

                "outPercentUsedString": "51.84%",

                "outReservedByteCount": "19000000000000",

                "outAvailableByteCount": "9148775386443",

                "outAllocatedByteCount": "12343723425792",

                "outFileCount": "27307",

                "outDirectoryCount": "303",

                "outDirInfoControls": "0",

                "outStatusString": "",

                "outConfigChanges": "5",

                "outStatus": "0",

                "outMinimumByteCount": "9851224613557",

                "outMaximumByteCount": "325784491381760",

                "outCnfgChunkSizePO2": "22",

                "ioProtectionMode": "1",

                "ioProtectionModeLocal": "4",

                "outSupportedProtectionMode": "1",

                "outPerformance": "1"

            }

    ]

    }

  • Sat, Sep 12 2020 11:51 PM In reply to

    Re: reading available nexis workspaces

    Hello rens van der Zwan I am trying to do exactly this but my Postman knowledge is a bit lacking. I am able to do the API call to login and get the token response in JSON format. However I do not know how to then use this to get the list of workspaces. How do I use postman to then do the second part of getting the JSON list of workspaces as you have shown here? 

    I also want to the do this via javascript (XMLHttpRequest) however I cant even do the login part with this as I get a CORS error about not having "Access-Control-Allow-Origin" in the headers. Any help on this would be much appreciated too.

    Regards,

    Murray

  • Sun, Sep 13 2020 9:38 AM In reply to

    Re: reading available nexis workspaces

    Hi, Murray

    The Nexis API uses tokens. The basic idea is to login once with the Admin credentials you also use for administering the system.

    This login gives you a "token" response. In this token is a field called "value". You need to use the value of this field for any other api call.

    Usually a token is valid for a limited period so you need to take in account if you receive a "400" error saying "Your session is no longer valid, please log in again." you need to get a new token by login in again. There is also a https://NexisVirtualHostName/api/checksession endpoint where you can test the validity of the session.

    If your Nexis has an invalid or expired certificate you could swith off the 'ssl certificate verification' in Postman's 'General' settings. Not a best practice btw.

    I have included a Postman collection which you can import into you own local Posman install. You need to provide the Nexis virtual hostname and credentials of you own system. I have only included login,logout and Workspaces API call. Have also included a pdf with the specifics of the calls. (Had to zip the documents as the forum only accepts certain file formats)

    Hope this gets you going.

     

    I have very limited experience with Javascript so i can't realy help in this area i am afraid. 

     

Page 1 of 1 (4 items)

© Copyright 2011 Avid Technology, Inc.  Terms of Use |  Privacy Policy |  Site Map |  Find a Reseller