0.1.10 • Published 4 years ago

gravity-form-rest-api v0.1.10

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

Gravity Form REST API v2

The Gravity Form REST API v2 for JavaScript, available for Node.js backends

Installing

The preferred way to install the Gravity Form REST API v2 for Node.js is to use the npm package manager for Node.js. Simply type the following into a terminal window:

npm install gravity-form-rest-api

Then within your application, you can reference to the SDK with the following:

require('gravity-form-rest-api');

Usage and Getting Started

const GFormAPI = require('gravity-form-rest-api');
const GForm = new GFormAPI(API_BASE_URL, API_KEY, API_SECRET_KEY);

function callback(err, res, body) {
  if (err) throw new Error(err);
  console.log(body);
}

Get all form entries

GForm.getEntries(YOUR_FORM_ID, null, callback);

Get single form entry

GForm.getEntries(YOUR_FORM_ID, YOUR_ENTRY_ID, callback);

Add new entry

const example_entry_fields = {
  form_id: YOUR_FORM_ID,
  date_created: '2020-04-30 12:08:23',
  source_url: 'https://domain.local',
  '1': '',
  '2': 'Foo',
  '3': 'Bar',
  '4': '1234567890',
  '5': 'user@email.local',
};
GForm.addEntry(example_entry_fields, callback);

Update entry

const example_entry_fields = {
  form_id: YOUR_FORM_ID,
  date_created: '2020-04-30 12:08:23',
  source_url: 'https://domain.local',
  '1': '',
  '2': 'Foo',
  '3': 'Bar',
  '4': '1234567890',
  '5': 'user@email.local',
};
GForm.updateEntry(YOUR_ENTRY_ID, example_entry_fields, callback);

Delete entry

GForm.deleteEntry(YOUR_ENTRY_ID, callback);

Send notifications

GForm.sendNotifications(YOUR_ENTRY_ID, callback);
0.1.10

4 years ago

0.1.8

4 years ago

0.1.4

4 years ago

0.1.6

4 years ago

0.1.0

4 years ago