Selling Partner API Feeds API - amazon-mws

I am using the Feeds API to update inventory using the this link. I am able to perform the Step 1 :- Create a feed document response is
{
"payload":{"encryptionDetails":
{
"standard":"AES","initializationVector":"vHLW3sNN41sEQp1e9wjNSg==",
"key":"oQvgdrwiBbBO3SLf4p81zQuIgROkTDA9Yikv6DvMIcg="
},
"feedDocumentId":"amzn1.tortuga.3.11ef10ee-e839-4a0b-b7a4-dcfbe78900ae.T1OWK0QMT4NDF7",
"url":"https://tortuga-prod-eu.s3-eu-west-1.amazonaws.com/%2FNinetyDays/amzn1.tortuga.3.11ef10ee-e839-4a0b-b7a4-dcfbe78900ae.T1OWK0QMT4NDF7?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20210117T190852Z&X-Amz-SignedHeaders=&X-Amz-Expires=300&X-Amz-Credential=&X-Amz-Signature="
}
}
At Step 2 Encrypt and upload the feed data Response :-
SignatureDoesNotMatch
The request signature we calculated does not match the signature you provided. Check your key and signing method.XXXXXXXXXXXXXXXXXXXXAWS4-HMAC-SHA256 20210117T190852Z 20210117/eu-west-1/s3/aws4_request 6efdf3105b88a49723fed6068792a6f1a5858196f957e3a52f76e4cee2ccb07e9197ea9212ce444f640080a3df1d628de0bc26d9a0cafea9577fd23d2c1b3fc6 BYTESPUT //NinetyDays/amzn1.tortuga.3.11ef10ee-e839-4a0b-b7a4-dcfbe78900ae.T1OWK0QMT4NDF7 X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=CREDENTIAL&X-Amz-Date=20210117T190852Z&X-Amz-Expires=300&X-Amz-SignedHeaders=content-type%3Bhost content-type:application/json host:tortuga-prod-eu.s3-eu-west-1.amazonaws.com content-type;host UNSIGNED-PAYLOADBYTESEA417EC74F012746CpSqzu64eIWZv0Y7JWoylN5rrCAJzort9+7EGhH0KqaSHknlV+ZYuX76zqv2shr+yFDksDntFNI=
Anybody facing the same problem or any ideas where the problem is

Related

Firebase GET request orderby 400 bad request

For a get request, I am trying to user order by like below but always get a 400 bad request. Here, multiple users can have multiple blog posts each with a unique id like b1 in screenshot below. The long sequence of characters is the uid of a user under blogs. Each user has their own uid.
https://assignment-c3557-default-rtdb.asia-southeast1.firebasedatabase.app/blogs.json?orderBy="createdAt"
I followed the documentation here
https://firebase.google.com/docs/database/rest/retrieve-data
All I am doing is issuing a simple GET request in react js as follows:
const resp = await fetch(`https://assignment-c3557-default-rtdb.asia-southeast1.firebasedatabase.app/blogs.json?orderBy="createdAt"``)
const data = await resp.json()
if(!resp.ok) { ... }
Below is the database single entry for schema reference
As I said in my previous comment, this URL is invalid:
https://assignment-c3557-default-rtdb.asia-southeast1.firebasedatabase.app/blogs.json/orderBy="createdAt"
                                                                                     ^
The query portion of a URL starts with a ? character.
https://assignment-c3557-default-rtdb.asia-southeast1.firebasedatabase.app/blogs.json?orderBy="createdAt"
                                                                                     ^
Firebase Realtime Database - Adding query to Axios GET request?
I followed the above similar issue resolution to solve my problem

aws - should I integrate s3 upload and store s3 url in dynamodb in one single request?

I have a Table called "Banner".
I have a banner upload function in my UI.
Aws Api gateway is used.
2 resources are created in api gateway,which are /s3 and /banner
I am using 2 separate requests to do this.
1.POST request, resource: /s3
This request runs below lambda function, to upload the banner image to s3
UploadBannerToS3.js
...
const s3 = new AWS.S3();
...
const data = await s3.upload(params).promise();
...
This returns a s3 url storing the banner(as image).
2. POST request, resource: /banner
This request take above s3 url as parameter, to store a banner information including the url in dynamodb.
The lambda function will like this.
CreateBanner.js
...
const { url} = JSON.parse(event.body);
const params = {
TableName : "Banner",
Item: {
id: id,
url: url,
createdAt: date,
}
};
...
const data = await documentClient.put(params).promise();
...
In my frontend code(I am using React) will like this.
handleUploadBanner = async (banners) => {
const image = await toBase64(banner);
const payload = { "banner": image }
try {
// request 1
const uploadResponse_S3 = await APIHandler.uploadBannerToS3(payload)
const s3Url = uploadResponse_S3.data.Location;
// request 2
const response = await APIHandler.createBanners({
url: s3Url,
})
console.log(response)
} catch (error) {
console.log(error)
}
}
If only request 1 is successfully sent, while request 2 fail to return successful status, would it be a mess for development?
Should I combine these 2 request in one single lambda function to handle it?
What is the best practise to do so?
If end-user (front-end) wants to have a "synchronized" response from API, so it means we need to design 2 apis as synchronized ones. But it doesn't mean we need to merge them.
If end-user wants to have only the first api response and doesn't care about the second one, we can design the second apis as asynchronized and you can use the pipeline like
a. Lambda 1 -> Performs its logic -> Send a SNS and return to end-user
b. SNS -> SQS -> Lambda 2
The more we design the system as "single responsibility" is the better for development and maintainance.
Thanks,
If only request 1 is successfully sent, while request 2 fail to return
successful status, would it be a mess for development?
Not necessarily. You could come up with a retry function in front-end for simplicity. But it depends because mess it is a very abstract concept. What is the requirement ? It is of vital importance that the requests never fail ? What do you wanna do if they fail ?
Should I combine these 2 request in one single lambda function to
handle it?
Either way is better to keep them small and short. It is how you work with aws lambdas.
But I think if you want more control over the outcome with better fail-over approach.
SQS it is one way of doing, however they are complex for that case. I would configure a trigger from s3 to lambda that way you will only update when the images get successfully updated.
So in summary:
Call Lambda 1 -> Upload s3 ? Successful ?
S3 Triggers Lambda 2
Lambda 2 saves to DB
I would prefer to process both at one lambda for s3 uploading and db storing. It's simpler and reliable to be said it makes sense to abstracting the fail response.
I mean, the app client is mirroring the file item to dynamodb not the s3. So I will assume, whatever it succeed either failed process we don't need to worries for the app getting wrong link. With some scenarios:
succeed upload, succeed db: App client get the correct link
succeed upload, failed db: App client will never get the correct link (no item)
failed upload, failed db: as same to point #2

query data in a airtable database using url

I want to implement URL for search specific data in my base using filterByFormula
below are my link and I got an error and how to resolve that
my url:
api.airtable.com/v0/APPID/Stories?filterByFormula=(FIND(“Car (in robot form) will offer a hug when I am stressed out”,{User want}) &api_key=MYKEY
Error :
{
"error": {
"type": "INVALID_FILTER_BY_FORMULA",
"message": "The formula for filtering records is invalid: Invalid formula. Please check your formula text."
}
}
I tried using postman, please help me.
While querying filtered data from Airtable via API, you don't have to use FIND keyword. You can filter data with simple Airtable formula like structure. For example,
{Email} = 'johnwick#neverdie.com'
Above filter retrieve all the records from the table whose Email is simply johnwick#neverdie.com
To limit number of records retrieve by API maxRecord parameter is available for that. For more info about various parameters please refer my answer here AirTable API Find record by email or official Airtable API Documentation
In your case
API url would be structured like,
api.airtable.com/v0/APPID/Stories?filterByFormula=Car+(in+robot+form)+will+offer+a+hug+when+I+am+stressed+out%3D%22User+want%22&api_key=MYKEY
For more info about Airtable API encoding, check this https://codepen.io/airtable/full/rLKkYB?baseId=app1C5TVoophmmr8M&tableId=tblvILr4aSAYI98oa
Hope this helps!

How to convert via the Coinbase API

Within the Coinbase app one can convert digital currencies (see the image below).
But does one convert via the Coinbase or Coinbase Pro API?
Watching API from coinbase webapp i see what endpoint you need to call:
Have to know base_id of crypto that you want to sell and base_id of crypto want to buy. You can know it by call GET "https://api.coinbase.com/v2/
/assets/prices?base=USD&filter=holdable&resolution=latest" and get from response the "base_id" of your currencies.
Make an order by calling POST "https://api.coinbase.com/v2/trade" with a request body in json like this:
{
'amount': [amount that you want to convert],
'amount_asset': [currency of amount that you want to convert],
'amount_from': 'input',
'source_asset': ["base_id" of crypto that you want to sell],
'target_asset': ["base_id" of crypto that you want to buy]
}
If previous POST "/trade" response code is 201, you have to get the "id" value of response's json and do a commit of your order by calling POST "https://api.coinbase.com/v2/trades/[id of json response of previous https://api.coinbase.com/v2/trade POST"]/commit". If the response code of this POST commit is 201, your exchange is started and if there are not error in coinbase, your conversion is done!

GetFeedSubmissionResult is not Giving data in response

I have tried to call GetFeedSubmissionResult api of Amazon MWS Feed submission. i have one Feedsubmissionid which is successfully gives response in "Amazon MWS Scratchpad"
but
In this when i am passing the feedsubmissionid into this api it gives below response,
Service Response=============================================================================
GetFeedSubmissionResultResponse
GetFeedSubmissionResult ContentMd5 YQtHphFPLIcA4vEOn2guCQ==
ResponseMetadata
RequestId
4f715dcf-9e89-4ad5-b721-5bb1ba6bbafa
ResponseHeaderMetadata: RequestId: 4f715dcf-9e89-4ad5-b721-5bb1ba6bbafa, ResponseContext : H5F8Si8GvjCkIIlV+vqovD1zOzXDQ+i7/xRZB46IM/XgePQAAliUi6NzK7tCrVsHM/fZFLhjQkM 0Tvk46V5dJCSmZr22uad,2LvooKOfZwPK75jMl3gDmvuK1oCUt3JWf9UvVTFfXSIhrMpIxkcjQp/ekS0I2neiRcoh0X14RWs0 na0j6cY9ZQ==, Timestamp: 2016-03-09T06:55:38.418Z
Please provide solution as soon as possible.
I get the result in correct format using CURL. I have call API using CURL and i am getting the response in XML format which is actual response.

Resources