account.getStaticSegments
    • 3 Minutes to read
    • Dark
      Light

    account.getStaticSegments

    • Dark
      Light

    Article summary

    General Information

    This method replaces the legacy.retrieve_segment method.

    This method returns all the static 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 your static segments that include paging. Rather than pull the complete set of static segments, you only pull the ones you need depending on which page the user is viewing in the interface.

    The collection of static segments is encapsulated within the <static_segments> element. The details of each static segment are in turn, encapsulated within the <item> element. Hence:

    <static_segments>
    <item>
    … static segment elements
    </item>
    <item>
    … static segment elements
    </item>
    … additional static segments
    </static_segments>


    The list of static segments will be sorted by segment name in alphabetical order.

    Arguments

    Field

    Description

    Field Type

    Required

    Example

    limit

    A numeric value specifying how many static segment records will be included in the response message.

    string

    No

    25

    offset

    A numeric value specifying how many static 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 static 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 static segment returned.

    string

    No

    Y

    segment_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 the success or failure of the operation. (see Error Codes below)

    170

    responseText

    Human readable description of the response code

    Displaying all static segments

    id

    The static segment ID number

    1477174

    name

    The name of the static segment.

    Rock Genre

    category_id

    The ID number of the category that the static segment is assigned to. If this element is empty, then the static segment is "uncategorized" – or not associated with any category.

    3415

    subscribers_count

    A numeric value indicating the number of subscribers in the segment at the time of the request.

    47898

    display_on_survey

    A boolean value that defines whether the static segment should be displayed in the standard survey web page (or the custom survey web page) where applicable.

    boolean where:

    • 0 – do not display

    • 1 – display

    1

    test_segment

    A boolean value that defines whether this static segment should be used as a test list with the Standard Test Message feature. If this element is set to '1', then this static segment will be designated as a test segment and can be used when sending a Standard Test Message. 

    NOTE: If this static segment is to be used as a test segment, then it should not exceed 100 subscribers.

    boolean where:

    • 0 – is not a test segment

    • 1 – is a test segment

    0

    Response Codes

    Error Condition

    responseCode

    responseText

    Successful operation; all static segments in the system are returned with no offset or limit.

    170

    Displaying all static segments

    There are fewer static segments in the system than specified by the <offset> value.

    171

    Offset exceeds the number of static segments

    There are no static segments in the system to return

    172

    No static segments returned

    Successful operation; the subset of static segments defined by the limit and offset are returned.

    173

    Retrieved subset of static segments

    If the given segment id(s) is not present for a respective client or not present in the system, then an error is returned

    179

    Segment ID(s) does not exist or invalid

    If the input segment id limit is more than 1000 then limit exceed error returned

    184

    Segment ID input limit exceed

    Successful operation: the subset of static segments defined by segment_ids are returned

    173

    Retrieved subset of static segments

    Example Post

    Example 1

    <methodCall>
    <methodName>account.getStaticSegments</methodName>
    <limit>2</limit>
    <offset>5</offset>
    </methodCall>

    Example 2

    <methodCall>
    <methodName>account.getStaticSegments</methodName>
    <segment_ids>3310627,3304134,3304454,3304445,1265479,3304444,3345229</segment_ids>
    <limit>2</limit>
    <offset>5</offset>
    <count>Y</count>
    </methodCall>

    Example Response

    <methodResponse>
    <item>
    <methodName>account.getStaticSegments</methodName>
    <responseCode>173</responseCode>
    <responseText>Retrieved subset of static segments</responseText>
    <responseData>
    <static_segments>
    <item>
    <name>Rock Genre</name>
    <id>1477174</id>
    <category_id>3415</category_id>
    <subscribers_count>47898</subscribers_count>
    <display_on_survey>1</display_on_survey>
    <test_segment>0</test_segment>
    </item>
    <item>
    <name>Jazz Genre</name>
    <id>1477177</id>
    <category_id>3416</category_id>
    <subscribers_count>23651</subscribers_count>
    <display_on_survey>1</display_on_survey>
    <test_segment>1</test_segment>
    </item>
    </static_segments>
    </responseData>
    <responseNum>1</responseNum>
    </item>
    </methodResponse>

    Example Error

    <methodResponse>
    <item>
    <methodName>account.getStaticSegments</methodName>
    <responseCode>171</responseCode>
    <responseText>Offset exceeds number of static segments</responseText>
    <responseData></responseData>
    <responseNum>1</responseNum>
    </item>
    </methodResponse>


    Was this article helpful?