TABLE OF CONTENTS



Introduction


Occasionally, a Magento data source may stop working. To diagnose this issue, you can test the Magento sale API feed by making a request and displaying the available results. This can be done using a GET command within the Postman application.


 

How it works

  1. Download and install the Postman application.
  2. Click on New and select Request.
  3. Configuring the GET Request
  4. Select GET from the dropdown menu.

 

Use the following URL format to make your request:


https://URL.WITH.WWW/rest/V1/orders?searchCriteria[filterGroups][0][filters][0][field]=status&searchCriteria[filterGroups][0][filters][0][value]=complete&searchCriteria[filterGroups][1][filters][1][field]=updated_at&searchCriteria[filterGroups][1][filters][1][value]=2020-02-01T00:00:00.000&searchCriteria[filterGroups][1][filters][1][conditionType]=from&searchCriteria[filterGroups][2][filters][2][field]=updated_at&searchCriteria[filterGroups][2][filters][2][value]=2021-03-01T23:59:00.000&searchCriteria[filterGroups][2][filters][2][conditionType]=to&searchCriteria[pageSize]=250


Set headers by adding the following to your request:

 

Content-Type: application/json
Accept: application/json
Authorization: Bearer ACCESS-TOKEN


Replace ACCESS-TOKEN with your actual access token.


To narrow down the search results, you can add additional searchCriteria parameters. For example, to filter sales by a specific email address:

 

Add the following parameters to the URL:

searchCriteria[filterGroups][0][filters][0][field]=customer_email
searchCriteria[filterGroups][0][filters][0][value]=EMAILADDRESSHERE


To select a specific page of results, add:

 

searchCriteria[currentPage]=2


Once you have configured your request, click the Send button in Postman.


The response will display the available results based on the criteria set.


Example cURL Command


If you prefer using cURL, you can execute the following command in your terminal:


curl --location -g --request GET 'https://URL.WITH.WWW/rest/V1/orders?searchCriteria[filterGroups][0][filters][0][field]=status&searchCriteria[filterGroups][0][filters][0][value]=complete&searchCriteria[filterGroups][1][filters][1][field]=updated_at&searchCriteria[filterGroups][1][filters][1][value]=2020-02-01T00:00:00.000&searchCriteria[filterGroups][1][filters][1][conditionType]=from&searchCriteria[filterGroups][2][filters][2][field]=updated_at&searchCriteria[filterGroups][2][filters][2][value]=2021-03-01T23:59:00.000&searchCriteria[filterGroups][2][filters][2][conditionType]=to&searchCriteria[pageSize]=250' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer ACCESS-TOKEN'


Replace ACCESS-TOKEN with your actual access token.

 

Product API


To retrieve product details using the Product API, use the following URL format:


https://URL.WITH.WWW/rest/V1/products/PRODUCTSKU?


In the Product API, the url_key attribute within the custom_attributes array should be the URL extension provided by all stores in the Magento instance.