Apps API

Uploads the bits for an App

PUT /v2/apps/:guid/bits

Defines and uploads the bits (artifacts and dependencies) that this application needs to run, using a multipart PUT request. Bits that have already been uploaded can be referenced by their resource fingerprint(s). Bits that have not already been uploaded to Cloud Foundry must be included as a zipped binary file named "application". File mode bits are only presevered for applications run on a Diego backend. If left blank, mode will default to 749, which are also the default bits for a DEA backend. File mode bits are required to have at least the minimum permissions of 0600.

Request

Route

PUT /v2/apps/961f5e5a-3f8b-4204-8d9e-d0c7d8223dbd/bits

Parameters

Name Description Valid Values Example Values
guid The guid of the App
async If true, a new asynchronous job is submitted to persist the bits and the job id is included in the response. The client will need to poll the job's status until persistence is completed successfully. If false, the request will block until the bits are persisted synchronously. Defaults to false.

Body

Name Description Default Valid Values Example Values
resources Fingerprints of the application bits that have previously been pushed to Cloud Foundry. Each fingerprint must include the file path, sha1 hash, and file size in bytes. Each fingerprint may include the file mode, which must be an octal string with at least read and write permissions for owners. If a mode is not provided, the default mode of 0744 will be used. Fingerprinted bits MUST exist in the Cloud Foundry resource cache or the request (or job, if async) will fail.
  • [{"fn":"path/to/content.txt","size":123,"sha1":"b907173290db6a155949ab4dc9b2d019dea0c901"},{"fn":"path/to/code.jar","size":123,"sha1":"ff84f89760317996b9dd180ab996b079f418396f"},{"fn":"path/to/code.jar","size":123,"sha1":"ff84f89760317996b9dd180ab996b079f418396f","mode":"644"}]
application A binary zip file containing the application bits.
--AaB03x
Content-Disposition: form-data; name="async"

true
--AaB03x
Content-Disposition: form-data; name="resources"

[{"fn":"path/to/content.txt","size":123,"sha1":"b907173290db6a155949ab4dc9b2d019dea0c901"},{"fn":"path/to/code.jar","size":123,"sha1":"ff84f89760317996b9dd180ab996b079f418396f"}]
--AaB03x
Content-Disposition: form-data; name="application"; filename="application.zip"
Content-Type: application/zip
Content-Length: 123
Content-Transfer-Encoding: binary

<<binary artifact bytes>>
--AaB03x

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTYiLCJlbWFpbCI6ImVtYWlsLTZAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ2NjAwODg4MX0.5_adJB37XVgCfmildrgy7efQwpOlsa_V1-61L_kT5DY
Host: example.org
Content-Type: multipart/form-data; boundary=----------XnJLe9ZIbbGUYtzPQJ16u1
Cookie: 

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "8d321cee-8633-42e9-a021-78876d0d389c",
    "created_at": "2016-06-08T16:41:21Z",
    "url": "/v2/jobs/8d321cee-8633-42e9-a021-78876d0d389c"
  },
  "entity": {
    "guid": "8d321cee-8633-42e9-a021-78876d0d389c",
    "status": "queued"
  }
}

Headers

Content-Type: application/json;charset=utf-8
X-VCAP-Request-ID: b9c81f5b-6282-41b9-a2ea-70898e32b200
Content-Length: 270
X-Content-Type-Options: nosniff