advertUpsert

advertUpsert allows you to both create and update Products (aka Adverts) in Marketplacer

Key Information

Use-Case

The ingestion of products is a critical workflow for all sellers that want to sell on the marketplace. The advertUpsert mutation allows you to manage the creation and update of those products.

Further Points of Note
  • Sellers can both create and update products
  • Operators can only update (existing) products
  • The creation of products is a large topic which is covered in detail here
Availability
  • Operator API: Yes - Limited to updates
  • Seller API: Yes

Example

mutation createNewProduct{
  advertUpsert(
    input: {
      attributes: {
        brandId: "QnJhbmQtNA=="
        taxonId: "VGF4b24tMjgw"
        title: "Namsung Mobile Phone"
        description: "Powerful phone"
        price: "349.99"
        attemptAutoPublish: true
        images: [
          {
            sourceUrl: "https://images.com/mobile.jpg"
          }
        ]
        advertOptionValues: [
          { optionValueId: "T3B0aW9uVmFsdWUtNzM0" }
          { optionValueId: "T3B0aW9uVmFsdWUtNzI4" }
          { optionValueId: "T3B0aW9uVmFsdWUtNzI5" }
          { optionTypeId: "T3B0aW9uVHlwZS0yNTA=", textValue: "Snapdragon 8+"}
        ]
        variants: [
         {
            countOnHand: 1000
            variantOptionValues: [
              { optionValueId: "T3B0aW9uVmFsdWUtNzMx" }
              { optionValueId: "T3B0aW9uVmFsdWUtNzIz" }
              { optionValueId: "T3B0aW9uVmFsdWUtNzI0" }
              { optionTypeId: "T3B0aW9uVHlwZS0yNTI=", textValue: "Screaming Orange"}
            ]
          }
        ]
      }
    }
  ) {
    status
    advert {
      id
      legacyId
    }
    errors {
      field
      messages
    }
  }
}

Arguments

NameType
inputAdvertUpsertMutationInput

Response

Returns AdvertsUpsertMutationPayload


Error Responses

HTTP ErrorError MessageMeaning
401UnauthorizedYou don’t have access to the endpoint, likely Basic Authentication credentials are missing
401API Token has expiredYou don’t have access to the endpoint, likely that you are either not supplying an API Key, or the key you are supplying is invalid
200Unable to retrieve attachment: https://unreachable url/mobile.jpg (Net::OpenTimeout)You have provided a URL link to an image that is not resolvable by the Marketplacer GraphQL API
200ImageInput must be supplied exactly one of (dataBase64 AND filename) OR sourceUrl OR imageId"When supplying images you need to supply either:
1. An accessible url to the image
2. Base64 Encoded string AND a filename
3. The image id of an existing image.
If any of these conditions are not met then you will experience this error
200title must be filled inThe title field must be supplied
200description must be filled inThe description field must be supplied
200Invalid input: "VGF4b24tMjgwss\You have provided and non Base64 encoded Id value for the identified field - Marketplacer Id values (for fields like taxonId, brandId, optionValueId etc. ) must be valid base 64 encoded strings for those object types
200Argument ‘countOnHand’ on InputObject ‘VariantInput’ has an invalid value (n). Expected type ‘Int’.You have supplied the wrong datatype for the countOnHand field

Further Reading