Help Documentation 〉API 〉

/projects/:document_identifier/address-groups

This resource supports the GET and POST methods.

URL Parameters

Label Description
:document_identifier The project's document identifier

GET

Returns an array of all the address groups in the project.

GET Request Query String Parameters

Name Required Description
fields No A comma-separated list of the keys you want returned for each group. Default is to return all keys.

GET Response Status Codes

Code Description
503 Service Unavailable Server is undergoing maintenance and is unavailable
429 Rate Limited Rate limiting in effect, try again later
404 Not Found The resource could not be found or your API key has not been granted access to it
403 Forbidden Direct Mail account is disabled
401 Unauthorized API key, secret, or authentication method is incorrect
200 OK Success

GET Response Headers

Name Description
X-Total-Count The total number of address groups in the project

GET Response Body

JSON representation of an array of objects. Each object in the array represents an address group from the project. Please consult the /projects/:document_identifier/address-groups/:address_group_uuid resource for a description of the object keys for each address group.

GET Example

GET /api/v2/projects/187812f26ba37d9769d8691d2a83c95c/address-groups HTTP/1.1
Authorization: Basic QzFENDREMjEtNTA4MC00NTM3LUFFOD
Accept: application/json; charset=utf-8
Host: secure.directmailmac.com

HTTP/1.1 200 OK
Date: Wed, 22 Apr 2015 21:59:55 GMT
Content-Type: application/json; charset=utf-8
X-Total-Count: 1

[
    {
        "blacklist": false,
        "date_created": "2015-04-22T16:35:27+0000",
        "links": [
            {
                "href": "https://secure.directmailmac.com/api/v2/projects/187812f26ba37d9769d8691d2a83c95c/address-groups/547ADAA7-0DBC-43B5-913B-AE05EC621284",
                "rel": "self"
            },
            {
                "href": "https://secure.directmailmac.com/api/v2/projects/187812f26ba37d9769d8691d2a83c95c/address-groups/547ADAA7-0DBC-43B5-913B-AE05EC621284/addresses",
                "rel": "addresses"
            }
        ],
        "name": "Mailing List",
        "number_of_addresses": 2,
        "uuid": "547ADAA7-0DBC-43B5-913B-AE05EC621284"
    }
]

POST

Adds a new address group to the project.

POST Request Body

A JSON object representing the message.

Key Required Value Description
name Yes String The name of the group
blacklist No Boolean True if the group is blacklist. Defaults to false.

POST Response Status Codes

Code Description
503 Service Unavailable Server is undergoing maintenance and is unavailable
429 Rate Limited Rate limiting in effect, try again later
404 Not Found The project could not be found
403 Forbidden Direct Mail account is disabled
401 Unauthorized API key, secret, or authentication method is incorrect
400 Bad Request One or more of the values in the request body is invalid
202 Accepted The request has been accepted for processing

POST Response Body

A JSON object representing the merge task.

Key Value Description
links Array of Object URLs for the merge task and the inserted resource.

POST Example

POST /api/v2/projects/187812f26ba37d9769d8691d2a83c95c/address-groups HTTP/1.1
Authorization: Basic QzFENDREMjEtNTA4MC00NTM3LUFFOD
Content-Type: application/json; charset=utf-8
Host: secure.directmailmac.com
Content-Length: 27

{
    "name": "API Mailing List"
}

HTTP/1.1 202 Accepted
Date: Wed, 22 Apr 2015 22:01:58 GMT
Content-Type: application/json; charset=utf-8

{
    "links": [
        {
            "href": "https://secure.directmailmac.com/api/v2/projects/187812f26ba37d9769d8691d2a83c95c/merge-task?s=42&m=POST&r=https%3A%2F%2Fsecure.directmailmac.com%2Fapi%2Fv2%2Fprojects%2F187812f26ba37d9769d8691d2a83c95c%2Faddress-groups%2FD817956C-91D3-4536-BE0B-B60ECD161909",
            "rel": "merge-task"
        },
        {
            "href": "https://secure.directmailmac.com/api/v2/projects/187812f26ba37d9769d8691d2a83c95c/address-groups/D817956C-91D3-4536-BE0B-B60ECD161909",
            "rel": "resource"
        }
    ]
}

Did you find this article helpful? Yes | No