setProductVariantExternalRef mutation
setProductVariantExternalRef is a GraphQL mutation of the Chameleoon MAX API. Send it as POST https://max-api.chameleoon.sk/api/v1/graphql with your API key, see Chameleoon MAX.
Records the variant's reference in an external source: the variant's id in that system under the id of its product there, such as an e-shop's variant id or OBERON's card id. Call it when you link a variant in MAX to its record in your system.
A variant has at most one reference per external source. A different externalId or
parentExternalId replaces the variant's earlier reference in that external source. The call writes
no event and no revision of the product.
Permissions
Requires the integration.read, item.read and item.write permissions.
Repeated calls
A repeat with the same externalId, the same parentExternalId and the same number changes
nothing and returns changed: false.
Errors
| Code | Reason | When |
|---|---|---|
NOT_FOUND | The variant does not exist. | |
NOT_FOUND | SOURCE_NOT_FOUND | No external source has the code (field input.source). |
CONFLICT | SOURCE_ARCHIVED | The external source is archived. |
CONFLICT | REF_TAKEN | Another variant holds the externalId in the external source, under any parent. An order line names a variant by its id alone. |
VALIDATION | input.externalId or input.parentExternalId is blank, or one of input.externalId, input.parentExternalId and input.externalNumber is too long. The error names the field. |
The reason is in extensions.reason.
An error whose path runs below this field does not mean the call failed: the reference was recorded, so do not retry. See
Mutation.
Arguments
id:UUID!· requiredinput:ProductVariantExternalRefInput!· required
Returns
ProductVariantExternalRefResult!
Example
Mutation
Code
Variables
Code
Response
Code
Values are illustrative: replace IDs and codes with your own before you send the call.