Query[API] : Does API response 200 OK is the actual success response for REWIND & REFRESH calls ?

  • 2
  • 1
  • Question
  • Updated 3 years ago
  • Answered
Query[API] : Does API response 200 OK is the actual success response for REWIND & REFRESH calls ?


Scenario : 
Sent a API web service call to REWIND and we got '200 OK'  as success response ..but in the background actual request is still processing and there could be chances that the actual process may fail after receiving response as "OK" from the web service. <correct me if i am wrong>

Team please suggest, does such scenario arises ? if so how to place check points in that case.

Photo of K J M RAO

K J M RAO

  • 440 Points 250 badge 2x thumb

Posted 3 years ago

  • 2
  • 1
Photo of Eyal Kaspi

Eyal Kaspi, Employee

  • 970 Points 500 badge 2x thumb
Official Response
Your observation is correct. The Delphix Engine supports the notion of Jobs. See https://docs.delphix.com/display/DOCS50/Asynchronous+Jobs

When an API request dispatches a job (which happens for many VDB operations such as rollback/rewind and refresh), the API response code will be 200, and the content of the response will be a JSON object of the "OKResult" JSON schema, for instance:

{   "type": "OKResult",
    "status": "OK",
    "result": "",
    "job": "JOB-21447695",
    "action": "ACTION-25474091"
}

The job property contains a reference to a Job, and the /resources/json/delphix/job API endpoint can be used to query the status of the job. In this example, you may issue an HTTP GET request to /resources/json/delphix/job/JOB-21447695 and look at the jobState property to determine if the job has completed (edited):

GET /resources/json/delphix/notification?channel=JOB-21447695

{    "type": "OKResult",
    "status": "OK",
    "result": {
        "type": "Job",
        "reference": "JOB-21447695",
        "jobState": "RUNNING",
        "startTime": "2016-04-13T07:46:49.082Z",
        "updateTime": "2016-04-13T07:46:49.092Z",
        "percentComplete": 0,
        ...
        "events": [
            {
                "type": "JobEvent",
                "timestamp": "2016-04-13T07:46:49.093Z",
                ...
                "messageDetails": "... job started for \"...\".",
                "eventType": "INFO"
            }
        ],
        "parentActionState": "WAITING",
        "parentAction": "ACTION-25474091"
    },
    "job": null,
    "action": null
}