Description
This method returns all the dynamic segments created for your account. Using the input parameters, you can control how many fields to return in the response message, and the offset to skip in the numerical order. This latter input parameter is useful when you are building a user interface displaying all dynamic segments that includes paging. Rather than pull the complete set of dynamic segments, you only pull the ones you need depending upon which page the user is viewing in the interface.
Using the count parameter will require the request to be asynchronous and will return a task_id in the response that can be used in conjunction with the utilities.getTasks and utilities.getFile requests.
The collection of dynamic segments is encapsulated within the <dynamic_segments> element. The details of each dynamic segment are in turn, encapsulated within the <item> element. Hence:
<dynamic_segments>
<item>
… dynamic segment elements
</item>
<item>
… dynamic segment elements
</item>
… additional dynamic segments
</dynamic_segments>
The list of dynamic segments will be sorted by segment name in alphabetical order.
Arguments
Field | Description | Field Type | Required | Example |
---|---|---|---|---|
limit | A numeric value specifying how many dynamic segment records will be included in the response message. | string | No | 25 |
offset | A numeric value specifying how many dynamic segment records to skip from the response. Use this element when you are using this API to construct a user interface that displays the complete list of dynamic segments over several "pages". | string | No | 26 |
count | When this flag is set to Y, the response will include the count of subscribers in each dynamic segment returned. When used, the API request will be asynchronous. | string | No | Y |
segments_ids | Provide a list of segment ID numbers for which data is to be retrieved. | string | No | 884914 or 879118,879119 |
Response
Field | Description | Example |
---|---|---|
responseCode | A code indicating either success or failure of the operation. (see Error Codes below) | 170 |
responseText | Human readable description of the response code | Displaying all dynamic segments |
id | The dynamic segment ID number | 1477174 |
name | The name of dynamic segment. | Rock Genre |
Response Codes
Error Condition | responseCode | responseText |
---|---|---|
Successful operation; all dynamic segments in the system are returned with no offset or limit. | 174 | Displaying all dynamic segments |
There are fewer dynamic segments in the system than specified by the <offset> value. | 175 | Offset exceeds number of dynamic segments |
There are no dynamic segments in the system to return | 176 | No dynamic segments returned |
Successful operation; the subset of dynamic segments defined by the limit and offset are returned. | 177 | Retrieved subset of dynamic segments |
Successful operation; the asynchronous request for subscriber counts has been made and a task_id has been returned. | 178 | Fetching dynamic segments asynchronously |
If given segment id is not present for respective client or not present in system, then error is returned | 179 | Segment ID(s) does not exists or invalid |
If input segment id limit is more than 1000 then limit exceeded error returned. | 184 | Segment ID input limit exceed |
Successful operation: the subset of dynamic segments defined by segment_ids are returned. | 177 | Retrieved subset of dynamic segments |
Example Post
Example 1
<methodCall>
<methodName>account.getDynamicSegments</methodName>
<limit>2</limit>
<offset>5</offset>
</methodCall>
Example 2
<methodCall>
<methodName>account.getDynamicSegments</methodName>
<limit>2</limit>
<offset>5</offset>
<segment_ids>3310627,3304134,3304454,3304445,1265479,3304444,3345229</segment_ids>
<count>Y</count>
</methodCall>
Example Response
<methodResponse>
<item>
<methodName>account.getDynamicSegments</methodName>
<responseCode>177</responseCode>
<responseText>Retrieved subset of dynamic segments</responseText>
<responseData>
<dynamic_segments>
<item>
<name>Automobiles</name>
<id>3303852</id>
</item>
<item>
<name>Motorcycles</name>
<id>3303859</id>
</item>
</dynamic_segments>
</responseData>
<responseNum>1</responseNum>
</item>
</methodResponse>
Example Error
<methodResponse>
<item>
<methodName>account.getDynamicSegments</methodName>
<responseCode>175</responseCode>
<responseText>Offset exceeds number of dynamic segments</responseText>
<responseData></responseData>
<responseNum>1</responseNum>
</item>
</methodResponse>