The following are the steps to follow to call Data Copy APIs.
- Get the CCP Account ID (environment ID) from the URL (the part proceeding /environemnts/). For example, in the URL: https://abc.com/environments/9eydr2-yrt/dashboard, the part 9eydr2-yrt is the CCP Account ID.
- Build the prefix for Data Copy REST APIs using the CCP Account ID. The prefix of all Data Copy URLs is: CCP_URL/api/accounts/ENVIRONMENT_ID/datamover/api. For example, https://abc.com/environments/9eydr2-yrt/datamover/api.
- Call Data Copy REST APIs using URL similar to: CCP_URL/api/accounts/ENVIRONMENT_ID/datamover/api/DM_RESOURCE. A sample code is given here for reference.
curl --location 'https://xyz.com/api/accounts/0f3a3343-9720-501b-b10e-b6fd1508b6ec/datamover/api/jobs' \ --header 'Accept: application/json' \ --header "Authorization: Bearer ey...KA"
Data Copy REST API Resources
The following are the Data Copy REST API resources.
Resource | Method | Description | Asynchronous Support |
---|---|---|---|
jobs | GET | list all copy plans in data copy service | No |
/jobs | POST | create a copy plan | Yes |
/jobs/[plan-name] | GET | list a definition of copy plan | No |
/jobs/[plan-name] | PUT | update a copy plan | Yes |
/jobs/[plan-name] | DELETE | delete a copy plan | No |
/executingJobs | GET | list all executing copy plans | No |
/executingJobs | POST | start a copy plan | Yes |
/executingJobs/[plan-name] | GET | status of an executing copy plan | No |
/executingJobs/[plan-name] | DELETE | stop an executing plan | No |
/executingJobs/[plan-name]?cleanupOnly=true | DELETE | cleanup a canceled plan | No |
/executedJobs/[plan-name] | GET | status of an executed copy plan | No |
/daemonProperties | GET | Get daemon configuration settings | No |
/daemonProperties | PUT | Update daemon configuration settings | No |
Asynchronous Support of APIs
VantageCloud Lake API calls have a 30 second timeout limit. To avoid this limit, you need to run Data Copy REST APIs in an asynchronous mode. The previous table, Data Copy REST API Resources, contains the list of APIs that require use of asynchronous mode.
To make asynchronous REST API calls:
- Use the Prefer: respond-async header.The REST API responds with 202 Accepted code and returns response body similar to:
{ "id": "unique_id_containing_approx_30_characters", "link": "https://localhost:1443/datamover/monitor/unique_id_containing_approx_30_characters" }
Once you receive the id, modify the URL to include CCP URL and add the /monitor/<id> to monitor the progress.
- Use the Monitor API ( /monitor/{id}) to monitor the result of a request made asynchronously. When you use GET operation, the response body appears similar to:
{ "id": "2b86a1f1-3a36-4eae-b46e-fd2a588ff8c0", "timestamp": "2022-11-21T22:38:40Z", "request": "POST /datamover/jobs", "status": "inprogress" }
The id in the previous response body matches the id made in the request and also from the response body when the call was initially made.
The status indicates whether the original request is still running or complete. When it’s completed, the response body appears similar to:{ "id": "2b86a1f1-3a36-4eae-b46e-fd2a588ff8c0", "timestamp": "2022-11-21T22:38:40Z", "request": "POST /datamover/jobs", "status": "complete", "response_data": { "body": { "job_name": "dmJob1", "links": { "self": "https://localhost:1443/datamover/jobs/dmJob1" } }, "status": "completed", "status_code": 201 } }
The following are some indicators of the previous response body:- "status": "complete" : Request is complete.
- "status": "completed": Status of the actual request.
- "status_code": Value other than 2xx format indicates that the request is failed.
- The contents of the "body" element in response data matches with the contents of the "body" element you got when making the calls synchronously.
You cannot delete a monitor resource. The monitor resource is automatically removed one hour after the request is complete.