Delphix Products

Expand all | Collapse all

Restore API not working

Jump to Best Answer
  • 1.  Restore API not working

    Posted 03-14-2020 01:59:00 AM
    Hi ,

    I am trying to restore a container with a bookmark using the rest API call. But I am getting the following error message from the API

    Request :

    {
    "type":"JSDataContainerRestoreParameters",
    "timelinePointParameters":{
    "type":"JSTimelinePointBookmarkInput",
    "bookmark":"JS_BOOKMARK-352"
    },
    "forceOption":false
    }


    Response :

    {"type":"ErrorResult","status":"ERROR","error":{"type":"APIError","details":"Invalid object type \"JSDataContainerRestoreParameters\".","action":"Provide the correct object and try again.","id":"exception.schema.api.object.type.invalid.abstract","commandOutput":null}}


    Please help

    ------------------------------
    Arjun Jayan
    QA Lead
    TATA Consultancy Services Ltd
    ------------------------------


  • 2.  RE: Restore API not working

    Posted 03-14-2020 10:02:00 AM
    Hello Arjun-

    Can you let us know the version of Delphix where you are attempting this operation, and what type of user you have authenticated with? At a glance, the details of the API request look fine to me... has this worked for you in the past?  Is this being sent to the correct API endpoint? (/resources/json/delphix/selfservice/container/CONTAINER_ID/restore)?

    The same parameters in my own test work as expected:
    % curl -s -X POST -k --data @- http://mylabengine.delphix.com/resources/json/delphix/selfservice/container/JS_DATA_CONTAINER-2/restore \
     -b ~/cookies.txt -c ~/cookies.txt -H "Content-Type: application/json" <<EOF
     {
        "type": "JSDataContainerRestoreParameters",
        "timelinePointParameters": {
            "type": "JSTimelinePointBookmarkInput",
            "bookmark": "JS_BOOKMARK-2"
        },
        "forceOption": false
    }
    EOF
    {"type":"OKResult","status":"OK","result":"","job":"JOB-135","action":"ACTION-301"}% ​

    And so far I've been unable to find an incorrect detail in the parameters provided.



    ------------------------------
    Sean Nothdurft
    Senior Member Technical Staff
    Delphix
    ------------------------------



  • 3.  RE: Restore API not working

    Posted 03-14-2020 10:58:00 AM
    Hi Sean,

    I am using delphix version 5.2.2.1

    I am authenticated as a self-service user 

    url : http://dbaas/resources/json/delphix/jetstream/container/JS_DATA_CONTAINER-71/restore

    I tried with the endpoint you mentioned ,but I am getting 404 error

    I am able to do operations like refresh,reset via API request . But restore is not working

    I am able to do the same operation via the Delphix self-service interface using the same user




    ------------------------------
    Arjun Jayan
    QA Lead
    TATA Consultancy Services Ltd
    ------------------------------



  • 4.  RE: Restore API not working
    Best Answer

    Posted 03-14-2020 11:59:00 AM
    Hi Arjun-

    Thanks for the extra information. In that case using 5.2.2.1, the endpoint I used wouldn't be valid as my original test was completed on a current version where the naming convention has changed. Duplicating the test on a 5.2.2.1 Engine I still see no functional issue, but without reviewing your entire workflow with all preceding CURL operations it's difficult to triage further.

    I create a session, with APIVersion set to 1.9.0, the highest version available for 5.2.2.1 (https://docs.delphix.com/docs52/reference/web-service-api-guide/api-version-information):
    % curl -s -X POST -k --data @- http://sean5221.dc4.delphix.com/resources/json/delphix/session \
       -c ~/cookies.txt -H "Content-Type: application/json" <<EOF
    {
       "type": "APISession",
       "version": {
           "type": "APIVersion",
           "major": 1,
           "minor": 9,
           "micro": 0
       }
    }
    EOF
    {
       "status":"OK",
       "result": {
           "type":"APISession",
           "version": {
               "type": "APIVersion",
               "major": 1,
               "minor": 9,
               "micro": 0
           },
           "locale": "en_US",
           "client": null
       },
       "job": null
    }
    EOF
    {"type":"OKResult","status":"OK","result":{"type":"APISession","version":{"type":"APIVersion","major":1,"minor":9,"micro":0},"locale":null,"client":null},"job":null,"action":null}​
    I then login (in this case also as a self-service user)
    % curl -s -X POST -k --data @- http://sean5221.dc4.delphix.com/resources/json/delphix/login \
       -b ~/cookies.txt -c ~/cookies.txt -H "Content-Type: application/json" <<EOF
    {
       "type": "LoginRequest",
       "username": "sean",
       "password": "password"
    }
    EOF
    {"type":"OKResult","status":"OK","result":"USER-35","job":null,"action":null}%   ​
    Finally, I initiate the restore from bookmark
    % curl -s -X POST -k --data @- http://sean5221.dc4.delphix.com/resources/json/delphix/jetstream/container/JS_DATA_CONTAINER-1/restore \
     -b ~/cookies.txt -c ~/cookies.txt -H "Content-Type: application/json" <<EOF
     {
        "type": "JSDataContainerRestoreParameters",
        "timelinePointParameters": {
            "type": "JSTimelinePointBookmarkInput",
            "bookmark": "JS_BOOKMARK-1"
        },
        "forceOption": false
    }
    EOF
    {"type":"OKResult","status":"OK","result":"","job":"JOB-27","action":"ACTION-86"}​
    So, if you're following the same sequence I'm not clear what may be failing as the parameters are fairly simple. If you're able to complete the same action through CLI with this user, you can also confirm the API request is the same by using setopt trace=true.
    sean5221.dc4> /jetstream container
    sean5221.dc4 jetstream container> select test
    sean5221.dc4 jetstream container 'test'> restore
    sean5221.dc4 jetstream container 'test' restore *> set timelinePointParameters.bookmark=test 
    sean5221.dc4 jetstream container 'test' restore *> setopt trace=true
    sean5221.dc4 jetstream container 'test' restore *> commit
    === POST /resources/json/delphix/jetstream/container/JS_DATA_CONTAINER-1/restore ===
    {
        "type": "JSDataContainerRestoreParameters",
        "timelinePointParameters": {
            "type": "JSTimelinePointBookmarkInput",
            "bookmark": "JS_BOOKMARK-1"
        },
        "forceOption": false
    }
    === RESPONSE ===
    {
        "type": "OKResult",
        "status": "OK",
        "result": "",
        "job": "JOB-43",
        "action": "ACTION-123"
    }
    === END ===
        Dispatched job JOB-43
    === GET /resources/json/delphix/job/JOB-43 ===
    .
    .
    .​


    ------------------------------
    Sean Nothdurft
    Senior Member Technical Staff
    Delphix
    ------------------------------