Retrieve the status of the asynchronous insertion of Data Extension records verified

Learn how to retrieve the status of the asynchronous insertion of Data Extension records (rows) in Salesforce Marketing Cloud (SFMC) with SSJS (server-side JavaScript). Code snippets include the REST API method.

REST API

var requestId = "S0M3-1D-G03SR1G4T-H3R3";

var endpoint = restInstanceUrl + "data/v1/async/" + requestId + "/status";

var request = new Script.Util.HttpRequest(endpoint);
    request.emptyContentHandling = 0;
    request.retries = 2;
    request.continueOnError = true;
    request.setHeader("Authorization", "Bearer " + accessToken);
    request.method = "GET";

var results = request.send();

var result = Platform.Function.ParseJSON(String(results.content));
<script runat="server">

    Platform.Load("core", "1");

	try {

        var requestId = "S0M3-1D-G03SR1G4T-H3R3";

        var endpoint = restInstanceUrl + "data/v1/async/" + requestId + "/status";

        var request = new Script.Util.HttpRequest(endpoint);
            request.emptyContentHandling = 0;
            request.retries = 2;
            request.continueOnError = true;
            request.setHeader("Authorization", "Bearer " + accessToken);
            request.method = "GET";

        var results = request.send();

        var result = Platform.Function.ParseJSON(String(results.content));

        Write(Stringify(result));
		
	} catch(error) {
        Write(Stringify(error));
    }	

</script>
{
   "status": {
      "callDateTime": "2024-07-17T20:30:00.00",
      "completionDateTime": "2024-07-17T20:30:06.943",
      "hasErrors": false,
      "pickupDateTime": "2024-07-17T20:30.903",
      "requestStatus": "Complete",
      "resultStatus": "OK",
      "requestId": "S0M3-GU1D-K3Y-G03SR1G4T-H3R3"
   },
   "requestId": "S0M3-GU1D-K3Y-G03SR1G4T-H3R3"
}

TIP

Possible values for request status are: Pending, Complete and Error.

Reference

Ressources and references related to the current methods.

Official documentation

Last Updated: