API Reference

DC/OS NiFi Service API Reference

The DC/OS NiFi Service implements a REST API that may be accessed from outside the cluster. The <dcos_url> parameter referenced below indicates the base URL of the DC/OS cluster on which the DC/OS NiFi Service is deployed.

REST API Authentication

REST API requests must be authenticated. This authentication is only applicable for interacting with the NiFi REST API directly. You do not need the token to access the NiFi nodes themselves.

If you are using Enterprise DC/OS, follow these instructions to create a service account and an authentication token. You can then configure your service to automatically refresh the authentication token when it expires. To get started more quickly, you can also get the authentication token without a service account, but you will need to manually refresh the token.

If you are using open source DC/OS, follow these instructions to pass your HTTP API token to the DC/OS endpoint.

Once you have the authentication token, you can store it in an environment variable and reference it in your REST API calls:

export auth_token=uSeR_t0k3n

The curl examples in this document assume that an auth token has been stored in an environment variable named auth_token.

If you are using Enterprise DC/OS, the security mode of your installation may also require the --ca-cert flag when making REST calls. Refer to Obtaining and passing the DC/OS certificate in cURL requests for information on how to use the --cacert flag. If your security mode is disabled, do not use the --ca-cert flag.

Plan API

The Plan API provides endpoints for monitoring and controlling service installation and configuration updates.

List plans

You may list the configured plans for the service. By default, all services at least have a deploy plan and a recovery plan. Some services may have additional custom plans defined.

curl -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/plans
dcos nifi --name=nifi plan list

View plan

You may view the current state of a listed plan:

curl -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/plans/<plan>

The CLI may be used to show a formatted tree of the plan (default), or the underlying JSON data as retrieved from the above HTTP endpoint:

dcos nifi --name=nifi plan show <plan>
dcos nifi --name=nifi plan show <plan> --json

Pause plan

The installation will pause after completing the operation of the current node and wait for user input before proceeding further.

curl -X POST -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/plans/deploy/interrupt
dcos nifi --name=nifi plan pause deploy

Resume plan

The REST API request below will resume the operation at the next pending node.

curl -X PUT -H "Authorization:token=$auth_token" <dcos_surl>/service/nifi/v1/plans/deploy/continue
dcos nifi --name=nifi plan continue deploy

Nodes API

The pod API provides endpoints for retrieving information about nodes, restarting them, and replacing them.

List Nodes

A list of available node ids can be retrieved by sending a GET request to /v1/pod:

CLI Example

dcos nifi --name=nifi pod list

HTTP Example

curl -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/pod

Node Info

You can retrieve node information by sending a GET request to /v1/pod/<node-id>/info:

curl  -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/pod/<node-id>/info

CLI Example

dcos nifi --name=nifi pod info journalnode-0

HTTP Example

curl  -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/pod/journalnode-0/info

Replace a Node

The replace endpoint command can be used to replace a node with an instance running on another agent node.

CLI Example

dcos nifi --name=nifi pod replace <node-id>

HTTP Example

curl -X POST -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/pod/<node-id>/replace

If the operation succeeds, a 200 OK is returned.

Restart a Node

The restart endpoint command can be used to restart a node in place on the same agent node.

CLI Example

dcos nifi --name=nifi pod restart <node-id>

HTTP Example

curl -X POST -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/pod/<node-id>/restart

If the operation succeeds a 200 OK is returned.

Pause a Node

The pause endpoint command can be used to relaunch a node in an idle command state for debugging purposes.

CLI example

dcos nifi --name=nifi debug pod pause <node-id>

HTTP Example

curl -X POST -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/pod/<node-id>/pause

Configuration API

The configuration API provides an endpoint to view current and previous configurations of the cluster.

View Target Config

You can view the current target configuration by sending a GET request to /v1/configurations/target.

CLI Example

dcos nifi --name=nifi config target

HTTP Example

curl -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/configurations/target

List Configs

You can list all configuration IDs by sending a GET request to /v1/configurations.

CLI Example

dcos nifi --name=nifi config list
[
  "319ebe89-42e2-40e2-9169-8568e2421023",
  "294235f2-8504-4194-b43d-664443f2132b"
]

HTTP Example

curl -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/configurations
[
  "319ebe89-42e2-40e2-9169-8568e2421023",
  "294235f2-8504-4194-b43d-664443f2132b"
]

View Specified Config

You can view a specific configuration by sending a GET request to /v1/configurations/<config-id>.

CLI Example

dcos nifi --name=nifi config show 9a8d4308-ab9d-4121-b460-696ec3368ad6

HTTP Example

curl -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/configurations/9a8d4308-ab9d-4121-b460-696ec3368ad6

Service Status Info

Send a GET request to the /v1/state/properties/suppressed endpoint to learn if DC/OS NiFi is in a suppressed state and not receiving offers. If a service does not need offers, Mesos can “suppress” it so that other services are not starved for resources. You can use this request to troubleshoot: if you think DC/OS NiFi should be receiving resource offers, but is not, you can use this API call to see if DC/OS NiFi is suppressed.

curl -H "Authorization: token=$auth_token" "<dcos_url>/service/nifi/v1/state/properties/suppressed"

DC/OS NiFi Node Operations

These operations provide access to the DC/OS NiFi cluster node using the available DC/OS NiFi REST API. The Rest API provides programmatic access to command and control a DC/OS NiFi instance in real time. You can see the DC/OS NiFi REST API for more about the available API.

List DC/OS NiFi Cluster Summary

CLI Example

dcos nifi cluster summary

HTTP Example

curl -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/cluster/

List DC/OS NiFi Node

CLI Example

dcos nifi node list

HTTP Example

curl -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/nodes/

List DC/OS NiFi Node for a status

CLI Example

dcos nifi node list_for_status <nifi_node_status>

HTTP Example

curl -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/nodes/status/<nifi_node_status>

Details of a DC/OS NiFi Node

CLI Example

dcos nifi node get <nifi_node_id>

HTTP Example

curl -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/nodes/<nifi_node_id>

Remove a DC/OS NiFi Node

CLI Example

dcos nifi node remove <nifi_node_id>

HTTP Example

curl -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/nodes/remove/<nifi_node_id>

Control DC/OS NiFi Node using GET endpoint

All DC/OS NiFi endpoints uses GET method can be accessed from either the DC/OS CLI or HTTP.

CLI Example

dcos nifi api get <nifi_get_endpoints_uri>

HTTP Example

curl -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/nifi-api/get?uri=<nifi_get_endpoints_uri>

Control DC/OS NiFi Node using POST endpoint

All DC/OS NiFi endpoints uses POST method can be accessed from either the DC/OS CLI or HTTP.

CLI Example

dcos nifi api post <nifi_post_endpoints_uri> stdin
{
  "id": "",
  "service": ""
}

OR

dcos nifi api post <nifi_post_endpoints_uri> <json_payload_file>

HTTP Example

curl -X POST -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/nifi-api/post?uri=<nifi_post_endpoints_uri>
{
  "id": "",
  "service": ""
}

Control DC/OS NiFi Node using PUT endpoint

All DC/OS NiFi endpoints using the PUT method can be accessed from either the DC/OS CLI or HTTP.

CLI Example

dcos nifi api put <nifi_put_endpoints_uri> stdin
{
  "id": "",
  "service": ""
}

OR

dcos nifi api post <nifi_put_endpoints_uri> <json_payload_file>

HTTP Example

curl -X PUT -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/nifi-api/put?uri=<nifi_put_endpoints_uri>
{
  "id": "",
  "service": ""
}

Control DC/OS NiFi Node using DELETE endpoint

All DC/OS NiFi endpoints using the DELETE method can be accessed from either the DC/OS CLI or HTTP.

CLI Example

dcos nifi api delete <nifi_delete_endpoints_uri>

HTTP Example

curl -X DELETE -H "Authorization:token=$auth_token" <dcos_url>/service/nifi/v1/nifi-api/delete?uri=<nifi_delete_endpoints_uri>

Connection API

curl -H "Authorization:token=$auth_token" dcos_url/service/nifi/v1/endpoints/<endpoint>

You will see a response similar to the following:

{
  "address": [
    "10.0.1.120:1025",
    "10.0.1.128:1025"
  ],
  "dns": [
    "nifi-0-node.nifi.autoip.dcos.thisdcos.directory:1025",
    "nifi-1-node.nifi.autoip.dcos.thisdcos.directory:1025"
  ],
  "vip": "node.nifi.l4lb.thisdcos.directory:8080"
}