Element Methods


Methods are the business logic of your Element. They represent all the APIs that your UI may call to fetch or update data.

Creating an Element Method


To create a new Element Method, click on Methods menu item in the left menu:


Click on New Method on the top right of the screen:

Api Store will automatically pick up the API and Version of the Element:

Enter the Method Name.

Enter the Endpoint: In the provided field, enter the URL of the Method endpoint:


Select the Request Type: Choose the type of request (GET, POST, PUT, PATCH, DELETE) you want to send:

Authorization:

If the Method requires authorization, you’ll need to provide the necessary credentials. This could be an API key, a bearer token, or basic authentication credentials (username and password). Here’s how you can set the authorization:

  1. None: If the Method does not use any authorization.
  2. Basic Authentication: If the Method uses basic authentication, enter the username and password in the respective fields.
  3. API Key: If the Method uses an API key for authorization, enter the key name and the value in the respective fields..
  4. Bearer Token: If the Method uses bearer tokens for authorization, enter the token in the Token’ field.



Parameters:
If your Method endpoint requires parameters, you can add them in the ‘Parameters’ section. Here’s how:

  1. Key: Enter the name of the parameter in the ‘Key’ field.
  2. Value: Enter the value of the parameter in the ‘Value’ field.
  3. Add More Parameters: If you need to add more parameters, click on the ”+” button. This will create new ‘Key’ and ‘Value’ fields for you to fill in:

Headers:
If your Method request requires specific headers, you can add them in the ‘Headers’ section. Here’s how:

  1. Key: Enter the name of the header in the ‘Key’ field.
  2. Value: Enter the value of the header in the ‘Value’ field.
  3. Add More Headers: If you need to add more headers, click on the ”+”’ button. This will create new ‘Key’ and ‘Value’ fields for you to fill in.




Request body (if applicable): If you’re sending a POST or PUT request, you may need to provide a request body. Enter the request body in the provided field:

Click on Create and then Close. You should see you newly added Method in the list: