You can test your API using Run & Debug
Run & Debug is a powerful tool that can be used on your Function Stacks to verify whether or not they are working properly. This can also be used on the Functions in the Library, the Addons, and the Tasks.
In this example, we have set up an API that takes information from the inputs and creates a record in the database table: contact_form and saves it as a lead.
Inputs: first_name: This is required and it has a configuration setting where there must be at least 2 characters. last_name: This is required and it has a configuration setting where there must be at least 2 characters. email_address: This is required. subject: This is required and it has a configuration setting where there must be at least 3 characters. your_message: This is required and it has a configuration setting where there must be at least 10 characters. Function:
Let's try Run & Debug
Query Trace: Get detailed information about the execution of your query.
This is where we can enter in the information for our inputs in a JSON editor, but let's generate an error first.
Result: We see that it caught our requirements for the first_name, it looks like we need to add some characters to the JSON.
Debugger: The Debugger is where we can see some useful information.
Let's open up the Environment information: We see what inputs we are passing in and the environment variables that we have set up. The $http_headers and $remote_ip are default variables that are part of your Workspace.
Within the $http_headers, there is a lot of information like Cookie, Accept-Language, Accept-Encoding, etc...
We can also view the information which is part of the Function Stack.
Let's fix our inputs and generate one more error, notice the change to the email_address.
Let's correct our mistake and enter in the correct inputs.