> For the complete documentation index, see [llms.txt](https://apidocs.akinon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.akinon.com/commerce-openapis/admin/google-merchant-attribute-mapper.md).

# Google Merchant Attribute Mapper

Administrative endpoints for **Google Merchant attribute mappers** — the rules that decide how each field of a Google Merchant Center product feed is computed from a source product. Each record maps one output field (`output_key`, e.g. `title`, `gtin`, `google_product_category`) to an ordered set of rules that read from the product and produce that field's value when the feed is generated.

A mapper can be tied to a single feed adapter or left global (no adapter), and the pair `(output_key, feed_adapter)` must be unique.

### Core Capabilities

**1. Listing & Filtering**

* Retrieve a paginated list of attribute mappers.
* Filter by the feed adapter they belong to with `?feed_adapter=<id>`.
* Order results with the `sort` parameter, as described under **Filtering & Ordering**.

**2. Full CRUD**

* Create a mapper that binds an `output_key` to a `rule_set`, optionally scoped to a feed adapter.
* Retrieve a single mapper, either directly or through the `/{id}/detailed/` alias, which returns the same representation.
* Fully or partially update a mapper.
* Delete a mapper. `DELETE` is a **hard delete** — the record is removed.

### Mapper Fields

| Field          | Type    | Description                                                                                                                                                               |
| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`           | integer | The unique identifier of the mapper. Assigned by the server; supplying it in a request body has no effect.                                                                |
| `output_key`   | string  | The name of the feed field this mapper produces (e.g. `title`, `gtin`). Required on create and full update. Up to 255 characters and non-blank.                           |
| `rule_set`     | array   | The ordered list of rules used to compute the field's value at feed-generation time. Required on create and full update — send at least an empty array. See **Rule Set**. |
| `feed_adapter` | integer | The identifier of the feed adapter this mapper is scoped to, or `null` for a global mapper. Optional.                                                                     |

### Rule Set

`rule_set` is a JSON array evaluated top-down when the feed is built: the first rule whose condition matches produces the output value. Each element pairs a **rule** (the condition) with an **action** (how the value is produced), plus optional shared arguments:

```json
{
  "shared_kwargs": { },
  "rule":   { "rule_type": "<rule>", "rule_kwargs": { } },
  "action": { "action_type": "<action>", "action_kwargs": { } }
}
```

| Part          | Accepted values                                                             |
| ------------- | --------------------------------------------------------------------------- |
| `rule_type`   | `query`, `always`, `in_dict`, `attributeexists`, `multiattributeexists`     |
| `action_type` | `stdout`, `attrgetter`, `outputdict`, `attrformatter`, `multiattrformatter` |

> **Note:** The contents of `rule_set` are **not validated** when the mapper is written. A malformed rule is accepted here and is simply skipped later, at feed-generation time.

### Filtering & Ordering

The list endpoint accepts a single filter, `feed_adapter`, which matches the adapter identifier exactly. Query parameters that are not listed are ignored rather than rejected. Results can be ordered with the `sort` parameter on the mapper's own fields (`id`, `output_key`, `feed_adapter`); prefix a field with a hyphen for descending order and separate several fields with commas.

### Dynamic Settings & Environment Variables

No dynamic settings (`dj_dynamic_settings`) and no environment variables are read by these endpoints. Listing, filtering, creation, update, and deletion behave identically regardless of how the management panel or the deployment is configured.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://apidocs.akinon.com/commerce-openapis/admin/google-merchant-attribute-mapper.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
