ericcj/amz_sp_api

Is it possible to use Notifications API: createDestination?

Opened this issue · 1 comments

I see it in the read me for Notifications API, but, as this call is grantless, can it actually be called as it is described?

I am trying this:

api_instance = AmzSpApi::NotificationsApiModel::NotificationsApi.new

options = {
  name:                   "test-spapi-queue-001",
  resource_specification: {
    sqs: "arn:aws:sqs:us-east-1:myacct:test-spapi-queue"
  }
}

body = AmzSpApi::NotificationsApiModel::CreateDestinationRequest.new(options)
result = api_instance.create_destination(body, 'x-amz-access-token' => get_lwa_access_token)

The response I get is:

ETHON: performed EASY effective_url=https://api.amazon.com/auth/o2/token response_code=200 return_code=ok total_time=0.457774
ETHON: performed EASY effective_url=https://sellingpartnerapi-na.amazon.com/https:/sellingpartnerapi-na.amazon.com/notifications/v1/destinations response_code=403 return_code=ok total_time=0.180755
gems/amz_sp_api-84cd2dfc1398/lib/notifications-api-model/api_client.rb:64:in `call_api': Error message: the server returns an error (AmzSpApi::NotificationsApiModel::ApiError)
HTTP status code: 403
Response headers: {"date"=>"Fri, 24 Feb 2023 16:11:39 GMT", "content-type"=>"application/json", "content-length"=>"135", "x-amzn-requestid"=>"aaaaaa", "x-amzn-errortype"=>"MissingAuthenticationTokenException", "x-amz-apigw-id"=>"aaaaaaa="}
Response body: {
  "errors": [
    {
      "message": "Access to requested resource is denied.",
     "code": "MissingAuthenticationToken"
    }
  ]
}

I have also tried doing what I do for all other calls, which is creating a custom client for the seller id, but I think that is not needed in this case.

I can get the call working from Postman.

ericcj commented

there was some work on supporting grantless operations here i'd love to get something merged for it #18