50. Resources

50.1 Index

The index provides the entry point into Spring Cloud Data Flow’s REST API.

50.1.1 Accessing the index

A GET request is used to access the index

Request structure

GET / HTTP/1.1
Host: localhost:8080

Example request

$ curl 'http://localhost:8080/' -i

Response structure

PathTypeDescription

_links

Object

Links to other resources

Example response

HTTP/1.1 200 OK
Content-Type: application/hal+json;charset=UTF-8
Content-Length: 3627

{
  "_links" : {
    "dashboard" : {
      "href" : "http://localhost:8080/dashboard"
    },
    "streams/definitions" : {
      "href" : "http://localhost:8080/streams/definitions"
    },
    "streams/definitions/definition" : {
      "href" : "http://localhost:8080/streams/definitions/{name}",
      "templated" : true
    },
    "streams/deployments" : {
      "href" : "http://localhost:8080/streams/deployments"
    },
    "streams/deployments/deployment" : {
      "href" : "http://localhost:8080/streams/deployments/{name}",
      "templated" : true
    },
    "runtime/apps" : {
      "href" : "http://localhost:8080/runtime/apps"
    },
    "runtime/apps/app" : {
      "href" : "http://localhost:8080/runtime/apps/{appId}",
      "templated" : true
    },
    "runtime/apps/instances" : {
      "href" : "http://localhost:8080/runtime/apps/{appId}/instances",
      "templated" : true
    },
    "tasks/definitions" : {
      "href" : "http://localhost:8080/tasks/definitions"
    },
    "tasks/definitions/definition" : {
      "href" : "http://localhost:8080/tasks/definitions/{name}",
      "templated" : true
    },
    "tasks/executions" : {
      "href" : "http://localhost:8080/tasks/executions"
    },
    "tasks/executions/name" : {
      "href" : "http://localhost:8080/tasks/executions{?name}",
      "templated" : true
    },
    "tasks/executions/execution" : {
      "href" : "http://localhost:8080/tasks/executions/{id}",
      "templated" : true
    },
    "jobs/executions" : {
      "href" : "http://localhost:8080/jobs/executions"
    },
    "jobs/executions/name" : {
      "href" : "http://localhost:8080/jobs/executions{?name}",
      "templated" : true
    },
    "jobs/executions/execution" : {
      "href" : "http://localhost:8080/jobs/executions/{id}",
      "templated" : true
    },
    "jobs/executions/execution/steps" : {
      "href" : "http://localhost:8080/jobs/executions/{jobExecutionId}/steps",
      "templated" : true
    },
    "jobs/executions/execution/steps/step" : {
      "href" : "http://localhost:8080/jobs/executions/{jobExecutionId}/steps/{stepId}",
      "templated" : true
    },
    "jobs/executions/execution/steps/step/progress" : {
      "href" : "http://localhost:8080/jobs/executions/{jobExecutionId}/steps/{stepId}/progress",
      "templated" : true
    },
    "jobs/instances/name" : {
      "href" : "http://localhost:8080/jobs/instances{?name}",
      "templated" : true
    },
    "jobs/instances/instance" : {
      "href" : "http://localhost:8080/jobs/instances/{id}",
      "templated" : true
    },
    "counters" : {
      "href" : "http://localhost:8080/metrics/counters"
    },
    "counters/counter" : {
      "href" : "http://localhost:8080/metrics/counters/{name}",
      "templated" : true
    },
    "field-value-counters" : {
      "href" : "http://localhost:8080/metrics/field-value-counters"
    },
    "field-value-counters/counter" : {
      "href" : "http://localhost:8080/metrics/field-value-counters/{name}",
      "templated" : true
    },
    "aggregate-counters" : {
      "href" : "http://localhost:8080/metrics/aggregate-counters"
    },
    "aggregate-counters/counter" : {
      "href" : "http://localhost:8080/metrics/aggregate-counters/{name}",
      "templated" : true
    },
    "apps" : {
      "href" : "http://localhost:8080/apps"
    },
    "completions/stream" : {
      "href" : "http://localhost:8080/completions/stream{?start,detailLevel}",
      "templated" : true
    },
    "completions/task" : {
      "href" : "http://localhost:8080/completions/task{?start,detailLevel}",
      "templated" : true
    }
  }
}

Example "stream create" request for a ticktock stream

curl -X POST -d "name=ticktock&definition=time | log" localhost:9393/streams/definitions?deploy=false

Example "stream deploy" request for a ticktock stream

curl -X POST http://localhost:9393/streams/deployments/ticktock
HTTP/1.1 200 OK
Content-Type: application/hal+json;charset=UTF-8
Content-Length: 3627

{
  "_links" : {
    "dashboard" : {
      "href" : "http://localhost:8080/dashboard"
    },
    "streams/definitions" : {
      "href" : "http://localhost:8080/streams/definitions"
    },
    "streams/definitions/definition" : {
      "href" : "http://localhost:8080/streams/definitions/{name}",
      "templated" : true
    },
    "streams/deployments" : {
      "href" : "http://localhost:8080/streams/deployments"
    },
    "streams/deployments/deployment" : {
      "href" : "http://localhost:8080/streams/deployments/{name}",
      "templated" : true
    },
    "runtime/apps" : {
      "href" : "http://localhost:8080/runtime/apps"
    },
    "runtime/apps/app" : {
      "href" : "http://localhost:8080/runtime/apps/{appId}",
      "templated" : true
    },
    "runtime/apps/instances" : {
      "href" : "http://localhost:8080/runtime/apps/{appId}/instances",
      "templated" : true
    },
    "tasks/definitions" : {
      "href" : "http://localhost:8080/tasks/definitions"
    },
    "tasks/definitions/definition" : {
      "href" : "http://localhost:8080/tasks/definitions/{name}",
      "templated" : true
    },
    "tasks/executions" : {
      "href" : "http://localhost:8080/tasks/executions"
    },
    "tasks/executions/name" : {
      "href" : "http://localhost:8080/tasks/executions{?name}",
      "templated" : true
    },
    "tasks/executions/execution" : {
      "href" : "http://localhost:8080/tasks/executions/{id}",
      "templated" : true
    },
    "jobs/executions" : {
      "href" : "http://localhost:8080/jobs/executions"
    },
    "jobs/executions/name" : {
      "href" : "http://localhost:8080/jobs/executions{?name}",
      "templated" : true
    },
    "jobs/executions/execution" : {
      "href" : "http://localhost:8080/jobs/executions/{id}",
      "templated" : true
    },
    "jobs/executions/execution/steps" : {
      "href" : "http://localhost:8080/jobs/executions/{jobExecutionId}/steps",
      "templated" : true
    },
    "jobs/executions/execution/steps/step" : {
      "href" : "http://localhost:8080/jobs/executions/{jobExecutionId}/steps/{stepId}",
      "templated" : true
    },
    "jobs/executions/execution/steps/step/progress" : {
      "href" : "http://localhost:8080/jobs/executions/{jobExecutionId}/steps/{stepId}/progress",
      "templated" : true
    },
    "jobs/instances/name" : {
      "href" : "http://localhost:8080/jobs/instances{?name}",
      "templated" : true
    },
    "jobs/instances/instance" : {
      "href" : "http://localhost:8080/jobs/instances/{id}",
      "templated" : true
    },
    "counters" : {
      "href" : "http://localhost:8080/metrics/counters"
    },
    "counters/counter" : {
      "href" : "http://localhost:8080/metrics/counters/{name}",
      "templated" : true
    },
    "field-value-counters" : {
      "href" : "http://localhost:8080/metrics/field-value-counters"
    },
    "field-value-counters/counter" : {
      "href" : "http://localhost:8080/metrics/field-value-counters/{name}",
      "templated" : true
    },
    "aggregate-counters" : {
      "href" : "http://localhost:8080/metrics/aggregate-counters"
    },
    "aggregate-counters/counter" : {
      "href" : "http://localhost:8080/metrics/aggregate-counters/{name}",
      "templated" : true
    },
    "apps" : {
      "href" : "http://localhost:8080/apps"
    },
    "completions/stream" : {
      "href" : "http://localhost:8080/completions/stream{?start,detailLevel}",
      "templated" : true
    },
    "completions/task" : {
      "href" : "http://localhost:8080/completions/task{?start,detailLevel}",
      "templated" : true
    }
  }
}

Links

The main element of the index are the links as they allow you to traverse the API and execute the desired functionality:

RelationDescription

dashboard

Access the dashboard UI

apps

Handle registered applications

completions/stream

Exposes the DSL completion features for Stream

completions/task

Exposes the DSL completion features for Task

jobs/executions

Provides the JobExecution resource

jobs/executions/execution

Provides details for a specific JobExecution

jobs/executions/execution/steps

Provides the steps for a JobExecution

jobs/executions/execution/steps/step

Returns the details for a specific step

jobs/executions/execution/steps/step/progress

Provides progress information for a specific step

jobs/executions/name

Retrieve Job Executions by Job name

jobs/instances/instance

Provides the job instance resource for a specific job instance

jobs/instances/name

Provides the Job instance resource for a specific job name

runtime/apps

Provides the runtime application resource

runtime/apps/app

Exposes the runtime status for a specific app

runtime/apps/instances

Provides the status for app instances

tasks/definitions

Provides the task definition resource

tasks/definitions/definition

Provides details for a specific task definition

tasks/executions

Returns Task executions and allows lanching of tasks

tasks/executions/name

Returns all task executions for a given Task name

tasks/executions/execution

Provides details for a specific task execution

streams/definitions

Exposes the Streams resource

streams/definitions/definition

Handle a specific Stream definition

streams/deployments

Provides Stream deployment operations

streams/deployments/deployment

Request (un-)deployment of an existing stream definition

counters

Exposes the resource for dealing with Counters

counters/counter

Handle a specific counter

aggregate-counters

Provides the resource for dealing with aggregate counters

aggregate-counters/counter

Handle a specific aggregate counter

field-value-counters

Provides the resource for dealing with field-value-counters

field-value-counters/counter

Handle a specific field-value-counter

50.2 Listing Applications

A GET request will list all applications known to Spring Cloud Data Flow.

50.2.1 Request structure

GET /apps?type=source HTTP/1.1
Accept: application/json
Host: localhost:8080

50.2.2 Request parameters

ParameterDescription

type

Restrict the returned apps to the type of the app.

50.2.3 Example request

$ curl 'http://localhost:8080/apps?type=source' -i -H 'Accept: application/json'

50.2.4 Response structure

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 185

{
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/apps"
    }
  },
  "page" : {
    "size" : 0,
    "totalElements" : 0,
    "totalPages" : 1,
    "number" : 0
  }
}