Unofficial Jotform API Node.js Client with TypeScript support.
- Install by executing
npm install @wojtekmaj/jotform
oryarn 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();
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.
Add @wojtekmaj/jotform to your project by executing npm install @wojtekmaj/jotform
or yarn add @wojtekmaj/jotform
.
To obtain Jotform API key, go to API section on My Account page.
Here's an example of basic usage:
import jotform from '@wojtekmaj/jotform';
jotform.options({
apiKey: 'YOUR_API_KEY',
});
const user = await jotform.getUser();
If you're using Jotform EU Safe mode, you need to specify url
option:
jotform.options({
url: 'https://eu-api.jotform.com',
});
If you're using Jotform HIPAA Compliance mode, you need to specify url
option:
jotform.options({
url: 'https://hipaa-api.jotform.com',
});
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',
});
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' });
Jotform API documentation is available at https://api.jotform.com/docs/.
@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 |
GNU General Public License v2.0.
Wojciech Maj |