Deploy files
Send the project's files as JSON and deploy them in one call: HCode zips them, uploads the archive and starts a deploy, as if you had uploaded a ZIP. Send files as [{path, content}] (content is UTF-8 text, or base64 with encoding: "base64" for images and other binary files), or a whole ZIP as base64 in archive. Paths are relative to the project root, such as index.html or src/server.js. The request body is limited to 1 MiB; upload a ZIP with createSourceUpload for larger projects. The project must exist: send files to createApplicationProject to create one from them. Returns uploadId and deploymentId: wait on the deployment with getDeployment and waitSeconds.
/api/customer/v1/projects/{projectId}/deploy-filesSend an Idempotency-Key header. Keep the same value when retrying this exact request. A different payload needs a new key.
Path parameters
| Name | Value |
|---|---|
projectId | Required resource ID from an earlier API response. |
Request body
Send JSON with Content-Type: application/json. Nested fields and accepted values are listed in the schema.
| Field | Type | Required |
|---|---|---|
files | object[] | No |
archive | string | No |
Full request schema
{
"type": "object",
"properties": {
"files": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string",
"minLength": 1
},
"content": {
"type": "string"
},
"encoding": {
"type": "string",
"enum": [
"utf8",
"base64"
]
}
},
"required": [
"path",
"content"
],
"additionalProperties": false
}
},
"archive": {
"type": "string",
"minLength": 1
}
},
"required": [],
"additionalProperties": false
}Example request
Set HCODE_BASE_URL and HCODE_API_KEY as shown in Getting started. Replace resource variables with your own IDs.
Set REQUEST_ID to a unique value for this request.
curl --request POST "$HCODE_BASE_URL/api/customer/v1/projects/${PROJECT_ID}/deploy-files" \
--header "Authorization: Bearer $HCODE_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--header "Content-Type: application/json" \
--data '{
"files": [
{
"path": "REPLACE_WITH_PATH",
"content": "REPLACE_WITH_CONTENT"
}
]
}' Response
The JSON shape is defined in the response schema.
Queued work returns HTTP 202 with an operation handle. Poll that handle to find out whether the work succeeded.
Response schema
{
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"message": {
"type": "string"
},
"operationId": {
"type": "string"
},
"operation": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"operationId": {
"type": "string"
},
"status": {
"type": "string"
},
"type": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"errorMessage": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"createdAt": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"startedAt": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"finishedAt": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": [
"id",
"status"
],
"additionalProperties": true
},
"deploymentId": {
"type": "string"
},
"uploadId": {
"type": "string"
},
"archiveBytes": {
"type": "integer"
},
"operations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"status": {
"type": "string"
},
"href": {
"type": "string"
}
},
"required": [
"id",
"status",
"href"
]
}
}
},
"required": [
"uploadId"
],
"additionalProperties": true
}See errors and retries for failure responses.