amzn / selling-partner-api-models

This repository contains OpenAPI models for developers to use when developing software to call Selling Partner APIs.
Apache License 2.0
612 stars 739 forks source link

Read Shipping Templates with SP-API? #1522

Closed PasswebPass closed 3 years ago

PasswebPass commented 3 years ago

Is it possible to read the list of shipping templates with the SP-API?

2021-06-23_12-47-14

chapmanjw commented 3 years ago

Hi @PasswebPass, we do not currently have an API for the shipping settings for a seller. This is definitely a feature we would like to implement in the future.

In the meantime, there is one roundabout way you could retrieve this information programmatically. The Product Type Definitions API provided JSON Schemas describing the requirements to list an item for a given seller. If you provide the sellerId value (i.e. with the merchant id), it will include seller-specific values like the names of the shipping templates as enumeration values.

For example, if you call the API like this:

GET https://sellingpartnerapi-na.amazon.com/definitions/2020-09-01/productTypes/PRODUCT
    ?marketplaceIds=ATVPDKIKX0DER
        &sellerId=<INSERT MERCHANT ID>
    &requirements=LISTING_OFFER_ONLY
    &locale=en_US

You will get a link to a JSON Schema containing the "offer only" listing requirements unique to the seller id provided.

For the merchant_shipping_group attribute, you will see the enum and enumName values populated for the given seller. For example:

            "enum": [
              "bcf2a0ca-a487-403a-a1c0-a9c7bbfaaaa2",
              "legacy-template-id"
            ],
            "enumNames": [
              "Migrated Template-Copy",
              "Migrated Template"
            ],
    "merchant_shipping_group": {
      "$comment": "Sellers can create a set of ship configurations  based on business needs and use cases. The ship configurations can be region based and have rules to set SLA and rate for the region. When listing product to create offer, seller needs to select one ship configuration for the product. The ship configuration will be used to retrieve the valid ship options on the website.",
      "title": "Merchant Shipping Group",
      "description": "The ship configuration group for an offer. The ship configuration group is created and managed by the seller through the ship setting UI.",
      "examples": [
        "\"Heavy Bulky Products\", \"CN ShunFeng Delivery\""
      ],
      "type": "array",
      "minItems": 1,
      "minUniqueItems": 1,
      "maxUniqueItems": 1,
      "selectors": [
        "marketplace_id"
      ],
      "items": {
        "type": "object",
        "required": [
          "marketplace_id",
          "value"
        ],
        "properties": {
          "value": {
            "$comment": "The ship configuration group for an offer. The ship configuration group is created and managed by the seller through the ship setting UI.",
            "title": "Merchant Shipping Group",
            "description": "The ship configuration group for an offer. The ship configuration group is created and managed by the seller through the ship setting UI.",
            "editable": true,
            "hidden": false,
            "examples": [
              "Heavy Bulky Products, NCR Large Appliance Delivery"
            ],
            "type": "string",
            "enum": [
              "bcf2a0ca-a487-403a-a1c0-a9c7bbfaaaa2",
              "legacy-template-id"
            ],
            "enumNames": [
              "Migrated Template-Copy",
              "Migrated Template"
            ],
            "maxLength": 100
          },
          "marketplace_id": {
            "$ref": "#/$defs/marketplace_id"
          }
        },
        "additionalProperties": false
      }
    }

While this is not a shipping settings API, it does provide you a mechanism to get this information in the meantime.

PasswebPass commented 3 years ago

Hi, @chapmanjw, I checked what you wrote to me and it works. It would be better if the SP-API developers implemented a direct call to the shipping method list. thank you

chapmanjw commented 3 years ago

@PasswebPass As one of those developers, I agree. We have this on our list of listings-related feature gaps that we need to fill (vs. what you can do on Seller Central). While I can't speak to specific timelines, etc., this feature is on our radar. Thanks for the feedback!

yizeku commented 2 years ago

Hello @chapmanjw,

Is there no way to get the shipping template?

GET https://sellingpartnerapi-na.amazon.com/definitions/2020-09-01/productTypes/PRODUCT ?marketplaceIds=ATVPDKIKX0DER &sellerId= &requirements=LISTING_OFFER_ONLY &locale=en_US

I use this method to exclude the _merchant_shippinggroup field.

Do you know the reason for this?

Thank you!