Form Steps
Uploader supports multi-step forms, allowing for dynamic and conditional form flows. This is useful when the information required from the user depends on previous answers.
Step-by-Step Example
-
Client requests the form schema:
The client initiates the process by requesting the initial form schema.
curl -X POST -H "Content-Type: application/json" https://<UPLOAD_HOST>/schema -d '{}'The JSON data is empty because no form data has been submitted yet.
-
Client receives the form structure:
The server responds with the first step of the form schema.
{
"type": "object",
"required": ["databox"],
"properties": {
"databox": {
"enum": {"foo": "Foo", "bar": "Bar"},
"type": "string",
"title": "Which data box destination?"
}
}
} -
Client submits the first form data:
curl -X POST -H "Content-Type: application/json" https://<UPLOAD_HOST>/schema -d '{"databox": "bar"}' -
Server responds with the next form fields:
Based on the submitted data, the server provides the next set of fields.
{
"type": "object",
"required": ["title"],
"properties": {
"title": {"type": "string", "title": "Title:"},
"description": {"type": "string", "title": "Description:"}
}
} -
Client submits all form data (including previous steps):
curl -X POST -H "Content-Type: application/json" https://<UPLOAD_HOST>/schema -d '{"databox": "bar", "title": "My Asset", "description": "A description"}'