# InvokeRetrieve

Invokes the `Retrieve` method on an API object.

## Syntax

`InvokeRetrieve(1, 2)`

## Properties

| Ordinal | Type   | Description                                                              |
| ------- | ------ | ------------------------------------------------------------------------ |
| `1`     | String | Required. The name of the object to perform the Retrieve method on.      |
| `2`     | Array  | Required. An array that holds the status and request ID of the API call. |

## Example

This code example uses the `Platform.Function.InvokeRetrieve` function to perform an API call. The example includes a filter that’s configured so that the request retrieves all emails that are associated with a specific account ID.

```
<script runat="server">

    // Create an API RetrieveRequest.
    var RetrieveRequest = Platform.Function.CreateObject("RetrieveRequest");

    // Create a variable to store the result of the RetrieveRequest.
    var StatusAndRequestID = [0,0];

    // Specify the object type for the retrieve request.
    Platform.Function.SetObjectProperty(RetrieveRequest, "ObjectType", "Email");

    // Specify the columns to retrieve for the specified object type.
    Platform.Function.AddObjectArrayItem(RetrieveRequest, "Properties", "Email.Name");
    Platform.Function.AddObjectArrayItem(RetrieveRequest, "Properties", "Email.ID");

    // Create a SimpleFilterPart to apply to the API request.
    var RetrieveFilter = Platform.Function.CreateObject("SimpleFilterPart");

    // Filter objects based on account ID.
    Platform.Function.SetObjectProperty(RetrieveFilter, "Property", "Client.ID");
    Platform.Function.SetObjectProperty(RetrieveFilter, "SimpleOperator", "equals");
    Platform.Function.AddObjectArrayItem(RetrieveFilter, "Value", "11223");

    // Add the filter to the RetrieveRequest.
    Platform.Function.SetObjectProperty(RetrieveRequest, "Filter", RetrieveFilter);

    // Perform the request.
    var Emails = Platform.Function.InvokeRetrieve(RetrieveRequest, StatusAndRequestID);

    // Output the status and ID for the request.
    Platform.Response.Write("Status: " + StatusAndRequestID[0] + "<br/>");
    Platform.Response.Write("RequestID: " + StatusAndRequestID[1] + "<br/>");

    // Iterate through the results. Output the ID and name of each object in the result.
    for ( var c = 0 ; c < Emails.length ; c ++ ) {
        Platform.Response.Write("[" + Emails[c].ID + "] ");
        Platform.Response.Write(Emails[c].Name + "<br/>");
    };
</script>
```

The response includes the status and ID of the request, as well as a list of all emails that matched the filter criteria.

```
Status: OK
RequestID: 11d254b9-f4d3-4f05-8b6e-5885ddc0901e
[1122334] Major Release Announcement for version 2.0
[1122335] Minor Release Announcement (version 2.0.1)
[1122336] Minor Release Announcement (version 2.0.2)
```
