General

Forms

General Forms API documentation

Introduction

The forms API call is used to get forms stats and submissions from SwitchTransact.

Get Form List

This API will retrieve a list of all the forms.

Path
GET /forms/list

Response:

{
    "status": true,
    "records": [
        {
            "public_id": "91c3203f7c63e4a6d5b7.......22c3203f7c63e4a6d522",
            "name": "My form name",
            "total_views": 45,
            "total_submissions": 35
        },
        ...
    ]
}

Error Response:

{
    "status": false,
    "error": "Not authorized to make this API call. Requesting Read on General."
}

When you get this API response ensure that under the API keys section your API Key has the correct permissions: API Keys

Get Form Stats

This API will retrieve the total number of submissions for a specific form.

Path
GET /forms/stats/{public_id}

Response:

{
    "status": true,
    "total": 35
}
FieldTypeDescriptionExample
statusbooleantrue - API request was a successtrue
totalintegerTotal number of submissions for the form35

If the form can not be found for the given public_id the plain text response Error, form not found is returned.

Error Response:

{
    "status": false,
    "error": "Not authorized to make this API call. Requesting Read on General."
}

When you get this API response ensure that under the API keys section your API Key has the correct permissions: API Keys

Get Form Submissions

This API will retrieve the form submissions from a specific form.

Path
GET /forms/submissions/{public_id}

Response:

{
    "status": true,
    "records": [
        {
            "73995349244": {
                "name": "people.surname",
                "value": "Prinsloo"
            },
            ...
        },
        ...
    ]
}

The records will be in the format:

{
  "field_id": {
      "name": "field_name",
      "value": "field_value"
  },
  ...
}

Error Response:

{
    "status": false,
    "error": "Not authorized to make this API call. Requesting Read on General."
}

When you get this API response ensure that under the API keys section your API Key has the correct permissions: API Keys


Copyright © 2024 SwitchTransact