Below is an example showing the many facets of the Grid Request documents. In this example, information about bounces from recently published mailings is needed. This example illustrates the following:
- Using single and multiple conditions
- Specifying a full day’s worth of data using GTE and LT comparators
- Using the IN comparator with a Collection
- Requesting counts (in order to manage paging)
Request 1: Get Count of Mailing Instances from Previous Day
<GridRequest xmlns="http://partner.informz.net/aapi/2009/08/"> <Brand id="9999">Test Brand</Brand> <User>testuser</User> <Grids> <Grid type="mailing_instance"> <Conditions> <Condition> <Single> <DataElement>Mailing_Date</DataElement> <DataValue>2009-09-01</DataValue> <Comparator>GTE</Comparator> </Single> </Condition> <Condition> <Single> <DataElement>Mailing_Date</DataElement> <DataValue>2009-09-02</DataValue> <Comparator>LT</Comparator> </Single> </Condition> </Conditions> <ReturnFields> <DataElement>Count</DataElement> </ReturnFields> </Grid> </Grids> </GridRequest>
Response 1: Count of Mailings
<?xml version="1.0" encoding="utf-16"?> <GridResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://partner.informz.net/aapi/2009/08/"> <Brand id="9999">Test Brand</Brand> <User>testuser</User> <Grids> <Grid type="mailing_instance"> <Record row="0"> <Fields> <Field element="count">6</Field> </Fields> </Record> </Grid> </Grids> </GridResponse>
Request 2: Get List of Mailing Instances from a Single Day
<GridRequest xmlns="http://partner.informz.net/aapi/2009/08/"> <Brand id="9999">Test Brand</Brand> <User>testuser</User> <Grids> <Grid type="mailing_instance"> <Conditions> <Condition> <Single> <DataElement>Mailing_Date</DataElement> <DataValue>2009-09-01</DataValue> <Comparator>GTE</Comparator> </Single> </Condition> <Condition> <Single> <DataElement>Mailing_Date</DataElement> <DataValue>2009-09-02</DataValue> <Comparator>LT</Comparator> </Single> </Condition> </Conditions> <ReturnFields> <DataElement>Mailing_ID</DataElement> <DataElement>Mailing_Instance_ID</DataElement> <DataElement>Mailing_Date</DataElement> <DataElement>Mailing_Subject</DataElement> </ReturnFields> <SortField order="asc">Mailing_Date</SortField> </Grid> </Grids> </GridRequest>
Response 2: When No Rows are Returned
<?xml version="1.0" encoding="utf-16"?> <GridResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://partner.informz.net/aapi/2009/08/"> <Brand id="9999">Test Brand</Brand> <User>testuser</User> <Grids> <Grid type="mailing_instance" /> </Grids> </GridResponse>
Response 2: List of Two Mailing Instances
<?xml version="1.0" encoding="utf-16"?> <GridResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://partner.informz.net/aapi/2009/08/"> <Brand id="9999">Test Brand</Brand> <User>testuser</User> <Grids> <Grid type="mailing_instance"> <Record row="1"> <Fields> <Field element="mailing_id">134384</Field> <Field element="mailing_instance_id">1297889</Field> <Field element="mailing_date">2011-09-13T18:37:37.2630000Z</Field> <Field element="mailing_subject">Mailing one</Field> </Fields> </Record> <Record row="2"> <Fields> <Field element="mailing_id">134385</Field> <Field element="mailing_instance_id">1297891</Field> <Field element="mailing_date">2011-09-13T18:38:21.3700000Z</Field> <Field element="mailing_subject">Mailing two</Field> </Fields> </Record> </Grid> </Grids> </GridResponse
Request 3: Get Count of Mailing Activity Bounces Rows to Determine Paging
<GridRequest xmlns="http://partner.informz.net/aapi/2009/08/"> <Brand id="9999">Test Brand</Brand> <User>testuser</User> <Grids> <Grid type="mailing_activity_bounces"> <Conditions> <Condition> <Collection> <DataElement>mailing_instance_id</DataElement> <DataValue>1297945</DataValue> <DataValue>478933</DataValue> <SetOperator>IN</SetOperator> </Collection> </Condition> </Conditions> <ReturnFields> <DataElement>Count</DataElement> </ReturnFields> </Grid> </Grids> </GridRequest>
Response 3: Count of Mailing Activity Bounces
<?xml version="1.0" encoding="utf-16"?> <GridResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://partner.informz.net/aapi/2009/08/"> <Brand id="9999">Test Brand</Brand> <User>testuser</User> <Grids> <Grid type="mailing_activity_bounces"> <Record row="0"> <Fields> <Field element="count">92</Field> </Fields> </Record> </Grid> </Grids>
Request 4: Get First 50 Rows of Data for Both Mailing Instances
<GridRequest xmlns="http://partner.informz.net/aapi/2009/08/"> <Password>password</Password> <Brand id="9999">Test Brand</Brand> <User>testuser</User> <Grids> <Grid type="mailing_activity_bounces"> <Conditions> <Condition> <Collection> <DataElement>mailing_instance_id</DataElement> <DataValue>1297945</DataValue> <DataValue>478933</DataValue> <SetOperator>IN</SetOperator> </Collection> </Condition> </Conditions> <ReturnFields> <DataElement>mailing_instance_id</DataElement> <DataElement>is_repeat_bounce</DataElement> <DataElement>is_hard_bounce</DataElement> <DataElement>is_soft_bounce</DataElement> <DataElement>user_id</DataElement> <DataElement>email</DataElement> </ReturnFields> <SortField order="asc">Email</SortField> <StartRow>1</StartRow> <NumberOfRows>50</NumberOfRows> </Grid> </Grids> </GridRequest>
Response 4: First 50 Rows Return Bounce Data of 135 Total Rows
<?xml version="1.0" encoding="utf-16"?> <GridResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://partner.informz.net/aapi/2009/08/"> <Brand id="9999">Test Brand</Brand> <User>testuser</User> <Grids> <Grid type="mailing_activity_bounces"> <Record row="1"> <Fields> <Field element="mailing_instance_id">1297945</Field> <Field element="is_repeat_bounce">0</Field> <Field element="is_hard_bounce">1</Field> <Field element="is_soft_bounce">0</Field> <Field element="user_id" /> <Field element="email">thisbounces1@gmail.com</Field> </Fields> </Record> <Record row="2"> <Fields> <Field element="mailing_instance_id">1297945</Field> <Field element="is_repeat_bounce">0</Field> <Field element="is_hard_bounce">1</Field> <Field element="is_soft_bounce">0</Field> <Field element="user_id" /> <Field element="email">thisbounces2@gmail.com</Field> </Fields> </Record> . . . <Record row="50"> <Fields> <Field element="mailing_instance_id">1297945</Field> <Field element="is_repeat_bounce">0</Field> <Field element="is_hard_bounce">1</Field> <Field element="is_soft_bounce">0</Field> <Field element="user_id" /> <Field element="email">thisbounces3@gmail.com</Field> </Fields> </Record> </Grid> </Grids> </GridResponse>
Request 5: Get Data for Mailing Instances (Rows 51-100)
<GridRequest xmlns="http://partner.informz.net/aapi/2009/08/"> <Password>password</Password> <Brand id="9999">Test Brand</Brand> <User>testuser</User> <Grids> <Grid type="mailing_activity_bounces"> <Conditions> <Condition> <Collection> <DataElement>mailing_instance_id</DataElement> <DataValue>1297945</DataValue> <DataValue>478933</DataValue> <SetOperator>IN</SetOperator> </Collection> </Condition> </Conditions> <ReturnFields> <DataElement>mailing_instance_id</DataElement> <DataElement>is_repeat_bounce</DataElement> <DataElement>is_hard_bounce</DataElement> <DataElement>is_soft_bounce</DataElement> <DataElement>user_id</DataElement> <DataElement>email</DataElement> </ReturnFields> <SortField order="asc">Email</SortField> <StartRow>51</StartRow> <NumberOfRows>50</NumberOfRows> </Grid> </Grids> </GridRequest>
Response 5: Return Second 50 Rows of Bounce Data
<?xml version="1.0" encoding="utf-16"?> <GridResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://partner.informz.net/aapi/2009/08/"> <Brand id="9999">Test Brand</Brand> <User>testuser</User> <Grids> <Grid type="mailing_activity_bounces"> <Record row="51"> <Fields> <Field element="mailing_instance_id">1297945</Field> <Field element="is_repeat_bounce">0</Field> <Field element="is_hard_bounce">1</Field> <Field element="is_soft_bounce">0</Field> <Field element="user_id" /> <Field element="email">thisbounces51@gmail.com</Field> </Fields> </Record> <Record row="52"> <Fields> <Field element="mailing_instance_id">1297945</Field> <Field element="is_repeat_bounce">0</Field> <Field element="is_hard_bounce">1</Field> <Field element="is_soft_bounce">0</Field> <Field element="user_id" /> <Field element="email">thisbounces52@gmail.com</Field> </Fields> </Record> <Record row="92"> <Fields> <Field element="mailing_instance_id">1297945</Field> <Field element="is_repeat_bounce">0</Field> <Field element="is_hard_bounce">1</Field> <Field element="is_soft_bounce">0</Field> <Field element="user_id" /> <Field element="email">thisbounces92@gmail.com</Field> </Fields> </Record> </Grid> </Grids> </GridResponse>