API node administration API

The API node can be managed through:

The REST API

Request and response formats

For POST and PUT requests, the request body must be JSON, with the Content-Type header set to application/json.

For almost all requests, the response will be JSON.

Whether a request succeeded is indicated by the HTTP status code. A 2xx status code indicates success, whereas a 4xx or 5xx status code indicates failure. When a request fails, the response body is still JSON and contains additional information about the error.

Authentication

Authentication on the admin API is done via the use of API keys. API keys can be managed using the apinode-admin command-line tool.

The API key must be sent using HTTP Basic Authorization:

  • Use the API key as username

  • The password can remain blank

Methods reference

The reference documentation of the API is available at https://doc.dataiku.com/dss/api/12/apinode-admin

Admin REST API Python client

Dataiku provides a Python client for the API Node administration API. The client makes it easy to write client programs for the API in Python.

Installing

  • The API client is already pre-installed in the DSS Python environment

  • From outside of DSS, you can install the Python client by running pip install dataiku-api-client

Reference API doc

class dataikuapi.APINodeAdminClient(uri, api_key)

Entry point for the DSS APINode admin client

create_service(service_id)

Creates a new API service

Parameters:

service_id – id of the created API service

list_services()

Lists the currently declared services and their enabled/disabled state

Returns:

a dict of services containing their id and state, as a JSON object

Return type:

dict

service(service_id)

Gets a handle to interact with a service

Parameters:

service_id – id of requested service

Return type:

class:

dataikuapi.apinode_admin.service.APINodeService

auth()

Returns a handle to interact with authentication

Return type:

class:

dataikuapi.apinode_admin.auth.APINodeAuth

get_metrics()

Get the metrics for this API Node

Returns:

the metrics, as a JSON object

Return type:

dict

import_code_env_in_cache(file_dir, language)

Import a code env in global cache from an exported code env base folder

Parameters:
  • file_dir – path of an exported code env base folder

  • language – language of the code env (python or R)

register_code_env_in_cache(exported_env_dir, built_env_dir, language)

Import a code env in global cache from an exported code env base folder

Parameters:
  • exported_env_dir – path of an exported code env base folder

  • built_env_dir – path where the code env was built and is available

  • language – language of the code env (python or R)

import_model_archive_in_cache(model_archive_path)

Import a model in model cache from an exported model archive

Parameters:

model_archive_path – path of an exported model archive

clear_model_cache()

Clear the model cache

class dataikuapi.apinode_admin.service.APINodeService(client, service_id)

A handle to interact with the settings of an API node service

delete()

Deletes the API node service

list_generations()
import_generation_from_archive(file_path)
preload_generation(generation)
disable()

Disable the service.

enable()
set_generations_mapping(mapping)

Setting a generations mapping automatically enables the service

switch_to_newest()
switch_to_single_generation(generation)
class dataikuapi.apinode_admin.auth.APINodeAuth(client)

A handle to interact with authentication settings on API node

list_keys()

Lists the Admin API keys

add_key(label=None, description=None, created_by=None)

Add an Admin API key. Returns the key details

delete_key(key)