Listings

Compare desired and observed

Shows, per group, what changed here and what changed on the marketplace.

GET
/v1/listings/{listingId}/diff

Shows what is left to publish and what changed on the marketplace, one group at a time. Use it before publishing or after a listing.external_changed notice. The route only reads what MarketAPI already stores: it does not call the marketplace.

curl "$BACKEND_URL/v1/listings/<listingId>/diff" \
  -H "Authorization: Bearer mk_your_api_key"

The response always has the five groups, in this order: content and catalog (from the MarketplaceProduct), offer, inventory and status (from the offer). One group, shortened:

{
  "group": "offer",
  "state": "pending_publication",
  "changedPaths": ["priceInCents"],
  "desired": { "priceInCents": 489900, "currency": "BRL" },
  "observed": { "priceInCents": 499900, "currency": "BRL" }
}

How to read state

desired and observed almost always differ: the marketplace adds fields you never sent. So each side is compared with what the last publication confirmed. Only what changed since then counts.

stateMeansWhat it asks of you
in_syncNeither side changed since the last publication.Nothing.
pending_publicationYou changed it here and have not published yet.Publish.
external_changeIt changed on the marketplace and you did not touch this group.Decide: copy the observed value into desired, or publish to impose yours.
conflictBoth sides changed, or there is an open conflict on the group.Resolve the conflict.
never_publishedThe group was never published: there is no base to compare with.Publish.

Watch out

  • Only content and offer become conflict. In catalog and inventory, with both sides changed, the state is pending_publication: the next publication sends your value. Inventory comes from your balance; to undo a change made there, resend the stock.
  • status has no desired value (desired is null). It only goes to external_change when the marketplace changes the status. The reason is in issues.
  • changedPaths lists only what you set and that differs from observed: the keys of the value and, inside it, attributes.<key> (in content) and lines.<identity> (in inventory).
  • conflict in content or offer always has a record in conflicts to resolve, whoever moved first: the outside change arriving with your edit pending, or your edit arriving after the outside change.

How it fits: Stay in sync.

Authorization

api_key
headerAuthorizationBearer <token>

API key (mk_...)

Path Parameters

listingId*string
Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid

Response Body

The five groups, always in the same order.

application/json
  1. response

The offer compared with the marketplace, group by group. Calculated on read; it does not call the marketplace.

listingId*string

The listing compared.

Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid
marketplaceProductId*string

The marketplace product whose content and catalog are compared.

Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid
groups*array<>

One entry per group, always in this order: content, catalog, offer, inventory, status.

curl -X GET "https://example.com/v1/listings/497f6eca-6276-4993-bfeb-53cbbbba6f08/diff"
{  "listingId": "0e2ce906-a6ab-4101-9461-4168c8b6b902",  "marketplaceProductId": "8a6f0c55-6a1e-4c55-9b0a-3b1f2d9e4c10",  "groups": [    {      "group": "content",      "state": "in_sync",      "changedPaths": [],      "desired": {        "title": "iPhone 16",        "brand": "Apple"      },      "observed": {        "title": "iPhone 16",        "brand": "Apple"      }    },    {      "group": "catalog",      "state": "in_sync",      "changedPaths": [],      "desired": null,      "observed": null    },    {      "group": "offer",      "state": "pending_publication",      "changedPaths": [        "priceInCents"      ],      "desired": {        "priceInCents": 489900,        "currency": "BRL"      },      "observed": {        "priceInCents": 499900,        "currency": "BRL"      }    },    {      "group": "inventory",      "state": "in_sync",      "changedPaths": [],      "desired": {        "lines": {          "MLB123": 7        }      },      "observed": {        "lines": {          "MLB123": 7        }      }    },    {      "group": "status",      "state": "in_sync",      "changedPaths": [],      "desired": null,      "observed": {        "marketplaceStatus": "active",        "buyable": true      }    }  ]}