Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Support for Restricted Operations #10

Closed
alexisagos opened this issue Sep 13, 2021 · 5 comments
Closed

Support for Restricted Operations #10

alexisagos opened this issue Sep 13, 2021 · 5 comments

Comments

@alexisagos
Copy link

Certain operations require a Restricted Data Token (RDT):
https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/use-case-guides/tokens-api-use-case-guide/tokens-API-use-case-guide-2021-03-01.md#restricted-operations

Is there a way to include a RDT instead of a LWA access token in the x-amz-access-token header ?

@ericcj
Copy link
Owner

ericcj commented Oct 7, 2022

There is not currently but would welcome a contribution

@condit
Copy link

condit commented Jan 7, 2023

After fetching an RDT, you can pass an options hash to get_order() to do that. This works for me:

api_tokens = AmzSpApi::TokensApiModel::TokensApi.new(client)
body = {
  'restrictedResources' => [
    {
      'method' => 'GET',
      'path' => "/orders/v0/orders/#{my_order_id}",
      'dataElements' => ['buyerInfo', 'shippingAddress']
    }
  ]
}
response = api_tokens.create_restricted_data_token(body)
my_rdt = response.restricted_data_token
api_orders = AmzSpApi::OrdersApiModel::OrdersV0Api.new(client)
order = api_orders.get_order(my_order_id, {header_params: {'x-amz-access-token' => my_rdt}})
puts order.pretty_inspect

@jheathco
Copy link
Contributor

Do you still need to request permission for generating RDT's even for your own application (not for public facing apps)?

@daapower
Copy link

daapower commented May 1, 2023

After fetching an RDT, you can pass an options hash to get_order() to do that. This works for me:

api_tokens = AmzSpApi::TokensApiModel::TokensApi.new(client)
body = {
  'restrictedResources' => [
    {
      'method' => 'GET',
      'path' => "/orders/v0/orders/#{my_order_id}",
      'dataElements' => ['buyerInfo', 'shippingAddress']
    }
  ]
}
response = api_tokens.create_restricted_data_token(body)
my_rdt = response.restricted_data_token
api_orders = AmzSpApi::OrdersApiModel::OrdersV0Api.new(client)
order = api_orders.get_order(my_order_id, {header_params: {'x-amz-access-token' => my_rdt}})
puts order.pretty_inspect

I confirm this works, thank you

@ericcj
Copy link
Owner

ericcj commented Oct 19, 2023

i did this in #55

@ericcj ericcj closed this as completed Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants