You can use the
TEST METHOD button in VTEX API reference to test API requests as you read the documentaion. In this tutorial you will learn how to use this feature.
So before proceeding with this guide, make sure you have a valid pair of
appToken with the necessary permissions to execute the requests you want. If you do not have this credential yet, learn more about how to create application keys.
Trying out a simple GET
The example below is based on the List orders endpoint, but these instructions apply for any endpoint you wish to try. Feel free to follow along.
To try out an API request follow these steps:
Head to the API reference page of the endpoint you wish to test, such as the List orders endpoint.
Read the documentation and fill in necessary parameters of your request, such as headers, query parameters, and request body fields.
Scroll to the
TEST METHODbutton. It may be on the top of the page at the right side of your screen, or on the bottom, depending on your window size.
Fill in your app key in the
Fill in your app token in the
Hover your mouse cursor over the
Base URLfield to see the
Fill in the
accountNamefield with your VTEX account name.
Fill in the environment. If you do not know which environment to use, try
TEST METHODbutton. This will send your request to the desired API endpoint.
Check your response below the request.
If you get a
401 - Unauthorized as response, review the application key and token and try again. Make sure that the right permissions are defined in the roles and that you copied the exact key and token values into the headers of the request.
Learn more about VTEX authentication for developers.
If you received a
200 OK response, it means you got your a successful request to VTEX APIs.
Some API requests may return other status codes in case of success, such as
204 No Content.
Using an API testing platform
You can export API specification or example requests to be used with Postman or the API platform of your choice.
As you fill in request parameters in VTEX API reference, as described above in steps 4 to 8, the request box is automattically updated. You can find this box below the
Base URL field described above.
This means you can copy this content to be imported into other software.