-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathexample.js
More file actions
39 lines (22 loc) · 741 Bytes
/
Copy pathexample.js
File metadata and controls
39 lines (22 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use strict';
const KnackHQClient = require('./index.js');
const client = new KnackHQClient({
app_id: 'XXXXXXXXXXXXXXXXXXX',
api_key: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
});
async function knackExample() {
const objects = await client.objects();
const object_key = objects.objects[0].key;
await client.createRecord(object_key, {
field_1: 'Hello, Knack!'
});
let records = await client.records(object_key);
console.log(records);
const record_key = records.records[0].id;
const record = await client.getRecord(object_key, record_key);
console.log(record);
await client.deleteRecord(object_key, record_key);
records = await client.records(object_key);
console.log(records);
}
knackExample();