Use Swagger version 2 declarations to import and test WebSphere Commerce v7 REST services

It’s actually quite common to use Swagger JSON v2 declarations to import REST services and start interacting with them.

For example to start testing Oracle Commerce Cloud v16.1 REST services, you just have to download this JSON from the public documentation and start playing with your OCC instance.

OCC Swagger import on SoapUI

OCC Swagger import on SoapUI

Unfortunately for WebSphere Commerce is not so easy.

You can use the  standard Swagger interface available with WebSphere Commerce developer (remember to access it on http only and pushing the Explore button – Thanks Kevin Dillard for helping me)

WebSphere Commerce Swagger 1.2 UI on Commerce Developer

WebSphere Commerce Swagger 1.2 UI on Commerce Developer

to download JSON declarations for every service one by one (not so friendly).

A quick tip about Swagger UI: if you want to get Search API declarations instead of Commerce runtime API, please change the base URL to http://localhost/search/resources/api and press Explore

WebSphere Commerce v7 Search API declarations

WebSphere Commerce v7 Search API declarations

If you’re just specifying Swagger UI URL and hit Enter, a https redirection will be forced and Swagger UI cannot be accessed with recent Chrome or Firefox versions because of a missing CORS configuration on WebSphere Commerce (CORS issues will be solved soon with JR55289 fix, a back port for v7 of v8 CORS mentioned by Bob Balfe in his post)

CORS configuration error accessing Swagger interface

CORS configuration error accessing Swagger interface

In summary there isn’t a swagger.json file publicly available for download and the Swagger version used by WebSphere Commerce v7 is still 1.2 (please vote for my RFE to upgrade it to v2).

Then I had to open a PMR (25672,756,000: thank you Steve Boggs) and ask to the support for the procedure to create a Swagger file and upgrade it to v2. After some back and forth where our Commerce Technology Advocate helped too, we finally generated a valid v2 Swagger JSON file for runtime and search server

Swagger.json for WebSphere Commerce v7 FEP8 runtime

Swagger.json for WebSphere Commerce v7 FEP8 search

You just have load it on your preferred tool and start testing WebSphere Commerce REST interface

WebSphere Commerce v7 Swagger JSON imported on SoapUI

WebSphere Commerce v7 Swagger JSON imported on SoapUI

Websphere Commerce and Portal Architect ✔ Motivated IT professional with more than ten years of experience, combining Java and JEE developer skills with systems and IBM products installation knowledge. ✔ Strong experience and skills on planning, architecting and implementing complex commerce and portal solutions based on IBM middleware products. ✔ Reliable with a strong network attitude, experience on leading developer's teams and manage international relationships. Specialties ✔ Pleasant manner, reliable. ✔ Ability to consider issues from different point of views. ✔ End-oriented work capacity and problem-solving attitude. ✔ Ability to work with deadlines and under pressure. ✔ Ability to prioritise tasks and manage people. ✔ Ability to increase the whole team skills. ✔ Ability to generate commercial leads

Tagged with: , , ,
Posted in oracle, REST services, websphere commerce
2 comments on “Use Swagger version 2 declarations to import and test WebSphere Commerce v7 REST services
  1. Artem says:

    “we finally generated a valid v2 Swagger JSON file for runtime and search server”
    But how you did it? Can you decribe process or made tutorial. It is a very actual problem. Even for WebSphere Commerce v8.

  2. Alag says:

    Would you be able to share the steps followed to generate a valid v2 swagger json file from the swagger UI version 1.2?

Leave a comment