This example shows how to call a REST service defined using Swagger specification with the help of Camel Rest Swagger component.
The example is a standalone Spring Boot application that acts as a REST client, you can run simply by issuing:
$ mvn spring-boot:run
Or by packaging it and running it using java
CLI:
$ mvn package $ java -jar target/camel-example-spring-boot-rest-swagger-simple-*.jar
The example by default uses the PetStore demo hosted on swagger.io and
invokes the getInventory
operation. You can make it call any API
that you have Swagger specification for and any operation with simple
arguments, for instance this retrieves a pet from the PetStore demo with
ID 14
:
$ java -jar target/camel-example-spring-boot-rest-swagger-simple-*.jar \ --swagger=https://petstore.swagger.io/v2/swagger.json \ --operation=getPetById \ --petId=14
If you hit any problem using Camel or have some feedback, then please let us know.
We also love contributors, so get involved :-)
The Camel riders!