getAsyncResult
In SOAP web services, you use the getAsyncResult operation to retrieve details about specific records submitted as part of an asynchronous request.
SOAP Request
You can use code like the following to retrieve the getAsyncResult response. This example shows how to look for records that failed with a status detail code of “unexpected error” and then take some action with those records.
AsyncAddListResult result = (AsyncAddListResult)port.getAsyncResult("job ID", 1);
WriteResponseList responses = result.getWriteResponseList();
for (WriteResponse response : responses.getWriteResponse())
{
if (!response.getStatus().isIsSuccess())
{
if (response.getStatus().getStatusDetail()[0].getCode() == StatusDetailCodeType.UNEXPECTED_ERROR)
// add for resubmit
}
}
REST Request
In REST web services, you can use the async service to retrieve details about a single async operation. For detailed information about asynchronous processing in REST and for more examples, see REST Web Services Request Processing.
You can send a request similar to the following to get the result of the executed request: GET https://demo123.suitetalk.api.netsuite.com/services/rest/async/v1/job/1/task/1/result.
The following example shows the returned result:
{
"links": [
{
"rel": "self",
"href": "https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer/... "
}
],
"companyName": "Glenrock General Hospital",
"email": "alan.smith@example.com",
"entityStatus": {
"links": [
{
"rel": "self",
"href": "https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customerstatus/13"
}
],
"id": "13",
"refName": "CUSTOMER-Closed Won"
}
}