Postman is an API development environment that simplifies sending HTTP requests to API endpoints. It allows you to quickly send and capture requests to the Intershop API and serves as a useful tool for getting started with the Intershop API or debugging. It is available as a native app for OSX, Windows and Linux.
This guide shows how to create a Postman Collection using some sample requests from the Intershop REST API. More advanced topics such as tests and pre-request scripts are not covered in this guide. Therefore, the document is primarily aimed at users without prior Postman experience or with little experience with the Intershop REST API.
To download Postman, go to the Postman Downloadpage and choose your platform.
All given examples in this guide have been tested on the basis of Intershop 7.9 and 7.10. If you use an older version, use the corresponding API requests.
There is an example Collection of Postman Requests that features all requests introduced in this guide.
The Collection can be opened in Postman via Collections | Import.
Once Postman is installed, you can use the Enter request URL line to send requests to the Intershop API. You can use multiple tabs to create multiple API calls quickly.
The following example shows how to get a list of products from the shop, see REST API - Get productlist by global search.
Info
Note
Be aware that if URL rewriting is enabled, the URLs must be adjusted accordingly.
For more information refer to Concept - URL Rewriting and Cookbook - URL Rewriting.
Click Send.
If the request was formatted correctly, product information is returned.
To view as JSON select Pretty and JSON. The result should look like this:
{ "pageable": "EYQKAB2NRqoAAAFgF7ZdEOpX", "total": 1224, "offset": 0, "amount": 50, "elements": [ { "type": "Link", "uri": "inSPIRED-inTRONICS_Business-Site/-/products/11089966", "title": "A-DATA 120GB S510", "description": "120GB S510 SATA III" }, ... { "type": "Link", "uri": "inSPIRED-inTRONICS_Business-Site/-/products/10666804", "title": "A-DATA 750GB SH14", "description": "750GB SH14 USB 3.0 External Hard Drive Black" } ], "type": "ResourceCollection", "name": "products" }
Some storefront requests require special permissions, e.g., order history, basket information or requests related to the checkout process.
To verify your permission perform the following steps:
As soon as your data is entered, you can make requests that require authorization.
Note
To proceed, make sure that you are authenticated as a user who has assigned the following privileges:
For more information see REST API - Get order history list.
To get your order history list:
Ensure that the request method drop down menu is set to GET and specify the API endpoint as follows:
https://<web-server>:<port>/INTERSHOP/rest/<ServerGroup>/<SiteID>/-/orders.
Click Send.
If the request was formatted correctly, the order history list is returned. To view as JSON select Pretty and JSON from the drop down menu. The result should look like this:
{ "elements": [ { "type": "Link", "uri": "inSPIRED-inTRONICS_Business-Site/-/orders/ZaQKAB2NtroAAAFgLrtdEOpE", "title": "order" }, { "type": "Link", "uri": "inSPIRED-inTRONICS_Business-Site/-/orders/lnoKAB2NjxAAAAFg8W1dEOpD", "title": "order" } ], "type": "ResourceCollection", "name": "orders" }
In Postman, Collections are groups of saved requests. After an API request was successfully formatted with Postman, you can save it to a Collection. Collections group related API calls and are a great way to organize your work in Postman, so you can easily reuse them for testing, demonstration or development purposes.
There are two ways to create a new Collection:
If you want to save existing requests to a new Collection perform the following steps:
If you want to create an empty Collection and start from there perform the following steps:
The following example shows how to get product information, view product details, create a new basket, add a product to this basket and how to get basket details to verify if it was successful.
Afterwards, all these requests will be stored into a newly created or an existing Collection.
Note
To proceed, make sure that you are authenticated as a user who has assigned the following privileges:
For more information refer to REST API - Adds line items to basket / add quote items to basket.
Note
If URL Rewriting is activated, the requests must be adjusted accordingly.
Open a new tab and enter your authorization information, see Authorization.
Select GET and enter https://<web-server>:<port>/INTERSHOP/rest/<ServerGroup>/<SiteID>/-/products to get a list of products.
For more information refer to REST API - Get productlist by global search.
Copy the desired product SKU for the next step.
This product will be added to the basket later.
Click Send.
In the Headers tab, enter the following:
Header | Value |
---|---|
authentication-token | Use the token from 4.1.3., step 3. |
Content-Type | application/json |
In the Body tab, choose raw and enter the following request data:
{ "elements": [ { "sku":"<your SKU>", "quantity": { "value": 1 } } ] }
Click Send.
All the requests should be listed in the History section now. To save them to a Collection perform the following steps:
For more information about creating Collections, refer to Creating Collections in the Postman documentation.