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

Hardest and Worst API ever #2039

Closed
erginkeles opened this issue Feb 13, 2022 · 20 comments
Closed

Hardest and Worst API ever #2039

erginkeles opened this issue Feb 13, 2022 · 20 comments
Assignees

Comments

@erginkeles
Copy link

I’ve developed more than 10 marketplace integrations and i can easily say that Amazon SP-API is the worst documented and worst developed API by far!

Why is it so hard?

At almost every marketplace integration, to upload a product, you simply do these:

  1. Get API keys.
  2. Get category list.
  3. Get category attributes list and attribute value list.
  4. Generate a json payload with product info and mandatory category attributes&values.
  5. POST the payload to marketplace API.

And at amazon SP-API:
Watch thousands of minutes of videos, do lots of unnecessary meaningless clicks, read the worst documentation content page by page; for what? Just to generate a client id and client secret key.

Ok , i have the keys now. What to do now, just to upload products? I DON’T HAVE A CLUE.

SP-API has a Feeds API. So we should be using it to upload products, right? I think so. But i don’t have an idea, how?

Why do we still deal with XML, for starters? You develop a brand new API called SP-API. And still make us deal with XML?

Ok, let’s deal with XML. But how?

The World of developers have changed the future of API development guys! We have restful API’s now. We work only with endpoints and json today. Why did you publish a new API, you might just publish an update on MWS. What is wrong with you?

And after all this work, i still don’t know how to upload products or update quantity-price. Not to mention about orders or other things.

@thethree
Copy link

I have also integrated 10+ platforms.

  1. I heard we will still need to make a separate call to get the order items, so if I call give me the orders updated since yesterday, and if I have 100 updated orders, I will have to make 101 calls. Is there a query param and by default no order items are sent, and if set to true, returns the order items in the payload, so we don't make 100 unnecessary calls? This will save our CPU time and AMAZON CPU time, win win for both.

  2. The new authentication/authorization flow, with AWS roles, refresh token and restricted data token. I am not a security guy so I cannot comment on how robust the design is, but I think this whole design is way too complicated, I would think a simpler design would achieve the same security result. I would hope someone with security background to comment on this. I just don't understand this.

@bpyzikvc
Copy link

I agree wholeheartedly with the original post. Most platforms can do with one api call what Amazon needs multiple. A feed process from start to finish takes 6 api calls and that's best case scenario like if the feed is finished processing when you call Get Feed the first time.. wtf.

Anyway, I want to just confirm that what thethree said in the post about order items. Currently there is no way to get all items in one call with order info. There was an update a few months ago now that made it possible for there only to be a get order, and then get order item call which was amazing considering we used to have to make 3 other calls to get order information (buyer info, buyer address, order item buyer info).

I can't speak to their second point about security but it is a horrible process to go through.

Good luck with your integration!

@chapmanjw
Copy link

@erginkeles Aside from the authorization differences, the SP-API Feeds API allows you to continue using the existing feed formats (i.e. XML product feeds) that were available in MWS. With that said, however, we have been launching new API features on SP-API for creating and managing listings with modern RESTful API patterns.

To get started with these new APIs, start with the use-case guide for the Listings APIs: https://developer-docs.amazon.com/sp-api/docs/listings-items-api-v2021-08-01-use-case-guide.

The Listings API works in conjunction with the Product Type Definitions APIs that provide JSON Schemas representing the attributes and requirements per product type: https://developer-docs.amazon.com/sp-api/docs/product-type-definitions-api-v2020-09-01-model.

To enable both the Listings and Definitions APIs, we are in progress migrating product type content to the systems that power these new APIs. For sellers, this currently covers ~330 product types in US and EU5 marketplaces. This will expand to more marketplaces and more product types by EOY.

@chapmanjw chapmanjw self-assigned this Feb 18, 2022
@bpyzikvc
Copy link

bpyzikvc commented Feb 18, 2022

@chapmanjw That's great to hear that the SP-API is moving in the right direction. Are there plans for Order Fulfillment or Inventory feeds to be moved to a RESTful api?

@chapmanjw
Copy link

@bpyzikvc My team covers most of the listings and catalog offerings within SP-API, so I cannot speak to future plans for orders. However, you can already use the Listings APIs as a replacement for inventory updates: https://developer-docs.amazon.com/sp-api/docs/listings-items-api-v2021-08-01-use-case-guide#tutorial-partially-update-a-listing.

The patchListingsItem operation allows you to edit one or more attributes for a given listing. This includes fulfillment_availability (the attribute for quantity updates). You can refer to the Product Type Definitions API for the schema describing the structure of the attributes and then use the PATCH API to update them separately from updating an entire listing.

@chapmanjw
Copy link

Here is an example PATCH request for updating quantity:

{
  "productType":"PRODUCT",
  "patches":[
    {
      "op":"replace",
      "path":"/attributes/fulfillment_availability",
      "value":[
        {
          "fulfillment_channel_code":"DEFAULT",
          "quantity":10
        }
      ]
    }
  ]
}

@chapmanjw
Copy link

You can additionally use the JSON format of the Listings APIs in bulk with the JSON_LISTINGS_FEED feed type on the Feeds API: https://developer-docs.amazon.com/sp-api/docs/listings-feed-schema-v2

@Mike-the-one
Copy link

Thanks @chapmanjw

I know your team is not working on getOrders api, but I am wondering if you can connect this thread with the team works on getOrders api and see if they are able to return orderItems as part of the getOrders call?

For example, shopify get orders cal returns everything needed for shipping:

https://shopify.dev/api/admin-rest/2022-01/resources/order#[get]/admin/api/2022-01/orders.json?status=any

Or would Amazon be able to use webhooks?

MWS has rate limit too, but we often receive 429 even we wait very long.

Also, regarding the update product quantity, you mentioned this

the SP-API Feeds API allows you to continue using the existing feed formats (i.e. XML product feeds) that were available in MWS

Can I assume Amazon has no plan to change this? (e.g. only accept json).

I am migrating my application to the new API, so if it is not broken I prefer not to change.

thanks!

@izaakm1
Copy link

izaakm1 commented Mar 3, 2022

This API is impossible! The documentation is VERBOSE at best and the hoops you have to jump through is crazy!

Finding resources online with competent explanations are just as hard to come by. /rant

@Mike-the-one
Copy link

Seems no one from Amazon is monitoring this forum, unfortunately.

@bpyzikvc
Copy link

bpyzikvc commented Mar 3, 2022

@izaakm1 I completely agree but where are you stuck? If you add your issue here or start a new post and @ me, I can try to help. After much effort and confusion, I was able to get my integration working

@izaakm1
Copy link

izaakm1 commented Mar 4, 2022

@bpyzikvc I am stuck at the part where I am making an actual call to the sp-api, specifically this request:

GET https://sellingpartnerapi-na.amazon.com/sellers/v1/marketplaceParticipations 403 67 ms Network Request Headers x-amz-access-token: {{removed}} Host: sellingpartnerapi-na.amazon.com X-Amz-Date: 20220304T141845Z Authorization: AWS4-HMAC-SHA256 Credential=ASIAVQTJBOEDDJAGKK3E/20220304/us-east-1/execute-api/aws4_request, SignedHeaders=host;x-amz-access-token;x-amz-date, Signature=21013cf34850bba4bc0a7698bd04f6de877bb7182c6d21162a4d4748961ccb77 User-Agent: PostmanRuntime/7.29.0 Accept: */* Cache-Control: no-cache Postman-Token: 2993322c-96c8-40d6-b3fc-53e521724ca9 Accept-Encoding: gzip, deflate, br Connection: keep-alive Cookie: session-id-eu=261-2622245-1339637; session-id-time-eu=2273071103l; session-token=4VE+Gr1y/4tuOF8V3LwDF8G/cjvD8JrwmyflYvhpoeTxM9aSi7dTDjAoMG2CH8Zc/hPzcNOUdZren7gLiCMTKo6J6opKA2cNREB+gEk2WxcHLF8nxCZszPK/tduxeAss6QJFnJJz/HzOOk4bj+Hvp7Hth6N99mU+otf0xyW8sO6jBtIKRmdO+nQe34wMne0Xo6mlfD4FYCHg4p8M1wLzUpuQEm2UNGzm; ubid-acbuk=257-8070539-4412145 Response Headers Date: Fri, 04 Mar 2022 14:18:46 GMT Content-Type: application/json Content-Length: 137 Connection: keep-alive x-amzn-RequestId: 7cb678b6-0cc4-44d8-b5e9-5221b416b399 x-amzn-ErrorType: UnrecognizedClientException x-amz-apigw-id: Odnm9EXcIAMFoCw= Response Body { "errors": [ { "message": "The security token included in the request is invalid.", "code": "InvalidInput" } ] }
I am self authorizing my app in seller central -> getting refresh token -> exchanging refresh token for access token and then utilizing that access token in the 'x-amz-access-token' header.

I am utilizing postman and in the authorization tab i am using 'AWS Signature" type as described in the actual docs 'Generate Temporary credentials using AWS STS' because i am using a ROLE for my application. I then take the resulting AccessKey / Secret key returned from that STS call and input it into the Authorization / AWS Signature section of the call I am making for marketplaceParticipations and am getting the above response.

@johnkw
Copy link

johnkw commented May 29, 2022

The original post on product updates is largely a duplicate of bug amzn/selling-partner-api-models#392. I'm fairly certain there is already a bug on streamlining the setup examples (it's hard to search the database of open bugs because there are over 1000 open bugs). This should be closed in favor of those.

@Landsailor
Copy link

@izaakm1

You did not specifically mention using the SessionToken returned by STS in your call. You need to insert that in the Authorization tab, under ADVANCED. It is different from the LWA Access Token, but also has a TTL of one hour, so it's easy to get confused.

Any error messages mentioning "security token" refer to that essential third part of the results of your STS call.

To summarize, you need four temporary credentials to access virtually everything in SP-API:

Security Token Service Temporary Role Credentials

  • AccessKey
  • SecretKey
  • SessionToken

From the Refresh Token Exchange or createRestrictedDataToken

  • the LWA Access Token
    OR
  • the Restricted Data Token for PII

These are in addition to the AWS Signature v4 which appears to follow its own, undocumented set of rules for SP-API.

@github-actions
Copy link

This is a very old issue that is probably not getting as much attention as it deserves. We encourage you to check if this is still an issue after the latest release and if you find that this is still a problem, please feel free to open a new issue and make a reference to this one.

@github-actions
Copy link

closed for inactivity

@chrislan815
Copy link

chrislan815 commented Jul 17, 2023

And after all this work, i still don’t know how to upload products or update quantity-price. Not to mention about orders or other things.

and

Watch thousands of minutes of videos, do lots of unnecessary meaningless clicks, read the worst documentation content page by page; for what? Just to generate a client id and client secret key.

These two hit the nail for me. Updating Listing Item has been cryptic for me to understand why some values doesn't work when I make a patch call.

@johnkw
Copy link

johnkw commented Jul 17, 2023

See bug #3068 etc for that part. That part of the API isn't really finished yet for sure.

@shaedrich
Copy link

shaedrich commented Jan 8, 2024

However, you can already use the Listings APIs as a replacement for inventory update […] Here is an example PATCH request for updating quantity

This API has both PATCH and PUT, however, I got only one of them working. Also, it took me quite a while to adjust the example with the our_price given in the docs to adjust to the quantity property. There's no way to read the docs with just one tab open, not even with one tab per page, since you need to jump up and down so much that you completely forget what up and down even are.

I mean, is it too complecated to ask for an API where you essentially send something like this and that's it?

PUT /offers

{
    "{{ sku }}": {
        "quantity": 0,
        ...optionalAdditionalProperties
    }
}

@wszwc
Copy link

wszwc commented Mar 6, 2024

个API是不可能的!该文

Hello, I cannot get all the product information in the store. How can I do this? I need this information for product synchronization and batch updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests