One of the ways Formsite helps form owners is by connecting to third-party services through integrations. The payment integrations, for example, allow form owners to collect payments from order forms by simply adding the merchant account information. Where we don’t have a built-in integration, the Application Program Interface connects online services, or API for short.
The API for any service communicates with the service and passes data from one side to the other. This data transfer can either PUSH or PULL the data, depending on which side is making the request:
- Formsite can PUSH the data by triggering the Server Post integration when the form is submitted and sending the form result data to another system. Read more about using Server Post.
- An external system can PULL the data by connecting to Formsite using the API and receiving the information.
The API settings for every Formsite account can be found on the “Form Settings->Integrations->API” page.
That settings page contains some quick links to the most common tools, in addition to the account’s key.
The major actions available are:
- List the forms in the account
- Return the status of a form (open, closed)
- List the number of results for a form
- List the results for a form
When the browser sends the correct action syntax, the response is provided in XML format, a widely used and easily processed format used by virtually every system.
Using parameters with the API actions greatly expands its functionality. For example, referring to the major actions list above and choosing the first option (list the forms), the syntax is:
To authorize the action, add the parameter ‘fs_api_key’ and the value:
- Copy the link and replace the bold values with the actual values from your account. The API key can be found on the “Form Settings->Integrations->API” page.
- Paste the link into a browser address bar and press Enter to see your account’s forms.
Combining parameters is done by listing them at the end and separating with a ‘&’ symbol. For example, to retrieve a list of results for a form:
To retrieve the last 5 results, add ‘&fs_limit=5’:
Each action has a list of available parameters on the API documentation page.
Task: Create a way for members to view previous orders. This tool can be part of the company’s member area and linked to a page titled ‘Order History’.
- Create the link to the order form to return the results for the form, then add the parameter for ‘fs_search_contains_x’, then add the member’s information: