map_ad_attribute
Set where ONE of an ad's output attributes gets its value — the write half of solving the attribute form. Target the output attribute by code (from get_ad_attributes). Set platform_code to a source attribute (from list_source_attributes) to map it, and/or constant for a fixed value; default_platform_code / default_constant are the fallback used when the primary source is empty. For an IDENTIFIER (sku, gtin/ean/barcode, mpn), first confirm the chosen source is actually populated across the catalog (get_project_profile eanFillRate; page preview_products) — mapping or requiring an identifier the products lack yields an empty, non-functional integration. rule_id attaches an Attribute Rule (from list_rules / create_rule) — the value is then computed by that rule; send rule_id:"" to detach it, and rule_enabled:false to attach it disabled. To re-enable an attached-but-disabled rule, send rule_enabled:true (with or without its rule_id, from get_ad_attributes). rule_enabled on its own applies to whatever rule is already attached; with none attached it is rejected as unknown_rule. Provide at least one field (send an empty string to clear a text field). rule_id together with platform_code/constant in the same call is contradictory and is rejected. Setting a source (platform_code/constant) on an attribute that currently has a rule DETACHES that rule (mutually exclusive; changed then includes rule_id). SAVE + REBUILD: the mapping is written to the integration and its built feed is rebuilt immediately, but reaching the ad platform still needs a re-export/submit — call repair_ad or run_ad_operation (submit_all) afterwards (auto-pilot ads re-export on their next sync). Map only attributes returned by get_ad_attributes; hidden ones are internal and cannot be mapped by regular users. Returns {integrationId, code, status, changed:[...], reason, rebuilt}; status is 'updated' | 'no_changes' | 'rejected' (reason: unknown_attribute | unknown_source_attribute | value_not_allowed | unknown_rule). Category-specific attributes are mapped here too, the same way — but they only exist after a category is mapped, so run refresh_ad_category_attributes first (they then appear in get_ad_attributes). ad_id is from list_ads. project_id is OPTIONAL (inferred for a single-project customer).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| ad_id | Yes | ||
| rule_id | No | ||
| constant | No | ||
| project_id | No | ||
| rule_enabled | No | ||
| platform_code | No | ||
| default_constant | No | ||
| default_platform_code | No |