Example of Contact API
  • 15 Oct 2023
  • 1 Minute to read
  • Dark
    Light

Example of Contact API

  • Dark
    Light

Article summary

Here, we'll guide OutSystems developers through the process of creating a new REST interface using the Api_Contact action as an example:

1. Accessing the Api_Contact Action

  • Within the OutSystems environment, navigate to the Api_Contact server action. This provides a comprehensive view of the various parameters and settings related to the action.

2. Defining the Endpoint and Documentation

  • EspaceEndpointId: Reference the specific endpoint to which your API is linked.
  • CreateApiDoc: Determine if you want to create documentation for the API. For instance, setting this to ApiDocumentCreate will result in the generation of API documentation.

3. Specifying the Response Type and Entity

  • ResponseType: Choose the structure of your response, such as Entities_ResultType_Structure.
  • EntityName: Define the main entity that the API will interact with, like Contact.
  • EntitySetName: Assign a name for the collection of entities, for example, Contacts.

4. Enhancing Security

  • Security: Opt for an advanced security mechanism like Entities_ApiSecurity_Oauth2 to protect your API and its data.

5. Defining Scope and Access

  • EndpointScope: Select the different operations your API will support, such as:

    • List Entities
    • Create Entity
    • Update Entity, and more.
  • Access: Determine which roles can access the API, like Roles_ContactAdmin.

6. Configuring Entity Attributes

  • EntityKeyId, WhereField, ListField, etc.: Define the various attributes and properties of your entity, ensuring that fields like the ID, Name, and others are correctly mapped.

7. Advanced Configurations

  • SpecialFields: Indicate specific fields with unique properties, such as those that are passive, created by certain users, or modified on specific dates.
  • Extra: Specify additional fields that may be crucial for your application's functionality.
  • CustomCode: If any custom logic is required, define it here for actions like getting entities, listing entities, etc.

8. Commit and Execute

Finally, remember to use the ApiCommit action after setting up the Api_Contact action. This will finalize your configurations, generate the necessary API documentation, and synchronize any modifications.

And that's it! By following these steps, OutSystems developers can proficiently utilize the Agile.Now Endpoint accelerator to create robust REST interfaces, optimize development processes, and ensure adherence to industry standards.


Was this article helpful?