## Update Campaign `print_mail.campaigns.update(strid, CampaignUpdateParams**kwargs) -> Campaign` **post** `/print-mail/v1/campaigns/{id}` Update an existing campaign. Campaigns can only be updated if they are in the `draft` or `changes_required` status. Updating a campaign will trigger reprocessing and set its status back to `drafting`. ### Parameters - `id: str` - `cheque_profile: Optional[str]` The ID of the cheque profile to use. Setting this will remove other profile types. Set to `null` to remove. - `default_sender_contact: Optional[str]` The ID of the default sender contact. Set to `null` to remove. - `description: Optional[str]` An optional description for the campaign. Set to `null` to remove the existing description. - `letter_profile: Optional[str]` The ID of the letter profile to use. Setting this will remove other profile types. Set to `null` to remove. - `mailing_list: Optional[str]` The ID of the mailing list to associate with this campaign. - `metadata: Optional[Dict[str, str]]` Optional key-value data associated with the campaign. Set to `null` to remove existing metadata. - `postcard_profile: Optional[str]` The ID of the postcard profile to use. Setting this will remove other profile types. Set to `null` to remove. - `self_mailer_profile: Optional[str]` The ID of the self-mailer profile to use. Setting this will remove other profile types. Set to `null` to remove. ### Returns - `class Campaign: …` Represents a bulk mail campaign. - `id: str` A unique ID prefixed with campaign_ - `created_at: datetime` The UTC time at which this resource was created. - `created_count: int` The number of orders successfully created for this campaign. - `live: bool` `true` if this is a live mode resource else `false`. - `mailing_list: str` The ID of the mailing list associated with this campaign. - `status: Literal["drafting", "changes_required", "creating_orders", 4 more]` Status of the campaign lifecycle. - `"drafting"` - `"changes_required"` - `"creating_orders"` - `"draft"` - `"ready"` - `"printing"` - `"processed_for_delivery"` - `updated_at: datetime` The UTC time at which this resource was last updated. - `cheque_profile: Optional[str]` The ID of the cheque profile used for this campaign, if applicable. - `default_sender_contact: Optional[str]` The ID of the default sender contact to use for orders if not specified per recipient. - `description: Optional[str]` An optional string describing this resource. Will be visible in the API and the dashboard. - `errors: Optional[List[Error]]` A list of processing errors encountered, if any. Present when status is 'changes_required'. - `message: str` A human-readable message describing the error. - `type: Literal["processing_error", "internal_error"]` Type of error encountered during campaign processing. - `"processing_error"` - `"internal_error"` - `letter_profile: Optional[str]` The ID of the letter profile used for this campaign, if applicable. - `metadata: Optional[Dict[str, object]]` See the section on Metadata. - `order_preview_url: Optional[str]` A temporary URL to preview the first rendered order, available once the campaign status is 'draft' or later. - `postcard_profile: Optional[str]` The ID of the postcard profile used for this campaign, if applicable. - `report_url: Optional[str]` A temporary URL to download the processing report, available once the campaign is in the `ready` status. - `self_mailer_profile: Optional[str]` The ID of the self-mailer profile used for this campaign, if applicable. - `send_date: Optional[datetime]` The scheduled date and time for the campaign to be sent. ### Example ```python 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 ) campaign = client.print_mail.campaigns.update( id="id", ) print(campaign.id) ``` #### Response ```json { "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" } ```