node-pageclip
This is the official node.js API client for Pageclip.
Usage
npm install --save pageclip
Basic usage:
const Pageclip = let pageclip = yourAPIKey // Send an item up to Pageclippageclip
API
Pageclip(apiKey)
Create a Pageclip Object.
apiKey
(String) - found in the web interface of Pageclip. Note thatapiKey
must be the private API key. Your public siteKey will not work!
const Pageclip = let pageclip = 'abc123ABC123abc123abc123abc12345'
Pageclip::send([formName], data)
Send data to Pageclip.
formName
(String; optional; default: 'default') - form to which you want to attachdata
.data
(Object or Array) - data you want to send up. WhenObject
it will treat it as a single Item. IfArray
, it will treat each entry as an Item.- Returns a
Promise
withObject
payload
let pageclip promise datapageclip = 'abc123ABC123abc123abc123abc12345' // Send one itemdata = some: 'data'promise = pageclip // Send multiple itemsdata = some: 'data' some: 'otherdata'promise = pageclip // Send one item to a named formdata = email: 'john@omgunicorns.com'promise = pageclip
Pageclip::fetch([formName])
Retrieve your data from Pageclip. At this time, it returns all items in the form—there is no pagination or slicing.
formName
(String; optional; default: 'default') - form from which you want to fetch data.- Returns a
Promise
withObject
payload
let pageclip promisepageclip = 'api_abc123ABC123abc123abc123abc12345' // Fetch items from the default formpromise = pageclip // Fetch items from a named formpromise = pageclip
Items
All Item objects returned by the API will have the following shape:
itemEid: 'abc123ABC123abc123abc123abc12345' createdAt: '1983-06-29T14:48:00Z' // ISO date payload: // the data from the user
Errors
API errors will return a response with an errors
key that contains an Array of objects:
errors: message: 'Name is required' property: 'name' // If the error is associated with a property ...