How asynchronous operation works

Many of the API calls, particularly those that create or remove a resource, can take a longer time to complete than most other API calls. NAS Bridge processes these types of requests asynchronously. When issuing a call that operates asynchronously, you must check the status of the resource instance to confirm that the request is complete.

With asynchronous processing, the initial successful HTTP response indicates that the request has been accepted but not necessarily finished. Therefore, after making an asynchronous request to add or remove a resource, you must test the resource instance for completion of the request.

Note: Refer to the API Docs (Swagger) web page for documentation to help determine whether a specific API call operates asynchronously. The implementation notes section on the page (if present) contains the details.
Checking a resource status after an add request
After issuing an API call that adds a resource, you should poll the status of the resource to verify completion of the request. A request is complete when the new resource's status is READY.

After creating the required authentication token, you should use the following high level process when asynchronously adding a resource:

  1. Issue the API call to add a resource.
  2. Receive an HTTP response indicating successful acceptance of the request.
  3. Extract the resource ID from the HTTP response.
  4. Within a timed loop, perform the following steps in each loop cycle:
    1. Get the current status of the resource based on the ID.
    2. If the resource's status is not READY, perform the loop again.
    3. If the resource's status is FAILED UPDATE or FAILED ADD, abort the operation, fix the problem (for example, remove the failed resource), and perform the loop again.
  5. When the resource's status is READY, you can stop.
  6. If the polling loop times out (according to your arbitrary timeout value) before the resource's status is READY, report an error.
Checking for resource removal after a delete request
After issuing an API call that deletes a resource, you should poll the resource to verify that it has been removed. A request is complete when the resource no longer exists.

After creating the required authentication token, you should use the following high-level process when asynchronously removing a resource:

  1. Issue the API call to delete a resource.
  2. Receive an HTTP response indicating successful acceptance of the request.
  3. Within a timed loop, perform the following in each cycle:
    1. Get the current status of the resource based on the ID.
    2. If resource is located (HTTP code 200), perform the loop again.
  4. When the GET request responds with Not Found (HTTP code 404), you can stop.
  5. If the polling loop times out (according to your arbitrary timeout value) and the resource still exists, report an error.