Create Database
In Postman, add a request to the Collabsphere collection.
- Rename it “Create Visitors NSF”
- Change “GET” to “POST”.
- Set the request URL to “{{SETUPHOST}}/design/nsf?dataSource={{VISITORS}}”.
- On the Headers tab, add a header “Content-Type” set to “application/json”.
-
On the Body tab, select raw and enter:
{ "nsfPath" : "visitors.nsf", "title" : "Visitors Demo" }
- Send the request.
You should receive a response that includes the information about the newly-created NSF.
Create Scope
- Add a request as previously.
- Rename it “Create Scope”
- Change “GET” to “POST”.
- Set the request URL to “{{SETUPHOST}}/admin/scope?createSchema=true”.
- On the Headers tab, add a header “Content-Type” set to “application/json”.
-
On the Body tab, select raw and enter:
{ "apiName": "{{VISITORS}}", "schemaName": "{{VISITORS}}", "nsfPath": "visitors.nsf", "isActive": true }
- Send the request.
Create Form
Add another request.
- Rename it “Create Visitors Form”
- Change “GET” to “PUT”.
- Set the request URL to “{{SETUPHOST}}/design/forms/Visitor?dataSource={{VISITORS}}”.
- On the Headers tab, add a header “Content-Type” set to “application/json”.
-
On the Body tab, select raw and enter:
{ "name" : "Visitor", "alias": "", "fields" : [ { "name" : "first_name", "type": "text", "allowmultivalues" : false }, { "name" : "last_name", "type": "text", "allowmultivalues" : false }, { "name" : "company", "type": "text", "allowmultivalues" : false }, { "name" : "time_in", "type": "datetime", "allowmultivalues" : false }, { "name" : "time_out", "type": "datetime", "allowmultivalues" : false }, { "name" : "badgeNo", "type": "text", "allowmultivalues" : false } ] }
This creates the Form with six text fields, all single value - first_name, last_name, company, time_in, time_out, badgeNo.
- Send the request.
You should receive a 200 JSON response echoing the schema configuration.
Create By Name View
Add another request.
- Rename it to “Create Visitors By Name”
- Change “GET” to “PUT”
- Set the request URL to “{{SETUPHOST}}/design/views/byName?dataSource={{VISITORS}}”.
- On the Headers tab, add a header “Content-Type” set to “application/json”.
-
On the Body tab, select raw and enter:
{ "name" : "byName", "selectionFormula" : "Form = \"Visitor\"", "columns" : [ { "name": "first_name", "title": "First Name", "separatemultiplevalues": false, "sort": "ascending", "formula": "first_name" }, { "name": "last_name", "title": "Last Name", "separatemultiplevalues": false, "sort": "ascending", "formula": "last_name" }, { "name": "company", "title": "Company", "separatemultiplevalues": false, "sort": "ascending", "formula": "company" }, { "name": "time_in", "title": "Time In", "separatemultiplevalues": false, "sort": "ascending", "formula": "time_in" }, { "name": "time_out", "title": "Time Out", "separatemultiplevalues": false, "sort": "ascending", "formula": "time_out" }, { "name": "badgeNo", "title": "Badge Number", "separatemultiplevalues": false, "sort": "ascending", "formula": "badgeNo" } ] }
- Send the request.
You should receive a JSON response {"success": true}
.
Create By Badge View
Add another request.
- Rename it to “Create View By Badge”
- Change “GET” to “PUT”
- Set the request URL to “{{SETUPHOST}}/design/views/byBadge?db={{VISITORS}}”.
- On the Headers tab, add a header “Content-Type” set to “application/json”.
-
On the Body tab, select raw and enter:
{ "name" : "byBadge", "selectionFormula" : "Form = \"Visitor\" & time_out = \"\"", "columns" : [ { "name": "badgeNo", "title": "Badge Number", "separatemultiplevalues": false, "sort": "ascending", "formula": "badgeNo" }, { "name": "first_name", "title": "First Name", "separatemultiplevalues": false, "sort": "ascending", "formula": "first_name" }, { "name": "last_name", "title": "Last Name", "separatemultiplevalues": false, "sort": "ascending", "formula": "last_name" }, { "name": "company", "title": "Company", "separatemultiplevalues": false, "sort": "ascending", "formula": "company" }, { "name": "time_in", "title": "Time In", "separatemultiplevalues": false, "sort": "ascending", "formula": "time_in" } ] }
This view is sorted on badge number, so we can check people out, but only including entries with no time out
- Send the request.
You should receive a JSON response {"success": true}
.
Update the Schema
Add another request.
- Rename it “Get Visitors Schema”
- Set the request URL to “{{SETUPHOST}}/schema?configName={{VISITORS}}&nsfPath=visitors.nsf”.
- Send the request.
The response will be the current schema, which can be used to update the schema.
Add a request as previously.
- Rename it “Update Visitors Schema”
- Change “GET” to “POST”.
- Set the request URL to “{{SETUPHOST}}/schema?configName={{VISITORS}}&nsfPath=visitors.nsf”.
- On the Headers tab, add a header “Content-Type” set to “application/json”.
-
On the Body tab, select raw and enter:
{ "nsfPath": "visitors.nsf", "iconName": "postcard", "icon": "Base64 stuff, preferably SVG", "description": "Visitors Demo", "formulaEngine": "domino", "schemaName": "visitors", "requireRevisionToUpdate": false, "allowDecryption": false, "cacheTimestamp": 1, "dqlAccess": false, "dqlFormula": { "formulaType": "domino", "formula": "@False" }, "allowCode": false, "openAccess": true, "forms": [ { "formName": "Visitor", "formModes": [ { "modeName": "default", "computeWithForm": false, "readAccessFormula": { "formulaType": "domino", "formula": "@True" }, "writeAccessFormula": { "formulaType": "domino", "formula": "@True" }, "deleteAccessFormula": { "formulaType": "domino", "formula": "@False" }, "fields": [ { "name": "first_name", "isMultiValue": false, "writeOnly": false, "readOnly": false, "format": "string", "type": "string" }, { "name": "last_name", "isMultiValue": false, "writeOnly": false, "readOnly": false, "format": "string", "type": "string" }, { "name": "company", "isMultiValue": false, "writeOnly": false, "readOnly": false, "format": "string", "type": "string" }, { "name": "time_in", "isMultiValue": false, "writeOnly": false, "readOnly": false, "format": "date-time", "type": "string" }, { "name": "time_out", "isMultiValue": false, "writeOnly": false, "readOnly": false, "format": "date-time", "type": "string" }, { "name": "badgeNo", "isMultiValue": false, "writeOnly": false, "readOnly": false, "format": "string", "type": "string" } ], "strictInput": true } ] } ], "isActive": true, "prohibitRefresh": true, "@unid": "3A763052FED029BCC125888E004AB270", "views": [ { "name": "byBadge", "alias": [ "byBadge" ], "unid": "285345B8A85520CDC125888E004B2B77" }, { "name": "byName", "alias": [ "byName" ], "unid": "27C92F678277FD95C125888E004B2788" } ] }
- Send the request.
Now we are ready to interact with the database via Node-RED.
Previous Page Next Page