Formium API Client

The Formium client library provides an API client for communicating with the Formium backend.

Prerequisites

This package requires an active Formium account, project, and a form. You can sign up for free at https://dashboard.formium.io/signup. Free accounts allow for 100 monthly submissions, 10 active forms, and 100MB of total file storage.

Installation

npm install @formium/client

Usage

Create an instance of the FormiumClient with by calling createClient wiht your project ID and, if you are in Node.js, a personal access token.

Browser

import { createClient } from '@formium/client';
const formium = createClient('your_project_id');

Node.js

import { createClient } from '@formium/client';
const formium = createClient('your_project_id', {
apiToken: 'your_access_token',
});

Reference

method createClient@formium/client
Returns

Create a new Formium API client

ParametersDescription
projectSlugstring

Project slug

Required
optionsOptions

Client options


class FormiumClient

Formium Client

method deleteSubmit@formium/client
Returns
Promise<void>

Delete a Submission

ParametersDescription
submitIdstring

The id of the Submission

Required
fetchOptionsRequestInit

Additional request options

method deleteSubmits@formium/client
Returns
Promise<void>

Delete mulitple Submissions

ParametersDescription
queryDeleteSubmitsQuery

Query parameters

Required
fetchOptionsRequestInit

Additional request options

method findForms@formium/client
Returns
Promise<Results<Form>>

Return Forms in a project

ParametersDescription
queryFindFormsQuery

Query parameters

fetchOptionsRequestInit

Additional request options

method findSubmits@formium/client
Returns
Promise<Results<Project>>

Find Submissions of a given form

ParametersDescription
queryFindSubmitsQuery

Query parameters

Required
fetchOptionsRequestInit

Additional request options

method getFormById@formium/client
Returns
Promise<Form>

Return a Form given its id

ParametersDescription
idstring
Required
queryGetFormQuery

Query parameters

fetchOptionsRequestInit

Additional request options

method getFormBySlug@formium/client
Returns
Promise<Form>

Return a Form based on its slug

ParametersDescription
formSlugstring

form slug

Required
queryGetFormQuery

Query parameters

fetchOptionsRequestInit

Additional request options

method getMe@formium/client
Returns
Promise<User>

Return the current User (based on the token)

ParametersDescription
fetchOptionsRequestInit
method getMyProjects@formium/client
Returns
Promise<Results<Project>>

Retrieve the Projects the user belongs to

ParametersDescription
fetchOptionsRequestInit
method getProject@formium/client
Returns
Promise<Project>

Return a Project by id

ParametersDescription
idstring

Project id

Required
fetchOptionsRequestInit

fetch overrides

method getProjectBySlug@formium/client
Returns
Promise<Project>

Return a Project by slug

ParametersDescription
projectSlugstring

A Project slug

Required
fetchOptionsRequestInit
method getSubmit@formium/client
Returns
Promise<Submit>

Return a Submission

ParametersDescription
submitIdstring

The id of the submission

Required
fetchOptionsRequestInit

Additional request options

method logout@formium/client
Returns
Promise<any>

Delete the current Oauth2 bearer token (for signout)

ParametersDescription
fetchOptionsRequestInit
method submitForm@formium/client
Returns
Promise<void>

Submit data to a Form

ParametersDescription
formSlugstring

Slug of the Form

Required
dataSubmitData

An object or FormData instance containing submission data.

Required
method uploadFile@formium/client
Returns
Promise<string | null>

Upload a file to Formium. All uploads are private by default.

ParametersDescription
formSlugstring

Slug of the Form

Required
fileFile

File to be uploaded

Required
Was this page helpful?

Build forms, without the tears.