POST body

Passing data through the body of a HTTP request.

In addition to pre-populating answers using URL parameters, It's possible to POST form data into Formsort. This may be preferable, as answers will not appear within the URL at any point - POST bodies are part of the HTTP body and are encrypted with HTTPS.

To POST data, the user must navigate to the deployed URL of your flow with the answers as form data in the body of the form, using the answer variable name as the name of the input.

The POST must be a navigation request.

You cannot just POST form data to Formsort using AJAX and then redirect the user.

Example: POSTing from a <form>

Normally, when you access a page directly in a browser, or by clicking a link, the browser will send a GET request, which cannot contain a body.

On the other hand, when submitting a <form> in HTML, the browser will navigate with a POST method, which will actually redirect the user to that URL.

Here's a working example as a standalone html page, that would redirect the user to a flow with cat_name set to "Olivia":

<!doctype html>
<!-- TODO: Set the `action` to the URL of your deployed form -->
<input name="cat_name" value="Olivia" />
<input type="submit" value="Start flow" />

Of course, you could also use non-hidden inputs if the data you wish to pass should be user editable.

Example: POSTing in javascript

If you cannot have a <form>, or it doesn't make sense for your UX, you can create a form element on the fly and synthetically submit it:

  1. Build up a <form> in your click handler

  2. Add the answers as <input type="hidden"> using the answer variable labels as the name.

  3. Finally, .submit() the form instance.

Here's a working example as a standalone html page, that would redirect the user to a flow with cat_name set to "Olivia":

<!doctype html>
// TODO: Set these to your own values
const clientId = 'YOUR_CLIENT';
const flowId = 'YOUR_FLOW_LABEL';
const variantId = 'YOUR_VARIANT_LABEL';
let flow_url = ""
flow_url += `/client/${clientId}`;
flow_url += `/flow/${flowId}`;
flow_url += `/variant/${variantId}`;
const answers = {
"cat_name": "Olivia"
const handleFormRedirect = (e) => {
// 1. Build up a <form>
const form = document.createElement('form');
form.method = "POST"
form.action = flow_url;
// 2. Add the answers as <input type=hidden>
Object.keys(answers).forEach(key => {
const input = document.createElement('input');
input.type = 'hidden'; = key;
input.value = answers[key];
// 3. Submit the form instance
<a href="" onclick="handleFormRedirect(event)">Start flow</a>

Pre-posting data for a responder UUID

In the future, we'd like to support pre-posting data for a responder UUID, so that you can POST data asynchronously before you actually navigate the user to the flow, at which point the data will be retrieved.

This is an unimplemented feature - chat us if you'd be interested in this.