Home
Version 3
Apps API

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".

Fields

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. 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"}]
application A binary zip file containing the application 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.

Request

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTE2MiIsImVtYWlsIjoiZW1haWwtMTM1QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MTc0NjIzNjF9.4FQAxLIQQLhM_QpEUDpBCpRLBo5CsLJLAMyWCGS5LCs
Host: example.org
Content-Type: multipart/form-data; boundary=AaB03x
Cookie: 

Route

PUT /v2/apps/6178c444-d394-4f2d-b74a-775dbb29403d/bits

Body

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

Response

Headers

Content-Type: application/json;charset=utf-8
X-VCAP-Request-ID: 89acf100-a162-42ec-9b31-287f5061b839
Content-Length: 275
X-Content-Type-Options: nosniff

Status

201 Created

Body

{
  "metadata": {
    "guid": "163e9a5c-c153-4d74-bded-75c2ec3fa50e",
    "created_at": "2014-11-24T19:32:41+00:00",
    "url": "/v2/jobs/163e9a5c-c153-4d74-bded-75c2ec3fa50e"
  },
  "entity": {
    "guid": "163e9a5c-c153-4d74-bded-75c2ec3fa50e",
    "status": "queued"
  }
}