Chuck Norris Joke Enthusiasts Trust DreamFactory to Automate APIs
Thanks to amusing Chuck Norris API database site The Internet Chuck Norris Database, you can have some fun and keep the Chuck Norris jokes flowing. With the help of DreamFactory and our API automation tools, you will always have life-changing insights making those around you just a bit more intelligent, good looking and successful. Who doesn’t need to understand such nuggets as:
Contrary to popular belief, the Titanic didn’t hit an iceberg. The ship was off course and ran into Chuck Norris while he was doing the backstroke across the Atlantic.
This post will show you how to create your own Swagger service definition, how to connect a few of the different endpoints so that you can come up with random jokes on the fly, or maybe have a couple of favorite jokes you like to use in watercooler banter. Basically, DreamFactory was created out of fear that Chuck would be upset if someone didn’t come up with an easy way to automate his APIs.
First things first you want to create a new service to be able to bring in the jokes:
Since this is a Remote Web Service, we will use the HTTP Service type. Chuck, being who he is, makes it very easy to get access to this content as I am sure he would put the fear of Norris into anyone who would want you to pass auth headers into the GET request.
On the Config Overview page, you just need to add in the base URL and you are ready to go:
At this point, your service is live and you can start using the API endpoints through Postman, Insomnia and our
In this case, I have created a locally hosted Bitnami instance which is running on port 8080. My custom URL would
When we look at test_rest.html, you can see the results, just not with fancy colors and formatting. You can see at the bottom of the screen the output in
So – we can communicate with Chuck, but how do we make it even easier? Swagger comes to our rescue here, using their swagger-
Sidenote: If you have your own customized Swagger definition already created, and it is in the Swagger 2.0 definition, you can convert it to the current 3.0 standard with quite a few different tools. Okay, let’s get building the Swagger service definition.
Swagger has a ton of tools, but I like using the online editor. As you can see in the picture below, you can import files, URLs, etc. For more information on any of the steps below check out their documentation.
You will notice that the editor defaults to YAML (technically a subset of JSON), and DreamFactory supports the upload of YAML or JSON, so you have the freedom to create your service definition in either format. Take a look at the screenshot below, which shows you the different ways you can upload or create your service definitions.
You can see examples of how to create YAML Swagger definitions here. You can model your own swagger after this or by downloading another one of the native services in your DreamFactory install. Just go to the API Docs tab and click the “Download Service Doc”. This will download the JSON version of the service doc for that particular service. You can copy and paste, or upload it into the Swagger editor.In our
OK, so once you feel good about your code, head back to DreamFactory and deploy that bad boy in your service definition and run it! You should see the exact same results you saw in your editor tests.
Now go out there and make something great with DreamFactory and Swagger! Thanks to ICNDB for creating this fun project. Make Chuck proud!! As always please reach out to us
And remember: “Chuck Norris doesn’t do