Calling Domino REST API from Python/Jupyter

katie.shakman Administrator, Domino Posts: 257 admin
edited April 2020 in Tutorials & Best Practices

Here's some example code that shows you how to call the Domino REST API to get info on your current user, from within a Domino interactive workspace or batch run. This example can be copied into a python notebook or script and should run without modification inside of a Domino run or workspace, since we provide all the required environment variables by default.

import requests
import json
import os

HOST = os.environ['DOMINO_API_HOST']
URL = HOST + '/v4/users/self'

And here's a screenshot showing this in a Domino Jupyter session

As always, please take care with your API key and treat it as a password (don't print it out in your notebook!)

Give the approach above a try and let us know if you have any questions or feedback.


Field Data Scientist @ Domino

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!