In this article, you will learn how to use Remote Request feature of Piotnet for sending data collected by your form to an URL endpoint – a remote server.
1. What is Remote Request
- Remote Request is sending requests to a remote server by HTTP protocol request methods. There are many HTTP Methods: GET, POST, PUT, PATCH, DELETE.
To deeply understand HTTP Methods, you need to cover the knowledge about Client-server architecture, API.
- Anatomy of an HTTP Request
An HTTP Request must have the following: a HTTP method (like GET or POST), a host URL, an endpoint path.
A request can also optionally have: body, headers, query strings, HTTP version.
- HTTP Methods
POST: Use to create a new resource
GET: Use to read or retrieve a resource
PUT: Use to modify a resource
PATCH: Use to modify part of a resource
DELETE: Use to delete a resource
2. Remote Request feature in Piotnet
In Piotnet Forms, we provide Remote Request feature as an Action After Submit. By the action, you can select which data to collect from your form and send to remote server.
- Edit Submit Button, Select Action After Submit: Remote Request
In Remote Request Control section, setup your HTTP Request:
URL: enter your endpoint URL
Request Arguments: define request Method, request timeout, redirection, httpversion, blocking.
Header Arguments: enter content-type, x-powered-by, accept, api-key.
Body Arguments: enter body parameters which you want to collect from the form and send to the endpoint URL. The Parameters are shortcode of the fields.
“Add Item” to add one or many argument parameters.
Now your Remote request form is ready. If anyone fulfill and submit the form, data will be collected and sent to endpoint.
3. Remote Request Example in Piotnet Forms
In this example, we collect email from a simple form and send to Sendinblue to create a new contact by Remote Request POST method.
Sendinblue is a CRM which manages client contacts. We also integrated Sendinblue in Piotnet Forms: Sendinblue Integration.
Requirement from Sendinblue
- This is the official document of Sendiblue about how to Create a contact by POST Request.
According to the document, beside email, some other mandatory parameters are: method, accept, content-type, api-key.
We need to register a Sendinblue account to generate an api-key.
- Setup Remote Request action after submit
Now Edit Submit button, open Remote Request section and enter argument parameters:
- URL: https://api.sendinblue.com/v3/contacts
Request Arguments: method = POST
Header Arguments: Accept = application/json; Content-type = application/json; api-key = the api-key generated by our Sendinblue account
Body Arguments: email = email-field-shortcode
At this point, we already completed the setup. Let’s see how do the Remote Request Form work:
– Enter contact email
– Click Submit button
– Check the Contacts in Sendinblue
As you can see, the contact was added into Sendinblue.
Remote Request in an advanced feature which requires coding knowledge. Just consider to use the feature in case you clearly understand HTTP protocol, API, Client-server Architecture.