Delphix Products

 View Only
  • 1.  Restore bookmark using API

    Posted 07-25-2022 12:27:00 PM
    Edited by c Ng 07-25-2022 12:30:16 PM
    #api #restore #bookmarks #containers
    This is what I am trying to achieve using Delphix API
    1. create session
    2. login
    3. get list of containers
    4. get list of bookmarks in a specific container from step 3
    5. restore to a selected bookmark from step 4

    I am able to achieve 1,2,3
    but 4,5 are having issues

    For step 3 I am using

    curl -s -X GET -k "${DLFXURL}"/selfservice/container -b ${DLFXCOOKIE} -H "${DLFXCONTENT_TYPE}"

    This is the response:

    {"type":"ListResult","status":"OK","result":[{"type":"JSDataContainer","reference":"JS_DATA_CONTAINER-1","namespace":null,"name":"FDATA DW/OLTP TEST1","notes":null,"properties":{},"activeBranch":"JS_BRANCH-1","lastUpdated":"2022-06-08T19:25:26.542Z","firstOperation":"JS_OPERATION-150","lastOperation":"JS_OPERATION-393","template":"JS_DATA_TEMPLATE-3","state":"ONLINE","operationCount":11,"owner":"USER-138"},{"type":"JSDataContainer","reference":"JS_DATA_CONTAINER-2","namespace":null,"name":"DATA DW/OLTP TEST2","notes":null,"properties":{},"activeBranch":"JS_BRANCH-2","lastUpdated":"2022-06-14T15:34:34.456Z","firstOperation":"JS_OPERATION-19","lastOperation":"JS_OPERATION-396","template":"JS_DATA_TEMPLATE-3","state":"ONLINE","operationCount":80,"owner":"USER-12"}],"job":null,"action":null,"total":2,"overflow":false}

    How can get the list of all the bookmarks from  DATA_CONTAINER-1 using api?
    I am trying this API call below but returns empty
    curl -s -X GET -k "${DLFXURL}"/jetstream/bookmark/JS_DATA_CONTAINER-1 -b ~/cookies.txt -H "Content-Type: application/json"

    But getting error in the response:
    {"type":"ErrorResult","status":"ERROR","error":{"type":"APIError","details":"The reference \"JS_DATA_CONTAINER-1\" is invalid or of the incorrect type.","action":"Check the source of the reference and the documentation

    Any suggestion to get the list of bookmarks and the command to restore to a bookmarks? 


    ------------------------------
    c Ng
    Community Member
    ------------------------------


  • 2.  RE: Restore bookmark using API

    Posted 07-26-2022 01:45:00 PM
    Edited by Vijayender Singidi 07-26-2022 01:51:52 PM

    try this , as you  know Delphix API works with references of the objects 

    1. create session
    2. login
    3. get list of containers
    4. get the list of bookmarks references for specific container from step 3

    curl -s -X GET -b ${DLFXCOOKIE} --header 'Content-Type: application/json' -k "http:<engine name>/resources/json/delphix/selfservice/bookmark"

    1. restore to a selected bookmark from step 4

    curl -s -X POST -b ${DLFXCOOKIE} --header 'Content-Type: application/json' -k "http:<engine name>/resources/json/delphix/selfservice/container/<container_reference >/restore" -d "{

        "\" type "\": "\" JSDataContainerRestoreParameters "\",

        "\" timelinePointParameters "\": {

            "\" type "\": "\" JSTimelinePointBookmarkInput "\",

            "\" bookmark "\": "\"<bookmark_reference >"\"

        },

        "\" forceOption "\": false

    }"



    ------------------------------



  • 3.  RE: Restore bookmark using API

    Posted 07-26-2022 02:10:00 PM
    Thanks. 
    Yes I am using below to get the bookmarks.

    bmrk=$(curl -s -X GET -k "${DLFXURL}"/jetstream/bookmark -b ${DLFXCOOKIE} -H "${DLFXCONTENT_TYPE}")

    BTW is there a way to check if the self container is currently running a restore/ or any other services so as to avoid conflicts if the restore script is triggered by two different users?
    Thanks.

    ------------------------------
    c Ng
    Community Member
    HealthEdge Software, Inc.
    ------------------------------



  • 4.  RE: Restore bookmark using API

    Posted 07-26-2022 02:16:00 PM
    Edited by Vijayender Singidi 07-26-2022 02:16:39 PM

    you  have to check aby jobs running for that container.

    $(curl -s -X GET -k "${DLFXURL}"/job -b ${DLFXCOOKIE} -H "${DLFXCONTENT_TYPE}")



    ------------------------------

    ------------------------------