Getting started
Back to home
Getting started

Upload a database import

Send import-file bytes through the API with filename in the query string. Uploading the file does not start an import.

PUT/api/customer/v1/projects/{projectId}/databases/{databaseId}/imports/uploads/content

This operation can remove, overwrite or interrupt resources, or grant access. Check the project and resource IDs before sending it.

Path parameters

NameValue
projectIdRequired resource ID from an earlier API response.
databaseIdRequired resource ID from an earlier API response.

Query parameters

NameTypeRequiredLimits
filenamestringYesAt least 1 character(s)

Request body

Send the file bytes with Content-Type: application/octet-stream. Set the required filename query parameter.

Example request

Set HCODE_BASE_URL and HCODE_API_KEY as shown in Getting started. Replace resource variables with your own IDs.

curl --request PUT "$HCODE_BASE_URL/api/customer/v1/projects/${PROJECT_ID}/databases/${DATABASE_ID}/imports/uploads/content?filename=source.zip" \
  --header "Authorization: Bearer $HCODE_API_KEY" \
  --header "Content-Type: application/octet-stream" \
  --data-binary @./source.zip

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.