update_campaign_asset
¶
update_campaign_asset(
catalog: Catalog,
campaign_identifier: CampaignIdentifier,
campaign_asset_identifier: CampaignAssetId,
*,
config_overrides: Optional[PartnerCentralMarketingClientConfig] = None,
field_values: Optional[FieldValueInputList] = None,
layout: Optional[LayoutOptionValue] = None,
send_mode: Optional[SendMode] = None,
scheduled_send_at: Optional[Timestamp] = None,
client_token: Optional[ClientToken] = None,
) -> UpdateCampaignAssetResponse
Updates an asset's field values, layout or send time. Refused with ConflictException while the campaign's running activation task still owns the asset (ASSET_START_IN_PROGRESS), and for a live email or social post (ASSET_ALREADY_ACTIVE): deactivate it first.
Args:
catalog: The catalog (AWS or Sandbox).
campaign_identifier: The campaign identifier.
campaign_asset_identifier: The asset identifier.
field_values: Value-only updates to the asset's pinned template fields, keyed by FieldId. The field schema (labels, descriptions, constraints, placeholders, image defaults) is service-owned and pinned at instantiation, so clients send only the values they are changing. Fields omitted keep their stored values; send the entry with `Value` omitted to clear one. Named `FieldValues` to match the member it edits on `CampaignAsset`, which is the same concept read back. It was `templateFieldUpdates`; the two names for one concept were the defect, not the length.
layout: Selects a multi-layout asset's layout: one of the values in `CampaignAsset.layout.options`. PATCH: omitted leaves the selection unchanged, and there is no way to clear it. A value that is not one of the asset's options — or any value on a single-layout asset — is a plain `ValidationException`, and nothing in the call is applied. Every pinned field stays writable whichever layout is selected.
send_mode: When a **sendable** asset (`EMAIL`, `SOCIAL_POST`) sends: on activation, or at `ScheduledSendAt`. A mode beside a value rather than a union, on purpose: `ScheduledSendAt` stays a plain `Timestamp`, and the precedent is EventBridge Scheduler's `FlexibleTimeWindow { Mode, MaximumWindowInMinutes }`. The pair is checked as one, and a request where they disagree is refused with `ValidationException` (`INVALID_VALUE`, naming the member) and applies nothing: - `SCHEDULED` requires `ScheduledSendAt`; a reschedule resends `SCHEDULED` with the new time; - `ON_ACTIVATION` forbids `ScheduledSendAt`, and drops any time already stored; - `ScheduledSendAt` without `SendMode` is refused. PATCH: omitted leaves both unchanged. Until a mode is chosen the asset reports `SEND_MODE_MISSING` and does not activate: no default, because an unchosen send mails the real audience. Rejected with `ValidationException` (`NOT_SUPPORTED_FOR_CATEGORY`) for a category that has no send (`LANDING_PAGE`, `DOCUMENT`, `BANNER_AD`). Like every other edit, it reaches the delivery platform at the asset's next activation, and a live email or social post refuses it (`ASSET_ALREADY_ACTIVE`): deactivate first.
scheduled_send_at: The send time, with `SendMode: SCHEDULED` and only then. See `SendMode`. Must be at least an hour out (`SEND_WINDOW_TOO_SOON`), unless it is the time already stored: resending the stored mode and time changes nothing and is accepted, so a form that always resubmits does not trip the window. Must also fall on or before the campaign's `EndOn` (by the end of that UTC day): refused with `ValidationException` (`INVALID_VALUE`) otherwise, so nothing is scheduled to send after the campaign completes. Was `scheduleDate`, a `YYYY-MM-DD` string. Retyped because a date alone cannot express a send *time*, which is the whole point of a schedule — and because the resource already spelled the same concept `ScheduledSendAt` on the activation responses. Two spellings of one concept on one resource was the defect.
client_token: Idempotency token. Retry-safety only — this is **not** a concurrency token, and sequential edits to one field are last-writer-wins.
Raises:
capo_partnercentral_marketing.errors.access_denied_exception.AccessDeniedException: You do not have sufficient access to perform this action. An IAM denial carries no `Reason`. A refusal for the caller's Partner Central state carries one, so a client tells the two apart by its presence.
capo_partnercentral_marketing.errors.internal_server_exception.InternalServerException: An unexpected error occurred during the processing of the request.
capo_partnercentral_marketing.errors.throttling_exception.ThrottlingException: The request was denied due to request throttling.
capo_partnercentral_marketing.errors.validation_exception.ValidationException: The input fails to satisfy the constraints specified by the service. A caller branches on `Reason`, and where the rejection is attributable to particular fields it reads `FieldList` rather than parsing `Message`, which is prose and may change.
capo_partnercentral_marketing.errors.conflict_exception.ConflictException: The request conflicts with the current state of the resource.
capo_partnercentral_marketing.errors.resource_not_found_exception.ResourceNotFoundException: The specified resource does not exist.
capo_partnercentral_marketing.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
Update asset content
>>> client.update_campaign_asset(catalog='AWS', campaign_identifier='camp-5Hq2m8x4k1p9w', campaign_asset_identifier='ast-4b81e0c9f2a7b', field_values=[{'FieldId': 'Subject', 'Value': {'Text': 'New subject line'}}])
Reschedule a sendable asset
>>> client.update_campaign_asset(catalog='AWS', campaign_identifier='camp-5Hq2m8x4k1p9w', campaign_asset_identifier='ast-4b81e0c9f2a7b', send_mode='SCHEDULED', scheduled_send_at=1793491200, client_token='f2a7c1e4-9b3d-4a51-8e6f-0c2d5b8a7e13')
Copy an image from a previous campaign's asset
The image already stored on another of your assets is copied into this field. It is checked
against this field's constraints and not scanned again. The call also needs partnercentral:GetCampaignAsset on the source campaign.
>>> client.update_campaign_asset(catalog='AWS', campaign_identifier='camp-5Hq2m8x4k1p9w', campaign_asset_identifier='ast-4b81e0c9f2a7b', field_values=[{'FieldId': 'HeaderImage', 'Value': {'CampaignAssetImage': {'CampaignIdentifier': 'camp-2Lp7d9f3j6s1z', 'CampaignAssetIdentifier': 'ast-0f9e8d7c6b5a2', 'FieldId': 'HeaderImage'}}}])
Use a suggested image from Build with AI
The URL Build with AI returned for a suggested image is sent unchanged as imageReference. The
image is copied into this asset and not scanned. Any other URL is refused.
>>> client.update_campaign_asset(catalog='AWS', campaign_identifier='camp-5Hq2m8x4k1p9w', campaign_asset_identifier='ast-4b81e0c9f2a7b', field_values=[{'FieldId': 'HeaderImage', 'Value': {'ImageReference': 'https://d111111abcdef8.cloudfront.net/suggested-image-url-from-build-with-ai.jpg'}}])
An update refused for two fields at once
Every failed field is reported in one refusal, and nothing applies — a declined image and an
over-long headline arrive together in fieldList, each with its own code. This replaced a
read-path fileDetails[] report (DG-040 Decision 11), so a partner handles image and text
failures the same way.
>>> client.update_campaign_asset(catalog='AWS', campaign_identifier='camp-5Hq2m8x4k1p9w', campaign_asset_identifier='ast-4b81e0c9f2a7b', field_values=[{'FieldId': 'HeaderImage', 'Value': {'ImageReference': 's3://staging-bucket/123456789012/hero.png?versionId=v1'}}, {'FieldId': 'Headline', 'Value': {'Text': 'This headline is far longer than the field allows'}}])
Source code in docs_src/capo_partnercentral_marketing/_services/partner_central_marketing.py
2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 | |