List Campaigns
print_mail.campaigns.list(CampaignListParams**kwargs) -> SyncSkipLimit[Campaign]
GET/print-mail/v1/campaigns
Retrieve a list of campaigns.
Returns a paginated list of campaigns associated with the authenticated organization, filterable by various parameters.
Parameters
search: Optional[str]
You can supply any string to help narrow down the list of resources. For example, if you pass "New York" (quoted), it will return resources that have that string present somewhere in their response. Alternatively, you can supply a structured search query. See the documentation on StructuredSearchQuery for more details.
List Campaigns
import os
from postgrid import PostGrid
client = PostGrid(
print_mail_api_key=os.environ.get("POSTGRID_PRINT_MAIL_API_KEY"), # This is the default and can be omitted
)
page = client.print_mail.campaigns.list()
page = page.data[0]
print(page.id){
"data": [
{
"id": "campaign_sqF12lZ1VlBb",
"createdAt": "2019-12-27T18:11:19.117Z",
"createdCount": 0,
"live": true,
"mailingList": "mailingList",
"status": "drafting",
"updatedAt": "2019-12-27T18:11:19.117Z",
"chequeProfile": "chequeProfile",
"defaultSenderContact": "defaultSenderContact",
"description": "description",
"errors": [
{
"message": "message",
"type": "processing_error"
}
],
"letterProfile": "letterProfile",
"metadata": {
"foo": "bar"
},
"orderPreviewURL": "https://example.com",
"postcardProfile": "postcardProfile",
"reportURL": "https://example.com",
"selfMailerProfile": "selfMailerProfile",
"sendDate": "2019-12-27T18:11:19.117Z"
}
],
"limit": 0,
"object": "list",
"skip": 0,
"totalCount": 0
}Returns Examples
{
"data": [
{
"id": "campaign_sqF12lZ1VlBb",
"createdAt": "2019-12-27T18:11:19.117Z",
"createdCount": 0,
"live": true,
"mailingList": "mailingList",
"status": "drafting",
"updatedAt": "2019-12-27T18:11:19.117Z",
"chequeProfile": "chequeProfile",
"defaultSenderContact": "defaultSenderContact",
"description": "description",
"errors": [
{
"message": "message",
"type": "processing_error"
}
],
"letterProfile": "letterProfile",
"metadata": {
"foo": "bar"
},
"orderPreviewURL": "https://example.com",
"postcardProfile": "postcardProfile",
"reportURL": "https://example.com",
"selfMailerProfile": "selfMailerProfile",
"sendDate": "2019-12-27T18:11:19.117Z"
}
],
"limit": 0,
"object": "list",
"skip": 0,
"totalCount": 0
}