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.eyJ1c2VyX2lkIjoidWFhLWlkLTM4NyIsImVtYWlsIjoiZW1haWwtMjg5QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MjQxMzczODF9.JsxR9KSpPmVx5ieV1crFaR7PkfHHy38ov2WkLDNVdlE
Host: example.org
Content-Type: multipart/form-data; boundary=AaB03x
Cookie: 

Route

PUT /v2/apps/f2fc5512-99d0-49db-969a-95f86a2467ed/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: 172ba185-f2ee-4584-a72a-3dba3efb466a
Content-Length: 270
X-Content-Type-Options: nosniff

Status

201 Created

Body

{
  "metadata": {
    "guid": "8fd0ff07-26d7-4c26-ae79-b286f723eeb6",
    "created_at": "2015-02-10T01:43:01Z",
    "url": "/v2/jobs/8fd0ff07-26d7-4c26-ae79-b286f723eeb6"
  },
  "entity": {
    "guid": "8fd0ff07-26d7-4c26-ae79-b286f723eeb6",
    "status": "queued"
  }
}