In this post, we’ll see how ChatGPT can be used to reinvigorate APIs by creating an OpenAPI specification for an existing API that has existing documentation.
ChatGPT, developed by OpenAI, has generated attention for its natural language processing capabilities. ChatGPT is based on machine learning techniques such as Generative Pre-trained Transformer (GPT) architecture which is part of Large Language Models (LLMs).
Application Programming Interfaces (APIs) underpins modern software development, enabling communication between different systems. Legacy APIs often lack standardized documentation, and versioning controls leading to outdated information, maintenance challenges, and slower API usage uptake.
Newer APIs often adopt standards such as OpenAPI specification which is defined by the OpenAPI Initiative to describe how the APIs work in machine-readable documentation. Using an OpenAPI specification to describe an API provides consistency across APIs, the ability to document the API, a contract on how to use the API, the ability to generate code stubs to consume and produce APIs, and API versioning. These features enable quicker API development, quicker uptake of API services, and a reduction in API maintenance.
Let’s see how ChatGPT might be used to reinvigorate APIs by creating an OpenAPI specification for an existing API with existing documentation. For our purposes, the API that will be used is “Where the ISS at?” which returns information about the International Space Station. The “Where the ISS at?” documentation can also be found on the Wayback Machine — just in case the main website disappears.
Full file details for ChatGPT questions and responses used in the article can be found in the GitHub Repository - ChatGPT OpenAPI specification.
Generating an OpenAPI Specification with ChatGPT
Using ChatGPT version 3.5, we asked the following: