Create APIs methods

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

Methods define the action to be taken on a particular resource. As a first step you should select the option of Add Method in the API:

Details of the method

In the detail of the method you should define:

  1. The type of application: see What are the types of application for methods
  2. The path of the method: see Method defining routes to methods: good practices
  3. Description: a text describing the data and action of the method.
  4. View: You should select the data view to be used in the method.
  5. Parameters: if the data view has parameters it would be displayed on screen. You canConfigure context variables.

Output templates

Health or output templates make it possible to define the response format of the method. It can also add multiple output formats, to fit different standards and/or facilitate reading responses by consumer systems, applications or users.

To find more information on how to set up the output of methods, we recommend reading:
  1. How to work with templates to define the output of methods
  2. Scientific define output formats for methods

Error templates

When the request for the method is unsuccessful, apply the error templates. These templates make it possible to define custom errors in each of the methods.

Output preview

The preview would allow you to know what the method's response would be, based on the selected data view, format and template.

Data dictionary

The data dictionary makes it possible to provide more information about the attributes of the method. For each of the columns in the view it is possible to define a Name, Description and Data Type.

The types of data available are string, integer, number and boolean.

When you define numerical data types (integer and number) Extended API options would enable grouping and aggregation operations (sum, average, count) and dynamic filters. By adding a dictionary these options would be displayed in the window Test method of the Developer Portal.

The developer user could consult the data dictionary on the portal and by an API request, applying .dict in the request. For example,https://api.empresa.com/api/v1/documents.dict

Limits

Limits can be set globally in the API and overwritten in methods for more precise and differentiated control.

Auth Key shipping form

You can set the auth_key shipment as a matter or header.

If you select as a similar, auth_key should go at the endpoint of the request, for example http://api.company.com/accounts/v1/users.json?auth_key=XXXXX

If you select as the header, the shipment of the auth key should send it in the header with the name "Authorization" and its value.

Visibility

Allows you to set up the privacy of the method. We suggest reading the article Configure APIs and Methods Privacy





    • 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 ...
    • Create and configure APIs

      Summary APIs would be exhibited on the developer portal. An API can contain multiple versions, and each of the minimum versions. To create an API you must go to APIs > New APIs. Configure APIs When creating a new API you should complete the Title, ...
    • 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 ...
    • Create and manage APIs versions

      Summary An API may have one or more versions. Each version contains API methods, and may have multiple versions published at the same time. Consider adding new versions of APIs when changes you make impact on queries that receive your methods and/or ...
    • Method defining routes to methods: good practices

      Summary Definition of routes orpathsmust be consistent with the resources or entities to which the method refers. Certain good practices for considering in defining routes. A review Before proceeding, let's look at what parts of an endpoint or url. ...