Skip to content

wojtekmaj/jotform

 
 

Repository files navigation

npm downloads CI

@wojtekmaj/jotform

Unofficial Jotform API Node.js Client with TypeScript support.

tl;dr

  • Install by executing npm install @wojtekmaj/jotform or yarn add @wojtekmaj/jotform.
  • Import by adding import jotform from '@wojtekmaj/jotform'.
  • Authenticate:
    jotform.options({
      apiKey: 'YOUR_API_KEY',
    });
  • Do stuff with it!
    const user = await jotform.getUser();

Getting started

Compatibility

Your project needs to use Node.js 18.0.0 or later.

You may be able to use it with Node.js 17.5.0, provided that you use --experimental-global-fetch flag.

Installation

Add @wojtekmaj/jotform to your project by executing npm install @wojtekmaj/jotform or yarn add @wojtekmaj/jotform.

Obtaining API key

To obtain Jotform API key, go to API section on My Account page.

Usage

Here's an example of basic usage:

import jotform from '@wojtekmaj/jotform';

jotform.options({
  apiKey: 'YOUR_API_KEY',
});

const user = await jotform.getUser();

Usage with EU Safe mode

If you're using Jotform EU Safe mode, you need to specify url option:

jotform.options({
  url: 'https://eu-api.jotform.com',
});

Usage with HIPAA Compliance mode

If you're using Jotform HIPAA Compliance mode, you need to specify url option:

jotform.options({
  url: 'https://hipaa-api.jotform.com',
});

Usage with Jotform Enterprise

If you're using Jotform Enterprise, you will need to specify url option:

jotform.options({
  url: 'https://your-domain.com/API',
});

or:

jotform.options({
  url: 'https://your-subdomain.jotform.com/API',
});

Usage with Jotform Teams

To access resources located in a Jotform Team, a custom jf-team-id header needs to be added to each request. It can be done by passing customHeaders object to desired method:

const teamForm = await jotform.getForm('FORM_ID', { 'jf-team-id': 'YOUR_TEAM_ID' });

API Documentation

Jotform API documentation is available at https://api.jotform.com/docs/.

jotform vs @wojtekmaj/jotform

@wojtekmaj/jotform is a fork of jotform v0 package. It was created to add TypeScript support, ship some long-awaited features, add new features and fix bugs. It was rebuilt from the ground up to benefit from the latest JavaScript features and to be more maintainable.

@wojtekmaj/jotform is meant to be a drop-in replacement for jotform v0 package, so you can use it without any changes to your code.

Here's how the two packages compare:

Feature jotform v0 jotform v1 @wojtekmaj/jotform
ESM support
TypeScript support
Jotform Teams support
Tests
Methods available 36 45 50
Number of dependencies 2 2 1
Bundle size 38.3 kB (min+gzip) 13 kB (min+gzip) 3.5 kB (min+gzip)
Install size 2.35 MB 2.33 MB 236 kB

License

GNU General Public License v2.0.

Author

Wojciech Maj Wojciech Maj

About

Jotform API Node.js Client

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%