Method define custom error responses
Summary
In the same way you can define
formats and templates for successful application responses to a method, you can also define error templates for each format you've added and for each type of known
error.
Set up custom error templates
Creating or editing a method shows a list of Error Sheets that you can manage in each method of your APIs.
There you can define a genetic error for any type of error, or specific errors according to error codes. You should consider that the documents shown here are the platform's internal error cards mapped with the error codes delivered by your data sources.
- METHOD DEFAULT: This is the default error that would apply to all error codes and all the output formats you've added to the method.
- 204 - DO NOT DATA FOUND: By default status 204 delivers an answer without content. If a custom template is defined, the status of the response would be changed to 500, and the content of the template you define here.
Error 204 may arise because the data source responded correctly but without content or, for example, because a filter was applied in the data view and there is no result for the values sent.
- 404 - NOT FOUND: If the data source responds to error 404 it would apply this template.
- 408 - REQUEST ACCEPTED: When a data source takes more than 20 seconds to respond, the platform responds with error code 408, representing that the request has not been available. The platform continued to try to receive the response from the data source even if the request to the API method is not retried. Once the answer was available, the request must be made to the method.
This template allows you to set up a waiting message and custom retry requests.
- 422 - TABLE NOT FOUND: This error code applies automatically when its data source is in an Excel file and the sheet/table referred to in the datasheet/table referred in the One case is that the sheet that was referenced when creating the data view has been removed from the Excel file.
- 500 - INTERNAL SERVER ERROR: This error code applies when its data source responds to error 500.
- 502 - ORIGIN RESPONSE ERROR: This error code applies when its data source responds with some error code that it was not possible to map with the rest of the report.
Related Articles
Introduction to WorkSpace
Summary Workspace is where owners, administrators, publishers, and editors access to manage APIs. In this section, you can find the workspace documentation. We suggest reading What are data resources. If you were unable to access it, please read ...
Try a method
Summary The developer portal allows you to test reading methods (GETs) on the same portal. Test method Enter an API in the APIs Catalog on the portal's homepage. Then select a method and click on the buttonTest method. Select the implementation which ...
Apply data formats in data view
Summary Data formats make it possible to modify the values of data view columns and configure when the content is JSON type. To apply a format you must select the option Configure data type and column format and you could select: The column on which ...
Select data and headers
Summary Data views allow you to select the data and define the headers or titles that would be available in APIs methods. It is possible to make selections from the entire table, columns, column intersections and rows. In addition, it is possible to ...
Add aliases in data view columns
Summary APIs method templates allow you to obtain the values of the data view columns by position or alias name. Here we explain how to configure the aliases of the data view columns. Add alias To add aliases to the data view columns you must select ...