After defining API specs using RAML file, we can generate code to implement these APIs using Spring framework and also import it into Postman for testing. In this tutorial, I will show you how to import RAML into Postman!
I will use the API specs definition using RAML in the tutorial API fragments with RAML as an example. You can get the contents of these RAML files here https://github.com/khanhnguyenj/huongdanjava.com/tree/master/raml-student.
To import these RAML files into Postman, please click the Import button in the main Postman Workspace window:
The file selection window to import will display as follows:
There are many file formats supported by Postman such as OpenAPI, RAML, GraphQL, cURL or WADL as you can see. To import, click the Upload Files button. If your API specs are defined in many different files, then choose the Folder tab in the above window instead of the File tab!
In my example, the API specs are defined in many different RAML files, so I will select the Folder tab and choose to import to the folder containing these RAML files.
After selecting the folder, you will see the following results:
You will see the following results:
You can click the requests to see the details for each request, like the information we have defined in the root RAML file.
For each request, the baseUrl will be configured by Postman to use a variable with the initial value we defined in the RAML file as follows:
Depending on your needs, you can change this variable in the Environment section of Postman!