Our team have created a
public Postman workspace where we provide access to API collections from our modules. You can copy these API collections to test them in your own Magento installation together with our modules, and some collections can be tested directly in our workspace using demo API endpoints.
Available public API collections
At the moment, the following extensions are added to the workspace:
Extension | Collection can be copied locally for tests | Can be tested using demo API endpoints |
| ✓ | ✓ |
(included into: Reward Points, Extra Fee, Free Gift, Shipping Rules, Shipping Restrictions) | ✓ | — |
| ✓ | — |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
Banners Lite(included into Special Promotions (Pro) and Free Gift) | ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | — |
| ✓ | ✓ |
| Extra Fee | ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
One Step Checkout Delivery Date (included into One Step Checkout Pro and Premuim) | ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| Quick Order | ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| ✓ | ✓ |
| Store Credit & Refund | ✓ | ✓ |
| ✓ | ✓ |
| ✓ | — |
To begin, log into
Postman, or create an account there if you haven't got one yet, and open one of the module collections using the links above.
Testing via demo API endpoints
Generate admin token
If you'd like to explore how API works in Amasty demo environment, choose the module you're interested in, and locate its collection. First, it is necessary to generate a temporary admin token, so that API queries can be sent in the backend. Open the very first query in the module collection called Get Admin Token:
In the Overview tab, all the necessary details for generating the token (admin area and password) are already filled in, so all that's left is to generate the token itself. Click on Send button to the right of the query:
In the Response section of the page, a generated token should appear. It will be automatically passed into other queries as a variable, so there's no need to enter it for authorization each time when you're trying out a new API query for the same module:
Test an API query
Now you can proceed with checking demo queries. Choose the API query you'd like to review:
Since we've just generated the authorization token, it has been automatically inserted in the Overview tab as a variable. Click on Next button:
On top of the page, you'll see the example of the API query that you're about to send:
Under the query, choose the data that you'd like to pass with it. All the queries have their unique sets of parameters based on what extension you're utilizing (for example, company, quote, label, form, etc.), the data found in the entity from the extension (company status, its store credit balance, contact address, and so on).
Another factor that influences the list of required parameters is method type: for GET and DELETE methods, queries usually require sending only one or several parameters, while POST and PUT methods also require including a JSON body with the information you'd like to send. Let's review both cases:
API queries with parameters only
To test such queries, it is sufficient to insert the parameter(s) that'll help locate the data. In our example, we want to obtain data about a certain company, so in the getCompanyById query you can specify the ID of the company you need the data from:
Insert the necessary data and click on Send button. As a result, if a company with such ID exists in Magento, Response section will return a JSON containing company data:
API queries with JSON body
For those cases that require passing a JSON body in the query, first you might require to indicate the parameters as in the example above (for example, ID of a company that you'd like to edit), and proceed to the following step where you'll paste the data. Let's review the updateCompany query that edits information inside the company. Once you've filled in company ID, it is necessary to click on Next button, and then open JSON editor by clicking on Open Body to Edit:
Module collections already contain a sample JSON with all the necessary components for the query. You can use it as it is and send a query with our ready-to-go sample, or you can edit the values inside it according to your liking:
While you can edit the data passed in the query (for example, insert your own email for company_email), make sure to preserve the structure of the body and don't remove any rows from it, as this may result into errors.
Testing API collections locally
If you want to test API collections using the data from your own Magento environment where the module is already installed, you may either export module collection as a JSON file, or fork it to your Postman workspace. The former option is convenient if you want to run API tests in offline environments, or of you prefer to use some other tool rather than Postman; the latter, in its turn, is the best choice for quick online tests of a Magento installation with minimal changes involved.
Export a collection
Click on three dots to the right from the collection's name and choose Export option:
Confirm your choice in a popup, and a JSON file will be downloaded. We recommend choosing the latest format version available, as they're compatible with a greater number of various tools:
Fork a collection
Before creating a fork, ensure that you have a workspace in Postman, usually a default one is created together with your Postman account. If you want to save module collection as a separate project, you may create a new one in the corresponding Workspaces tab:
Next, open the module collection that you need. Click on three dots to the right from the collection's name and select Fork:
If needed, create a custom name for your copy of API collection, select the workspace where you'd like to store your copy, and confirm the action by clicking on the Fork Collection button:
You will be redirected to your own workspace where you can customize the collection now:
Set up a collection locally (with the example of Postman)
Before running API queries, you will need to insert the data for your specific Magento instance into collection variables (its Rest API URL, admin username and password).
When running online API tests via Postman, make sure that your Magento installation is accessible by external sources and can communicate with them.
Navigate to the Get Admin Token query. Open this query inside your fork and insert your data into the following fields:
2. admin_username - username you're utilizing to log into the backend of your Magento;
3. admin_password - password for this admin area username.
Once these fields have been filled in, you can send the query, and a token should be received:
Now this token will be passed into other API queries in this collection as a variable, so you won't need to generate a token for each query separately. All further tests in local instances can be conducted in the same way as in our demo instances, so you may follow the same instructions. In case of any questions, don't hesitate to
contact our Support team.