Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Is it possible to use Notifications API: createDestination? #38

Open
philsmy opened this issue Feb 24, 2023 · 1 comment
Open

Is it possible to use Notifications API: createDestination? #38

philsmy opened this issue Feb 24, 2023 · 1 comment

Comments

@philsmy
Copy link

philsmy commented Feb 24, 2023

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
Copy link
Owner

ericcj commented Mar 17, 2023

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants