Many times, you just need a simple API interface to return data. Your API accepts input parameters, retrieves the data, and returns it with a simple status code 200. But sometimes, you need a more sophisticated interface. Perhaps you want to return status 204 to indicate that the request was successfully handled, but no matching data was found. You can also return status 201 on a POST request to indicate that the new item was successfully created. These are just a few of the possible HTTP status codes you might want to use in your API.
Profound API has always had the ability to return different status codes with and output parameters needed, but it required using the Custom Node.js Code plugin in your low-code workflow. These custom responses were not obvious to developers maintaining existing APIs and were not reflected in Profound API’s automatic Open API documentation, API Explorer.
New HTTP Status Features
Profound API version 7 includes new features to integrate HTTP status code handling into its powerful low-code system. These new features allow developers to have flexible API interfaces that make their APIs easier to use.
Output Parameters by Status Code
The first feature developers will notice after upgrading is the addition of HTTP Status Code controls on the Output Parameters tab in the Profound API IDE.
HTTP status codes can be added, removed, and selected using these controls. Each status code defined for a route will have its own output parameter list independent of other status codes. This gives developers the ability to define the interface for each potential status code ahead of time, but only requires them to define the status codes that will be used.
Set API Output Enhancement
To allow easy use of these new output parameters by HTTP status, the Set API Output plugin in the Profound API low-code framework has been enhanced.
As seen in the image above, a new drop down was added to the plugin to allow the developer to select what defined HTTP status they would like to return. When a status is selected, the output parameter list is automatically updated to the defined parameters for that status code. This eliminates the need for custom code to manipulate HTTP status codes and parameters returned, which in turn makes it easy for future developers to follow your API’s workflow.
Improved API Documentation
Profound API’s API Explorer is an Open API, or Swagger, based portal for documenting your APIs. All APIs are automatically added to the portal and documented based on the definition of the API interface as defined by the developer in the Profound API IDE. With the addition of HTTP status code support for defining output parameters in the IDE, these new definitions are pulled into the API Explorer automatically.
As you can see, each defined status code is listed in the documentation with its corresponding output definition. By properly documenting all possible API outputs, developers consuming your APIs can handle all possible results within their applications.
The goal of Profound API is to make API development simple. Business application developers need to focus on business needs, not technology stacks. By delivering a wholistic solution for defining, developing, testing, deploying, documenting, and managing APIs, Profound API allows our customers to concentrate on innovative solutions to deliver business value. Simplifying the use of HTTP status codes is just one way Profound API helps our customers to build solutions that their business needs today and into the future.
If you have recommendations on improvements we can make on handling status codes, or to any other part of Profound API, feel free to submit an enhancement request at https://profoundlogic.com/support. Feedback from customers is vital ensuring that our solutions deliver real business value.
Share this blog on your social channels: