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

['api.revision']

Number

Incremented each time a change is implemented in this REST API

Example response

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

{
  "_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/interface%20org.springframework.web.util.UriComponents%24UriTemplateVariables/instances"
    },
    "tasks/definitions" : {
      "href" : "http://localhost:8080/tasks/definitions"
    },
    "tasks/definitions/definition" : {
      "href" : "http://localhost:8080/tasks/definitions/{name}",
      "templated" : true
    },
    "tasks/composed-definitions/compose" : {
      "href" : "http://localhost:8080/tasks/composed-definitions"
    },
    "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"
    },
    "about" : {
      "href" : "http://localhost:8080/about"
    },
    "completions/stream" : {
      "href" : "http://localhost:8080/completions/stream{?start,detailLevel}",
      "templated" : true
    },
    "completions/task" : {
      "href" : "http://localhost:8080/completions/task{?start,detailLevel}",
      "templated" : true
    }
  },
  "api.revision" : 12
}

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: 3880

{
  "_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/interface%20org.springframework.web.util.UriComponents%24UriTemplateVariables/instances"
    },
    "tasks/definitions" : {
      "href" : "http://localhost:8080/tasks/definitions"
    },
    "tasks/definitions/definition" : {
      "href" : "http://localhost:8080/tasks/definitions/{name}",
      "templated" : true
    },
    "tasks/composed-definitions/compose" : {
      "href" : "http://localhost:8080/tasks/composed-definitions"
    },
    "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"
    },
    "about" : {
      "href" : "http://localhost:8080/about"
    },
    "completions/stream" : {
      "href" : "http://localhost:8080/completions/stream{?start,detailLevel}",
      "templated" : true
    },
    "completions/task" : {
      "href" : "http://localhost:8080/completions/task{?start,detailLevel}",
      "templated" : true
    }
  },
  "api.revision" : 12
}

Links

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

RelationDescription

about

Access meta information, including enabled features, security info, version information

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/composed-definitions/compose

Requests the creation of a composed 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 Server Meta Information

A GET request will return meta information for Spring Cloud Data Flow. This includes:

  • Runtime Environment Information
  • Information regarding which features are enabled
  • Dependency information of Spring Cloud Data Flow Server
  • Security information

50.2.1 Request structure

GET /about HTTP/1.1
Accept: application/json
Host: localhost:8080

50.2.2 Request parameters

Unresolved directive in api-guide.adoc - include::/opt/bamboo-home/xml-data/build-dir/SCD-BMASTER-JOB1/spring-cloud-dataflow-docs/target/generated-snippets/about-documentation/get-meta-information/request-parameters.adoc[]

50.2.3 Example request

$ curl 'http://localhost:8080/about' -i -H 'Accept: application/json'

50.2.4 Response structure

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

{
  "featureInfo" : {
    "analyticsEnabled" : true,
    "streamsEnabled" : true,
    "tasksEnabled" : true
  },
  "versionInfo" : {
    "implementation" : {
      "name" : "spring-cloud-starter-dataflow-server-local",
      "version" : "1.2.0.M3"
    },
    "core" : {
      "name" : "Spring Cloud Data Flow Core",
      "version" : "1.2.0.M3"
    },
    "dashboard" : {
      "name" : "Spring Cloud Dataflow UI",
      "version" : "1.2.0.M2"
    },
    "commitId" : null,
    "shortCommitId" : null,
    "commitTime" : null,
    "branch" : null
  },
  "securityInfo" : {
    "authenticationEnabled" : false,
    "authorizationEnabled" : true,
    "formLogin" : false,
    "authenticated" : false,
    "username" : null,
    "roles" : [ ]
  },
  "runtimeEnvironment" : {
    "appDeployer" : {
      "deployerImplementationVersion" : "1.2.0.M3",
      "deployerName" : "LocalAppDeployer",
      "deployerSpiVersion" : "1.2.0.M3",
      "javaVersion" : "1.8.0_121",
      "platformApiVersion" : "Linux 4.4.0-66-generic",
      "platformClientVersion" : "4.4.0-66-generic",
      "platformHostVersion" : "4.4.0-66-generic",
      "platformSpecificInfo" : { },
      "platformType" : "Local",
      "springBootVersion" : "1.5.2.RELEASE",
      "springVersion" : "4.3.6.RELEASE"
    },
    "taskLauncher" : {
      "deployerImplementationVersion" : "1.2.0.M3",
      "deployerName" : "LocalTaskLauncher",
      "deployerSpiVersion" : "1.2.0.M3",
      "javaVersion" : "1.8.0_121",
      "platformApiVersion" : "Linux 4.4.0-66-generic",
      "platformClientVersion" : "4.4.0-66-generic",
      "platformHostVersion" : "4.4.0-66-generic",
      "platformSpecificInfo" : { },
      "platformType" : "Local",
      "springBootVersion" : "1.5.2.RELEASE",
      "springVersion" : "4.3.6.RELEASE"
    }
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/about"
    }
  }
}

50.3 Listing Applications

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

50.3.1 Request structure

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

50.3.2 Request parameters

ParameterDescription

type

Restrict the returned apps to the type of the app.

50.3.3 Example request

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

50.3.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
  }
}