Delphix Products

Expand all | Collapse all

Making api call to lock containers

Jump to Best Answer
  • 1.  Making api call to lock containers

    Posted 10-01-2020 01:07:00 PM

    ​Hi,

    I am trying to lock a container using api call. Unfortunately, I did not find any resource related to this. From what I was experimenting with, I found out the url for this is

    "http://$($global:delphix_server)/resources/json/delphix/jetstream/container/$($global:containerReference)/lock"

    Unfortunately, I am not exactly sure what to put in inside body of this request

    {
        "type""JSDataContainerLockParameters"
    }

    Would you please give me some guide on how to accomplish this task?
    I want to use the api call and not the self service


    ------------------------------
    Sina Rafiei
    Community Member
    Ontario Teachers' Pension Plan
    ------------------------------


  • 2.  RE: Making api call to lock containers
    Best Answer

    Posted 10-01-2020 03:03:00 PM
    1)  I encourage you in future to try these opearations through the CLI with tracing turned on.  It will really help you quickly figure out what you need to call and pass to the Web API.  The CLI actually wraps around the Web API, so by tracing it you can see exactly what you need to build Web API calls:

    setopt trace=true
    cd selfservice/container
    select <mycontainer>
    lock
    set lockUser=<myusername>
    commit

    In the response, you'll see the answer:

    === POST /resources/json/delphix/selfservice/container/JS_DATA_CONTAINER-1/lock ===
    {
        "type": "JSDataContainerLockParameters",
        "lockUser": "USER-11"
    }

    You can find your user reference in the CLI as well very easily:

    cd user
    select <myusername>
    ls

    and you'll see the reference.  You can also do this programatically with
    GET /resources/json/delphix/user

    and then parse the resulting array of users.



    2)  My Engine is IP 54.184.248.95

    You can do http://54.184.248.95/api to see the API docs to answer this and similar questions, although I definitely find the CLI tracing to be easier.

    Specific to your question, see:  http://54.184.248.95/api/#container.  Under the lock operation, it allows you to click through to this page http://54.184.248.95/api/#JSDataContainerLockParameters which explains that the lock parameter requires a type of JSDataContainerLockParameters and a parameter lockUser, and that lockUser is a reference to the user object who locks the container.







    ------------------------------
    Ranzo Taylor
    VP, Technical Services
    Delphix
    ------------------------------