Code examples
The Domino REST API can be called by any http library in any language following these simple steps:
-
Obtain a valid JWT Access Token from your configured Identity provider. Out of the box, that would be your REST enabled Domino server using a
POST
request with JSONusername
andpassword
as body to the URL/api/v1/auth
. In the resulting JSON, thebearer
is your JWT Access Token. -
Pick the operation you want to complete from the OpenAPI spec and provide the bearer in the
Authorization
header asBearer [insert bearer here]
. You could do a pre-check if the bearer is still valid.
Sample applications
Look at the implemented source code to see a working implementation
Mentioned | Source | Language |
---|---|---|
Walkthrough Lab 06 | Source | NodeJS (OAuth) |
Walkthrough Lab 07 | Source | JavaScript (Browser) |
Walkthrough Lab 08 | Source | Java |
The landing page | use view source |
JavaScript |
Read more details in the sub-pages (menu on the left).
On Postman usage
Postman offers to handle authentication for a user, which is "just" a shiny UI covering what goes into the Authorization
header. For our sample collection, we took a different approach following the 2 steps outlined above. We use a Postman environment to capture the bearer in a test:
-
Have an environment and set the collection to
No Auth
. -
Have a login action that pulls username/password from the environment (you have to add them there).
-
Use the Tests tab to capture the Bearer.
This simplifies operation. running the login action won't require manual copy & paste bearer information anymore
-
In all operations, set the
Authorization
header toBearer {{ AUTH_KEY }}
.
Postman provides code
Activating the code panel </> provides over 30 variations in various programming languages, including shell scripting (curl / powershell), how to code a given call.
Let's connect
We really like to hear from you!
Your opinion matters. Let us know all your:
- questions
- discussions
- ideas
- feedback
Join the OpenNTF Discord channel.