It is possible to use multiple conditions to form more complex requests with the Informz API. Keep the following in mind before attempting to form complex conditions:
- Each condition’s <DataElement> can only appear once in the grid request; otherwise, they will be in conflict with each other and no return fields will be present.
- Be sure that each condition gets its own <Condition> parent tag.
- It is best to work “large to small," having the expectation that fewer records return as more conditions are added to the Grid Request.
Below are three examples of these complex conditions working together:
Example 1: Inclusive Conditions
This example is a GridRequest that is trying to pull tabular data from subscriber_personal_information using “inclusive conditions” or conditions that work to get information based on the conditions being supplied appearing in the response.
- In this request, we are looking for all personal information for three Subscriber_IDs, including three Personal_Information_IDs, and then including an additional condition to return data related to items where the personal_information_name is equal to “First Name.”
- This is not the most useful grid request (because the third condition basically makes the second condition useless), but it does illustrate how conditions can work together to narrow down on what is important.
<GridRequest xmlns="http://partner.informz.net/aapi/2009/08/"> <Password>password</Password> <Brand id="9999">Brand Name</Brand> <User>test_user</User> <Grids> <Grid type="subscriber_personal_information"> <Conditions> <Condition> <Collection> <DataElement>Subscriber_ID</DataElement> <DataValue>521698050</DataValue> <DataValue>522355847</DataValue> <DataValue>522355874</DataValue> <SetOperator>IN</SetOperator> </Collection> </Condition> <Condition> <Collection> <DataElement>Personal_Information_ID</DataElement> <DataValue>1057</DataValue> <DataValue>1058</DataValue> <DataValue>1049</DataValue> <SetOperator>IN</SetOperator> </Collection> </Condition> <Condition> <Collection> <DataElement>Personal_Information_name</DataElement> <DataValue>First</DataValue> <SetOperator>IN</SetOperator> </Collection> </Condition> </Conditions> <ReturnFields> <DataElement>subscriber_id</DataElement> <DataElement>Email</DataElement> <DataElement>personal_information_id</DataElement> <DataElement>personal_information_name</DataElement> <DataElement>personal_information_value</DataElement> </ReturnFields> </Grid> </Grids> </GridRequest>
Example 2: Subscriber Interests
This example seeks data contingent upon both “inclusive conditions” and “non-inclusive/negative” conditions.
- The idea is to request data that has some given criteria, while removing items from that data that is not important to what we’re hoping to see in the response.
- In the request, we want to request of all subscribers who were brought into Informz after December 31, 2015, we want to omit two Informz users who were added after that date who would otherwise appear as subscribers in the response, and we want to also omit unsubscribers.
<GridRequest xmlns="http://partner.informz.net/aapi/2009/08/"> <Password>password</Password> <Brand id="9999">Brand Name</Brand> <User>test_user</User> <Grids> <Grid type="subscriber"> <Conditions> <Condition> <Single> <DataElement>service_since_date</DataElement> <DataValue>2015-12-31</DataValue> <Comparator>GT</Comparator> </Single> </Condition> <Condition> <Collection> <DataElement>email</DataElement> <DataValue>new_admin_user1@example.com</DataValue> <DataValue>new_admin_user2@example.com </DataValue> <SetOperator>NOTIN</SetOperator> </Collection> </Condition> <Condition> <Single> <DataElement>is_unsubscriber</DataElement> <DataValue>1</DataValue> <Comparator>NEQ</Comparator> </Single> </Condition> </Conditions> <ReturnFields> <DataElement>email</DataElement> <DataElement>is_unsubscriber</DataElement> </ReturnFields> </Grid> </Grids> </GridRequest>
Example 3: Mailing
This example requests data that should include mailings that were sent between two dates. In addition, the request omits any mailings that contain a given subject.
<GridRequest xmlns="http://partner.informz.net/aapi/2009/08/"> <Password>password</Password> <Brand id="9999">Brand Name</Brand> <User>test_user</User> <Grids> <Grid type="mailing"> <Conditions> <Condition> <Between> <DataElement>create_date</DataElement> <DataValue>2014-12-31</DataValue> <DataValue>2016-04-25</DataValue> </Between> </Condition> <Condition> <Single> <DataElement>subject</DataElement> <DataValue>This is my test email</DataValue> <Comparator>NEQ</Comparator> </Single> </Condition> </Conditions> <ReturnFields> <DataElement>create_date</DataElement> <DataElement>folder_id</DataElement> <DataElement>friendly_from</DataElement> <DataElement>mailing_id</DataElement> <DataElement>name</DataElement> <DataElement>reply_to</DataElement> <DataElement>subject</DataElement> <DataElement>template_name</DataElement> </ReturnFields> </Grid> </Grids> </GridRequest>