How to modify a project using the Domino API

andrea.lowe Member, Moderator, Domino Posts: 26 mod

The below code shows an example of how to add tags to a project using the Python requests package and our API docs, found here.

Please take care with your API key and treat it as a password. This key can be referenced within Domino as an environment variable - see here for more information.

import requests
import json
import os

#set up API key and headers
api_key = os.environ['DOMINO_USER_API_KEY']
headers = {'X-Domino-Api-Key': api_key,  'Content-Type': 'application/json'}  

#base url
base_url = <your deployment url> #i.e. ''

#get user id
url_user = '{base_url}/v4/users/self'.format(base_url=base_url)
r_user = requests.get(url_user, headers=headers)
user_id = r_user.json()['id']

#get project id
project_name = os.environ['DOMINO_PROJECT_NAME']
url_project = '{base_url}/v4/projects?name={project_name}&ownerId={user_id}'.format(
    base_url=base_url, project_name=project_name, user_id=user_id)
r_project = requests.get(url_project, headers=headers)
project_id = r_project.json()[0]['id']

#set project tag
url_tags = base_url + '/v4/projects/{project_id}/tags'.format(project_id=project_id)
values = """
    "tagNames": [

r =, headers=headers, data=values)


  • andrea.lowe
    andrea.lowe Member, Moderator, Domino Posts: 26 mod

    To do this in R, you can use the following script:

    #store API key in environment variable
    api_key <- Sys.getenv('DOMINO_USER_API_KEY')
    #base url
    base_url <- <your deployment url> #i.e. ''
    #get user id
    url_user <- sprintf("%s/v4/users/self", base_url)
    r_user <- httr::GET(url_user, httr::add_headers('X-Domino-Api-Key'= api_key))
    user_id <-  content(r_user, as="parsed")$id
    #get project id
    project_name <- Sys.getenv('DOMINO_PROJECT_NAME')
    url_project <- sprintf("%s/v4/projects?name=%s&ownerID=%s", base_url, project_name, user_id)
    r_project <- httr::GET(url_project, httr::add_headers('X-Domino-Api-Key'= api_key))
    project_id <-  content(r_project, as="parsed")[[1]]$id
    #set project tag
    url_tags <- sprintf("%s/v4/projects/%s/tags", base_url, project_id)
    r <- httr::POST(url_tags, httr::add_headers('X-Domino-Api-Key'= api_key), 
                    body = list(tagNames=list('time-seriesR')), encode = "json")
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!