Skip to content

Forms API Reference ​

Forms define the metadata fields used when uploading files. Use the lab code returned by the Labs API as {$VIMI_LAB} in each request.

Get all Forms ​

GET - api/v1/lab/{$VIMI_LAB}/forms

Returns all forms for the lab. The list does not include the form definition, form data, or template. Use the form endpoint to retrieve that content.

Response ​

json
{
    "links": {
        "self": "https://{$VIMI_BASE_URL}/api/v1/lab/vimi/forms"
    },
    "data": [
        {
            "type": "forms",
            "id": "999",
            "attributes": {
                "title": "New Species",
                "description": "Gather metadata about a newly identified species.",
                "created_at": "2000-01-01T00:00:00.000000Z",
                "updated_at": "2000-01-01T00:00:00.000000Z",
                "revision_number": 1
            },
            "links": {
                "self": "https://{$VIMI_BASE_URL}/api/v1/lab/vimi/forms/999"
            }
        }
    ]
}

Attributes:

  • title - name of the form
  • description - description of the form
  • created_at - timestamp of creation
  • updated_at - timestamp of last update
  • revision_number - active revision number

Get a Form ​

GET - api/v1/lab/{$VIMI_LAB}/forms/{form_id}

Returns the active revision of a form, including its form definition, form data, and a metadata template that can be used when uploading a file.

Response ​

json
{
    "data": {
        "type": "forms",
        "id": "999",
        "attributes": {
            "title": "New Species",
            "description": "Gather metadata about a newly identified species.",
            "created_at": "2000-01-01T00:00:00.000000Z",
            "updated_at": "2000-01-01T00:00:00.000000Z",
            "revision_number": 1,
            "form_data": {
                "Phylum": [
                    {
                        "Phylum ID": "p1",
                        "Phylum Value": "Arthropoda"
                    },
                    {
                        "Phylum ID": "p2",
                        "Phylum Value": "Chordata"
                    },
                    {
                        "Phylum ID": "p3",
                        "Phylum Value": "Mollusca"
                    },
                    {
                        "Phylum ID": "p4",
                        "Phylum Value": "Platyhelminthes"
                    },
                    {
                        "Phylum ID": "p5",
                        "Phylum Value": "Nematoda"
                    }
                ]
            },
            "dsl": {
                "nodes": [
                    {
                        "type": "text",
                        "id": "Binomial Nomenclature",
                        "label": "Binomial Nomenclature",
                        "path": "Binomial Nomenclature",
                        "validation": {
                            "required": true
                        }
                    },
                    {
                        "type": "textarea",
                        "id": "Physical Description",
                        "label": "Physical Description",
                        "path": "Physical Description",
                        "rows": 4
                    },
                    {
                        "type": "select",
                        "id": "Phylum",
                        "label": "Phylum",
                        "path": "Phylum",
                        "options": {
                            "source": "formData",
                            "path": "Phylum",
                            "labelKey": "Phylum Value",
                            "valueKey": "Phylum ID"
                        },
                        "placeholder": "Choose a phylum..."
                    },
                    {
                        "type": "number",
                        "id": "Population Estimates",
                        "label": "Population Estimates",
                        "path": "Population Estimates"
                    }
                ]
            },
            "template": {
                "Binomial Nomenclature": {
                    "label": "Binomial Nomenclature",
                    "value": "Binomial Nomenclature"
                },
                "Physical Description": {
                    "label": "Physical Description",
                    "value": "Physical Description"
                },
                "Phylum": {
                    "label": "Phylum",
                    "value": "Phylum"
                },
                "Population Estimates": {
                    "label": "Population Estimates",
                    "value": 0
                }
            }
        },
        "links": {
            "self": "https://{$VIMI_BASE_URL}/api/v1/lab/vimi/forms/999"
        }
    }
}

Additional attributes:

  • form_data - data referenced by the form definition, such as selection options
  • dsl - form definition; see the Metadata Schema Reference
  • template - sample metadata in the shape accepted by the Files API

Update a Form ​

PATCH - api/v1/lab/{$VIMI_LAB}/forms/{form_id}

Updates and immediately publishes a new revision of the form. Provide dsl, form_data, or both.

Request ​

json
{
    "dsl": {
        "nodes": [
            {
                "type": "text",
                "id": "Binomial Nomenclature",
                "label": "Binomial Nomenclature",
                "path": "Binomial Nomenclature",
                "validation": {
                    "required": true
                }
            },
            {
                "type": "textarea",
                "id": "Physical Description",
                "label": "Physical Description",
                "path": "Physical Description",
                "rows": 4
            },
            {
                "type": "select",
                "id": "Phylum",
                "label": "Phylum",
                "path": "Phylum",
                "options": {
                    "source": "formData",
                    "path": "Phylum",
                    "labelKey": "Phylum Value",
                    "valueKey": "Phylum ID"
                },
                "placeholder": "Choose a phylum..."
            },
            {
                "type": "number",
                "id": "Population Estimates",
                "label": "Population Estimates",
                "path": "Population Estimates"
            }
        ]
    },
    "form_data": {
        "Phylum": [
            {
                "Phylum ID": "p1",
                "Phylum Value": "Arthropoda"
            },
            {
                "Phylum ID": "p2",
                "Phylum Value": "Chordata"
            },
            {
                "Phylum ID": "p3",
                "Phylum Value": "Mollusca"
            },
            {
                "Phylum ID": "p4",
                "Phylum Value": "Platyhelminthes"
            },
            {
                "Phylum ID": "p5",
                "Phylum Value": "Nematoda"
            }
        ]
    }
}

Request attributes:

  • dsl - optional form definition as a JSON object or a string containing JSON
  • form_data - optional optional data referenced by the form definition, as a JSON object, a string containing JSON, or null

At least one request attribute is required.

Response ​

The response has the same structure as Get a Form, with the updated form content and revision number.