amz-tools / amazon-sp-api

Amazon Selling Partner API Client
MIT License
238 stars 121 forks source link

How to get raw request for SP API Developer Support? #270

Closed cohlar closed 1 month ago

cohlar commented 9 months ago

Hi,

Amazon's Selling Partner API Developer Support team just asked me for the following in order to help me with a case:

1) Full Request and Response along with headers in .txt format. 2) MarketplaceId: 3) RequestId: 4) TimeStamp:

I was wondering if there is a way to get the raw request somehow? For the rest, your response to issues https://github.com/amz-tools/amazon-sp-api/issues/47 https://github.com/amz-tools/amazon-sp-api/issues/187 https://github.com/amz-tools/amazon-sp-api/issues/255 was quite helpful, thanks for your support!

amz-tools commented 9 months ago

@cohlar For the response, all the information should be available when you use raw_result:true. The only thing you would probably have to log for yourself is the request headers.

cohlar commented 9 months ago

@amz-tools thanks for your response. What I mean by "raw request" is something like this:

PUT /fba/inbound/v0/shipments/shipmentId1/preorder/confirm?MarketplaceId=ATVPDKIKX0DER&NeedByDate=2020-10-10 HTTP/1.1
host: sellingpartnerapi-na.amazon.com
user-agent: My Selling Tool/2.0 (Language=Java/1.8.0.221;
Platform=Windows/10)
x-amz-access-token=Atza|IQEBLjAsAhRmHjNgHpi0U-Dme37rR6CuUpSREXAMPLE
x-amz-date: 20190430T123600Z

Is this exposed by the library anyhow?

lucasrossell commented 2 months ago

I am also wondering how we can find this. Specifically what URL we are attempting to hit. Like above PUT /fba/inbound/v0/shipments/shipmentId1/preorder/confirm?MarketplaceId=ATVPDKIKX0DER&NeedByDate=2020-10-10 HTTP/1.1

amz-tools commented 1 month ago

@cohlar @lucasrossell Just released version 1.1.2 that will log the raw request (method, host, path, headers and optionally body if present) to console if you set debug_log to true.

cohlar commented 1 month ago

@amz-tools thanks for the update, that's awesome. I'm still missing the below types in the current version of the library - this is now the only reason I still use a fork :) image