/db2whrest/v1/task_status/<task_id>: GET and <task_id>/peek

Gets the status of the specified asynchronous task.

The following table shows which roles can access these two REST API endpoints:
Table 1. Access by role
Endpoint Data admin Data user Collection Admin Admin Service user
/db2whrest/v1/task_status/<task_id>: GET Χ Χ
/db2whrest/v1/task_status/<task_id>/peek: GET Χ Χ

The peek variation of this endpoint returns the status of the asynchronous operation. The nonpeek version returns both the status of the operation and a response header that includes further information. For more information about using these endpoints, see the following examples, and also see the topic Asynchronous endpoints.

Synopsis of the request URL

curl -k -H 'Authorization: Bearer <token>' https://<spectrum_discover_host>/db2whrest/v1/task_status/
<task_id> -X GET
or
curl -k -H 'Authorization: Bearer <token>' https://<spectrum_discover_host>/db2whrest/v1/task_status/
<task_id>/peek -X GET

Supported request types and response formats

Supported request types:
  • GET
Supported response formats:
  • CSV
  • JSON

Examples

  1. In this example, the user discovers that the asynchronous operation completes and finds the location URI of the results of the operation. For more information on these steps, see the topic Asynchronous endpoints. The user runs the /db2whrest/v1/task_status/<task_id>: GET endpoint on the location URI to get the results of the operation:
    curl -k -H 'Authorization: Bearer <token>' https://<spectrum_discover_host>/db2whrest/v1/
    task_status/9c0db090-bd33-41c5-969f-a1603ddf49ab
    The results are returned in the response. Only the first two rows of the results are shown in this example:
    0,reflib,INDEX,SCAN,MO1,,Spectrum Scale,reflib.university.edu,3067343,root,root,
    -rw-r--r--,root,9,10,/reflib/cellranger-2.0.0/refdata-cellranger-ercc92-1.2.0/star/,
    sjdbList.out.tab,tab,resdnt,NA,2016-11-14 19:40:10,2017-06-02 21:30:26,2017-06-02 
    21:30:26,2018-07-24 16:32:47,system,0,1,reflib.university.edureflib3067343,
    ,,,,,,,,,,,,,,,
    1,reflib,INDEX,SCAN,MO1,,Spectrum Scale,reflib.university.edu,3067333,root,root,
    -rw-r--r--,root,9,10,/reflib/cellranger-2.0.0/refdata-cellranger-ercc92-1.2.0/star/,
    chrLength.txt,txt,resdnt,NA,2016-11-14 19:40:10,2017-06-02 23:28:21,2017-06-02 21:30:26,
    2018-07-24 16:32:47,system,412,1,reflib.university.edureflib3067333,
    ,,,,,,,,,,,,,,,
    ...
    
  2. In this example, the user learns that the asynchronous operation is in progress and finds the location URI of the asynchronous operation. For more information on these tasks, see the topic Asynchronous endpoints. The user can do the following steps:
    1. Monitor the status of the asynchronous operation by running the /db2whrest/v1/task_status/<task_id>/peek: GET endpoint on the location URI of the asynchronous operation several times:
      curl -k -H 'Authorization: Bearer <token>' https://<spectrum_discover_host>/db2whrest/v1/
      task_status/9c0db090-bd33-41c5-969f-a1603ddf8888/peek
      In the first few tries the response to the peek endpoint indicates that the asynchronous operation is still running:
      {"status":work scheduled}
      On the final try the response to the peek endpoint indicates that the asynchronous operation completes:
      {"status":work scheduled}
    2. Find the location URI of the asynchronous operation. This location URI is already available in Step 2(a), where the peek endpoint is run on it.
    3. Get the location URI of the results of the operation. To accomplish this task, run the /db2whrest/v1/task_status/<task_id>: GET endpoint on the location URI of the asynchronous operation, which you obtained in Step 2(b). The response contains the location URI of the results of the operation.
    4. Get the results of the asynchronous operation. To accomplish this task, run the /db2whrest/v1/task_status/<task_id>: GET endpoint on the location URI of the results of the operation, which you obtained in Step 2(c):
      curl -k -H 'Authorization: Bearer <token>' https://<spectrum_discover_host>/db2whrest/v1/task_status/9c0db090-bd33-
      41c5-969f-a1603ddf8888
      The results of the asynchronous operation are returned in the response. Only the first two rows of the results are shown in this example:
      0,reflib,INDEX,SCAN,MO1,,Spectrum Scale,reflib.university.edu,3067343,root,root,
      -rw-r--r--,root,9,10,/reflib/cellranger-2.0.0/refdata-cellranger-ercc92-1.2.0/star/,
      sjdbList.out.tab,tab,resdnt,NA,2016-11-14 19:40:10,2017-06-02 21:30:26,2017-06-02 
      21:30:26,2018-07-24 16:32:47,system,0,1,reflib.university.edureflib3067343,
      ,,,,,,,,,,,,,,,
      1,reflib,INDEX,SCAN,MO1,,Spectrum Scale,reflib.university.edu,3067333,root,root,
      -rw-r--r--,root,9,10,/reflib/cellranger-2.0.0/refdata-cellranger-ercc92-1.2.0/star/,
      chrLength.txt,txt,resdnt,NA,2016-11-14 19:40:10,2017-06-02 23:28:21,2017-06-02 21:30:26,
      2018-07-24 16:32:47,system,412,1,reflib.university.edureflib3067333,
      ,,,,,,,,,,,,,,,
      ...
      
    For more information, see the topic Asynchronous endpoints.