Skip to content

berkcanucan/jotform-api-nodejs

 
 

Repository files navigation

logo
Build Status


Jotform Node.js SDK

Jotform's Node.js SDK.

  • First class TypeScript support.
  • Promise based.

Installation

$ npm install jotform

Usage

  • Initialize the SDK.
import { Jotform } from 'jotform';

const JF = new Jotform();
  • Authenticate with Jotform.
JF.initializeSDK(
  'your-api-key',
  'Jotform Instance (US, EU or HIPAA - defaults to US)'
);
  • Simple examples.
JF.user
  .getUser()
  .then((response: object) => {
    console.log(response);
  })
  .catch((error) => {
    console.error(error);
  });
const data = {
  questions: {
    '1': {
      type: 'control_head',
      text: 'Text 1',
      order: '1',
      name: 'Header1',
    },
    '2': {
      type: 'control_head',
      text: 'Text 2',
      order: '2',
      name: 'Header2',
    },
  },
};

JF.form
  .addNewQuestionToForm(formId, data)
  .then((response: object) => {
    console.log(response);
  })
  .catch((error) => {
    console.error(error);
  });

License

  • This project is under the GPLv3 license. Copyright (c) 2021 Jotform and it's contributors.