Create Customer Form
- Hover over the
Domino-REST-API-NewDB
collection name and click on the ellipsis (three dots). Select Add Request. - Name the request
customer form
and click Save. - Change the method from GET to PUT.
- Set the URL as
{{SETUP_HOST}}/design/forms/Customer?nsfPath=customers.nsf
. - On the Headers tab, add a HTTP request header called Authorization with the value
{{bearer}}
. This maps to the bearer collection variable we set from theauthenticate
request. - Add an HTTP request header Content-Type set to
application/json
. - On the Body tab change the type to
Raw
and also change the type fromText
toJSON
. -
Set the request body content to:
{ "name": "Customer", "alias": "", "fields": [ { "name": "name", "type": "text", "allowmultivalues": false }, { "name": "category", "type": "text", "allowmultivalues": true }, { "name": "address1", "type": "text", "allowmultivalues": false }, { "name": "address2", "type": "text", "allowmultivalues": false }, { "name": "city", "type": "text", "allowmultivalues": false }, { "name": "state", "type": "text", "allowmultivalues": false }, { "name": "zipCode", "type": "text", "allowmultivalues": false }, { "name": "website", "type": "text", "allowmultivalues": false }, { "name": "status", "type": "text", "allowmultivalues": false } ] }
- Click Send to make the request.
- Save and close the request.
If you get a 404 message, verify the method is PUT and the Content-Type header is set correctly. The same endpoint is used for creating or updating forms, so it is a PUT rather than a POST.
Note
For Domino REST API, Forms have to explicitly be enabled. Otherwise documents saved with that Form will not be returned by the API. Creating a Form via Domino REST API will automatically create a blank Form Access Mode called default
. However, no fields are enabled at this point.
Form Access Modes provide more granular access to documents that use a specific Form. You can:
- Restrict access to certain fields on the form for read or write access.
- Restrict who can read, write or delete documents at that mode.
- For read access, compute additional fields not stored on the document, e.g. concatenating a name or an address.
- Compute additional fields to be saved to the document, e.g. a Status field, to ensure documents cannot be created with arbitrary statuses.
Congratulations!
This has:
- Created the Customer form in the customers database.