Method define custom error responses

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.
  1. 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.

  2. 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.

  3. 404 - NOT FOUND: If the data source responds to error 404 it would apply this template.

  4. 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.

  5. 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.

  6. 500 - INTERNAL SERVER ERROR: This error code applies when its data source responds to error 500.

  7. 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

    • Create APIs methods

      Summary In the article Create and manage APIs versions The first necessary steps to create APIs were shown. Methods define the action to be taken on a particular esource. As a first step you should select the option of Add Methodin the API. Add ...
    • Method define response formats for methods

      Summary Output formats allow you to define one or more response formats in your API methods. Output formats can be multiple in JSON format, although it can also expose the data in CSV and XML. Configure formats When creating a method you should ...
    • 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 ...
    • Configure context variables at method parameters

      Summary Context variables allow you to associate values assigned to the account, users and applications to APIs parameters values. By setting up the API method you can relate its parameters to context variables. When a request is made to the method, ...