Welcome‎ > ‎Version 2‎ > ‎Publisher Api (Read/Write)‎ > ‎Methods‎ > ‎5 - Miscellaneous‎ > ‎

Segments


Segments are publisher-defined.  A segment may be a city that a publisher is in, or any other subset of a publisher's audience.  Examples of segments could be los angeles, kids, or golf-lovers.  This method gets the list of all segments.

Method: /api/v2/publisher/segments/

RequiredParameters:
  none

OptionalParameters:
  none

Returns:
  List of Segment

Sample Request:
GET /api/v2/publisher/segments HTTP/1.1

Authorization: OAuth oauth_signature="%2f9wyX3WdWLVMPhhmVW0mJfGjnyc%3d", oauth_nonce="7308826", oauth_timestamp="1304126171", oauth_consumer_key="43c5c674-620c-4f2b-bdcf-3082c99e8186", oauth_signature_method="HMAC-SHA1", oauth_version="1.0"

Host: apitest.groupcommerce.com


Sample XML Response:
<segments xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <version>2.0</version>
    <success>true</success>
    <lastPublished>2011-02-16T20:16:30.5483579Z</lastPublished>
    <data>
        <segment>
            <active>true</active>
            <latitude>0</latitude>
            <longitude>0</longitude>
            <segmentKey>1</segmentKey>
            <segmentName>National</segmentName>
            <timezone>Eastern Standard Time</timezone>
           
<viewOrder>0</viewOrder>

        </segment>
        <segment>
            <active>false</active>
            <latitude>40.47</latitude>
            <longitude>-73.58</longitude>
            <segmentKey>2</segmentKey>
            <segmentName>New York</segmentName>
            <timezone>Eastern Standard Time</timezone>
            <viewOrder>1</viewOrder>
        </segment>
    </data>
    <metaData>
        <pageCount>1</pageCount>
        <pageNumber>1</pageNumber>
        <pageSize>2</pageSize>
        <totalItems>2</totalItems>
    </metaData>
</segments>


Sample JSON Response:
{
    "version": "2.0",
    "success": true,
    "lastPublished": "/Date(1303335983168)/",
    "data": [
        {
            "active": true,
            "latitude": 0,
            "longitude": 0,
            "segmentKey": "all-cities",
            "segmentName": "All Cities",
            "timezone": "Central Standard Time",
            "viewOrder": 0
        },
        {
            "active": false,
            "latitude": 33.45,
            "longitude": -84.23,
            "segmentKey": "atlanta",
            "segmentName": "Atlanta",
            "timezone": "Eastern Standard Time",
            "viewOrder": 0
        },
        {
            "active": false,
            "latitude": 42.21,
            "longitude": -71.5,
            "segmentKey": "boston",
            "segmentName": "Boston",
            "timezone": "Eastern Standard Time",
            "viewOrder": 0
        },
        {
            "active": false,
            "latitude": 41.5,
            "longitude": -87.37,
            "segmentKey": "chicago",
            "segmentName": "Chicago",
            "timezone": "Central Standard Time",
            "viewOrder": 0
        }
    ],
    "metaData": {
        "pageCount": 1,
        "pageNumber": 1,
        "pageSize": 4,
        "totalItems": 4
    }
}


Comments