Getting started
Prepare a source upload
Create a direct-upload target for a source archive. Transfer the bytes using the returned instructions, then call completeSourceUpload.
POST
/api/customer/v1/source/uploadsRequest body
Send JSON with Content-Type: application/json. Nested fields and accepted values are listed in the schema.
| Field | Type | Required |
|---|---|---|
filename | string | Yes |
sizeBytes | integer | Yes |
contentType | string | No |
projectId | string | No |
Full request schema
{
"type": "object",
"properties": {
"filename": {
"type": "string",
"minLength": 1
},
"sizeBytes": {
"type": "integer",
"minimum": 1
},
"contentType": {
"type": "string"
},
"projectId": {
"type": "string",
"minLength": 1
}
},
"required": [
"filename",
"sizeBytes"
],
"additionalProperties": false
}Example request
Set HCODE_BASE_URL and HCODE_API_KEY as shown in Getting started. Replace resource variables with your own IDs.
curl --request POST "$HCODE_BASE_URL/api/customer/v1/source/uploads" \
--header "Authorization: Bearer $HCODE_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"filename": "source.zip",
"sizeBytes": 1048576
}' Response
The JSON shape is defined in the response schema.
Response schema
{
"type": "object",
"properties": {
"uploadId": {
"type": "string"
},
"expiresAt": {
"type": "string"
},
"sizeBytes": {
"type": "integer"
},
"filename": {
"type": "string"
},
"directUpload": {
"type": "object",
"properties": {
"url": {
"type": "string"
},
"method": {
"type": "string"
},
"headers": {
"type": "object",
"additionalProperties": true
}
},
"required": [
"url",
"method",
"headers"
],
"additionalProperties": true
},
"operationId": {
"type": "string"
},
"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.