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
571 stars 730 forks source link

Unable to create a subscription when adding "marketplaceIds" to the payload. #4135

Open ngtuan96lc opened 2 weeks ago

ngtuan96lc commented 2 weeks ago

We have three marketplaces in South America, including the US, CA, and MX. Currently, we just want to receive notifications from the US marketplace. We performed calling SP-API to create it, but I always got the error that looked like this:

{
    "errors": [
        {
            "code": "InvalidInput",
            "message": "Request has missing or invalid parameters and cannot be parsed.",
            "details": "EventFilter Payload {\"marketplaceIds\":[\"ATVPDKIKX0DER\"],\"eventFilterType\":\"ORDER_CHANGE\"} failed to validate for notification type ORDER_CHANGE"
        }
    ]
}

This's cURL:

curl --location 'https://sellingpartnerapi-na.amazon.com/notifications/v1/subscriptions/ORDER_CHANGE' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-amz-access-token: Atza|IwEBIHjH6oj1 ...' \
--header 'Cookie: session-id=142-2150161-1610463; session-id-time=2353226218l; session-token=e3J80rd5pidqbj4 ... ; ubid-main=132-7846095-7891406' \
--data '{
    "destinationId": "e78d72a1-ee4c-45dd-97fa-b173b84539e1",
    "payloadVersion": "1.0",
    "processingDirective": {
        "eventFilter": {
            "eventFilterType": "ORDER_CHANGE",
            "marketplaceIds": [
                "ATVPDKIKX0DER"
            ]
        }
    }
}'

Please help to check the API. We are looking forward to your response. Thanks.

ngtuan96lc commented 2 weeks ago

cc: @mafge @leonardonakagawa

jawheral commented 2 weeks ago

Hi @ngtuan96lc,

Can you also try adding the orderChangesTypes array to the payload and see that fixes the issue? If you are interested in both order change types, try adding both available values to the payload such as:

"orderChangeTypes": [ "OrderStatusChange", "BuyerRequestedChange" ]

I also suggest that you check the ORDER_CHANGE subscription tutorial: https://developer-docs.amazon.com/sp-api/docs/tutorial-subscribe-to-order-change-notification

And use the Notifications API swagger model https://developer-docs.amazon.com/sp-api/docs/notifications-api-v1-model (can be imported to api client such as Postman for example) to run the API and make sure it is not an issue in your current way of formulation the request.

If all this doesn't fix the issue, then please reach out to Developer Support and provide all the request details.

I hope this helps.

Best, Jawer Selling Partner API Solutions Architect

ngtuan96lc commented 2 weeks ago

Hi @jawheral , I've just tried. The result was the same when adding orderChangeTypes. image

ngtuan96lc commented 2 weeks ago

I created a new developer support ticket to get help. Thank you @jawheral