The service enables you to create a new UserQuery.
Rules for creating a query:
- groups are optional, but you can't select local and external groups in one query, it's either local groups or one external group
- fields can '*' meaning all fields, or email, mobileNumber, registrationDate or custom fields 1 to 30 e.g. field1, field2 etc.
- email,mobile and field1 to field20 filters can be a single value or a list of comma separed values. Comparison type can be equal, textLike,notLike
- registrationDate and field21 to field 25 filters be a single value or a list of 2 values, which are date ranges between the first value and the second.
if a range of two dates is set, the comparison type is ignored.
if only one value is set, possible comparison types are Greater and Lower
- recipientId and field26 to field 30 filters can be a single value or a list of comma separated values.
if a single value is set, possible comparison types are Equal, NotLike, Greater and Lower.
if a list of values is set, possible comparison types are Equal and NotLike.
* If you don't follow the rules above, the system will throw an exception or use the defaults, which
will cause the query to return unexpected results
Parameters:
Name
|
Type
|
Required
|
Description
|
Id
|
String
|
No
|
The query id, set by inwise when creating a new query
|
Name
|
String
|
Yes
|
The query unique name, used for display
|
OwnerType
|
String
|
Yes
|
The owner entity type - the type of the entity you want to set the tag to, such as ContactsGroup, EmailMessage etc.
|
Description
|
String
|
No
|
A description for the query
|
QueryData
|
CustomUserQuery
|
Yes
|
The query fields and filters
|
The service returns the CreateResult
C# Code:
//list recipients for which field3 is 'green' or 'yellow'
UserQuery userQuery = new UserQuery();
userQuery.Name = "My First Sengmenatation";
userQuery.Description = "list recipients for which field3 is 'green' or 'yellow'";
var queryParameters = new CustomUserQuery();
queryParameters.Fields = new string[] { "email", "field1" };
queryParameters.Filters = new Filter[1];
queryParameters.Filters[0] = new Filter()
{
ColumnName = "field3",
Comparer = ComparisonType.Equal,
Values = "blue,green,yellow"
};
userQuery.QueryData = queryParameters;
var createResult = target.Create(userQuery);
Raw Xml:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<SessionIdHeader xmlns="http://www.inwise.com/webservices/v2">
<SessionId>
e717ad66d7de422e937c0f8650bc6876
</SessionId>
<EndSession>
true
</EndSession>
</SessionIdHeader>
</soap:Header>
<soap:Body>
<Create xmlns="http://www.inwise.com/webservices/v2">
<entity xsi:type="UserQuery">
<AccountId xsi:nil="true" />
<Name>
My First Sengmenatation
</Name>
<Description>
list recipients for which field3 is 'green' or 'yellow'
</Description>
<CreateDate>
0001-01-01T00:00:00
</CreateDate>
<QueryData>
<Fields>
<string>
email
</string>
<string>
field1
</string>
</Fields>
<Filters>
<Filter>
<ColumnName>
field3
</ColumnName>
<Values>
Green,Yellow
</Values>
<Comparer>
Equal
</Comparer>
</Filter>
</Filters>
</QueryData>
<Tags xsi:nil="true" />
</entity>
</Create>
</soap:Body>
</soap:Envelope>
Response:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<CreateResponse xmlns="http://www.inwise.com/webservices/v2">
<CreateResult>
<IsSuccess>
true
</IsSuccess>
<ErrorDetails>
<Code>
Success
</Code>
</ErrorDetails>
<Ids>
<string>
289
</string>
</Ids>
</CreateResult>
</CreateResponse>
</soap:Body>
</soap:Envelope>