top of page
lorweitrogunexig

Amazon Seller API Sandbox: How to Use Static and Dynamic Environments for Mock Responses



What is Amazon Seller API Sandbox and How to Use It?




If you are an Amazon seller who wants to automate and optimize your business processes, you might be interested in using the Amazon Seller API. The Amazon Seller API, or SP-API for short, is a REST-based web service that allows you to access various features and data related to your seller account, such as orders, inventory, reports, notifications, and more.




amazon seller api sandbox



However, before you start using the SP-API in your production environment, you might want to test your applications without affecting your real data or triggering real-world events. This is where the sandbox environment comes in handy. The sandbox environment is a simulated version of the production environment that allows you to make test calls to the SP-API without any consequences.


The SP-API provides two types of sandbox environments: static and dynamic. The static sandbox uses pattern matching to return static, mocked responses for all SP-APIs. The dynamic sandbox routes requests to a sandbox backend that can return realistic responses based on the request parameters. In this article, we will explain how to use both types of sandbox environments and what are their benefits and limitations.


The Selling Partner API Static Sandbox




The Selling Partner API static sandbox (static sandbox) is identical to the production environment except that you direct the calls to the sandbox endpoints instead of the production endpoints. Calling the sandbox endpoints returns static, mocked responses for all SP-APIs. You can refer to these mocked responses in the Swagger model JSON file for each API that you want to call.


The static sandbox works like many mocking frameworks, in that it uses pattern matching to return a specified response when the specified parameters are present. For example, if you send a request that includes a certain order ID, you will receive a response that contains information about that order ID. However, these responses are not based on your actual data, but rather on predefined data that are stored in the JSON file.


To make a static sandbox call to an SP-API, you need to do two things: check the JSON file for request parameters and make a call with those parameters. Here is an example of how to do that:


  • Check the JSON file for request parameters. Go to . Open the folder for the API that you want to make a sandbox call. Click the Swagger model JSON file for that API. Search for an x-amzn-api-sandbox object that contains a "static" array. This object will contain request and response examples for static sandbox calls to the API operation in which they appear. If the request example contains parameters, use them in the next step.



Make a static sandbox call to an API. Make a call in the same way you would make a production call, with these differences:


  • Include the parameters from Step 1.



  • Add an x-amzn-sandbox header with value "true" in your request.



Use one of these base URLs depending on your region:


RegionBase URL


North America


Europe


Far East





For example, to make a static sandbox call to the getOrders operation of the Orders API, you can use the following request:


amazon seller api sandbox tutorial


amazon seller api sandbox access


amazon seller api sandbox environment


amazon seller api sandbox testing


amazon seller api sandbox integration


amazon seller api sandbox credentials


amazon seller api sandbox documentation


amazon seller api sandbox login


amazon seller api sandbox registration


amazon seller api sandbox setup


amazon seller api sandbox example


amazon seller api sandbox guide


amazon seller api sandbox error


amazon seller api sandbox support


amazon seller api sandbox download


amazon seller api sandbox account


amazon seller api sandbox mode


amazon seller api sandbox url


amazon seller api sandbox request


amazon seller api sandbox response


amazon seller api sandbox service


amazon seller api sandbox tool


amazon seller api sandbox software


amazon seller api sandbox application


amazon seller api sandbox platform


amazon seller api sandbox simulator


amazon seller api sandbox code


amazon seller api sandbox python


amazon seller api sandbox java


amazon seller api sandbox php


amazon seller api sandbox ruby


amazon seller api sandbox node.js


amazon seller api sandbox c#


amazon seller api sandbox javascript


amazon seller api sandbox json


amazon seller api sandbox xml


amazon seller api sandbox restful


amazon seller api sandbox soap


amazon seller api sandbox mws


amazon seller api sandbox sp-api


amazon seller app with sandbox feature


how to use amazon seller api sandbox


how to create an account for the Amazon Seller API Sandbox


how to test your integration with the Amazon Seller API Sandbox


how to troubleshoot issues with the Amazon Seller API Sandbox


benefits of using the Amazon Seller API Sandbox


limitations of the Amazon Seller API Sandbox


best practices for the Amazon Seller API Sandbox


difference between the Amazon Seller API Sandbox and Production


alternatives to the Amazon Seller API Sandbox


GET x-amzn-sandbox: true Authorization: Bearer AtzaIQEBLjAsAhRmHjNgHpi0U-Dme37rR6CuUpS... x-amzn-RequestId: 12345678-1234-1234-1234-123456789012 Host: sandbox.sellingpartnerapi-na.amazon.com User-Agent: MySellingPartnerApp/1.0 (Language=Java/1.8.0_121; Platform=Windows/10)


The response will be a static, mocked response that contains information about the orders that match the request parameters. You can compare the response with the response example in the JSON file to verify that it is correct.


The Selling Partner API Dynamic Sandbox




The Selling Partner API dynamic sandbox (dynamic sandbox) is different from the production environment in that it routes requests to a sandbox backend that can return realistic responses based on the request parameters. The dynamic sandbox does not use your actual data, but rather generates data on the fly based on predefined rules and logic. The dynamic sandbox also does not trigger any real-world events, such as sending notifications or updating inventory.


The dynamic sandbox is useful for testing scenarios that are not covered by the static sandbox, such as error handling, pagination, throttling, and complex business logic. The dynamic sandbox also allows you to test some APIs and operations that are not supported by the static sandbox, such as the Feeds API and the Reports API.


To make a dynamic sandbox call to an SP-API, you need to do two things: check the JSON file for request parameters and make a call with those parameters. Here is an example of how to do that:


  • Check the JSON file for request parameters. Go to . Open the folder for the API that you want to make a sandbox call. Click the Swagger model JSON file for that API. Search for an x-amzn-api-sandbox object that contains a "dynamic" array. This object will contain request and response examples for dynamic sandbox calls to the API operation in which they appear. If the request example contains parameters, use them in the next step.



Make a dynamic sandbox call to an API. Make a call in the same way you would make a production call, with these differences:


  • Include the parameters from Step 1.



  • Add an x-amzn-sandbox header with value "true" in your request.



Use one of these base URLs depending on your region:


RegionBase URL


North America


Europe


Far East





For example, to make a dynamic sandbox call to the createFeedDocument operation of the Feeds API, you can use the following request:


POST x-amzn-sandbox: true Authorization: Bearer AtzaIQEBLjAsAhRmHjNgHpi0U-Dme37rR6CuUpS... x-amzn-RequestId: 12345678-1234-1234-1234-123456789012 Host: sandbox.sellingpartnerapi-na.amazon.com User-Agent: MySellingPartnerApp/1.0 (Language=Java/1.8.0_121; Platform=Windows/10) Content-Type: application/json "contentType": "text/tab-separated-values; charset=UTF-8"


The response will be a dynamic, realistic response that contains information about the feed document that was created. You can compare the response with the response example in the JSON file to verify that it is correct.


Conclusion




The Amazon Seller API sandbox environment is a great tool for testing your applications and integrations without affecting your real data or triggering real-world events. The sandbox environment offers two types of simulations: static and dynamic. The static sandbox returns static, mocked responses for all SP-APIs based on pattern matching. The dynamic sandbox returns realistic responses based on the request parameters and predefined rules and logic.


Here are some tips and best practices for using the sandbox environment:


  • Use the static sandbox for testing basic functionality and validation of your applications.



  • Use the dynamic sandbox for testing complex scenarios and error handling of your applications.



  • Check the JSON file for each API that you want to make a sandbox call to find the request parameters and response examples.



  • Add an x-amzn-sandbox header with value "true" in your request to indicate that you are making a sandbox call.



  • Use the appropriate base URL for your region when making a sandbox call.



  • Refer to the for more information and guidance on how to use the sandbox environment.



We hope this article has helped you understand what is Amazon Seller API sandbox and how to use it. If you are ready to try out the sandbox environment, you can sign up for a free developer account . Happy testing!


FAQs




What is the difference between Amazon Seller API and Amazon MWS?




Amazon Seller API (SP-API) is the next generation of Amazon Marketplace Web Service (MWS). SP-API offers more features, better performance, and improved security than MWS. SP-API also uses RESTful web services instead of SOAP-based web services, which makes it easier to integrate with other systems and platforms.


How do I get access to Amazon Seller API?




To get access to Amazon Seller API, you need to have an Amazon seller account and a developer account. You can register for a developer account .


How do I monitor my usage of Amazon Seller API?




You can monitor your usage of Amazon Seller API by using the Selling Partner API for Usage Reports. This API allows you to get information about your quota utilization, throttling details, and service health status. You can also use the Selling Partner API for Notifications to receive notifications about quota changes, throttling events, and service issues.


How do I troubleshoot errors when using Amazon Seller API?




You can troubleshoot errors when using Amazon Seller API by checking the error codes and messages that are returned in the response. You can also refer to the for common error scenarios and solutions.


How do I get support when using Amazon Seller API?




You can get support when using Amazon Seller API by contacting the Selling Partner API Developer Support team. You can submit a support case to interact with other developers and get answers to your questions. 44f88ac181


255 views0 comments

Recent Posts

See All

Comments


bottom of page