Skip to main content

raw-file-quickstart

Last updated on

Use a Raw File registry to store and retrieve arbitrary files by path (for example, archives, reports, or configuration files). You upload, download, inspect, and delete files with HTTP requests and curl.

Prerequisites

  • Access to a Harness account with appropriate permissions to create registries and connectors.

Create a Raw File Artifact Registry


Configure an Upstream Proxy (Optional)

An upstream proxy allows your registry to fetch artifacts from external sources if they are not available locally.

Create an upstream proxy

Configure the upstream proxy in your registry


Raw File Client Setup

Follow these instructions to upload, download, and manage files in your Raw File registry using curl commands.

Generate Identity Token

An identity token will serve as the password for uploading and downloading artifacts.

  1. Navigate to your Harness project.
  2. Go to Artifact Registry and select your Raw File registry.
  3. Click on Setup Client or Authentication.
  4. Generate an identity token (API key) that you'll use in the commands below.

File Operations

These operations support both nested and flat file paths, allowing you to organize files using directory structures in the path.

The placeholders below apply to every command unless noted.

Parameters:

  • <ACCOUNT_ID>: Your account identifier
  • <REGISTRY_NAME>: Name of your registry
  • <FILE_PATH>: Path of the file in the registry (supports nested paths, for example config/prod/settings.json)
  • <API_KEY>: Your generated identity token
  • <LOCAL_FILE_PATH>: Local path to the file you upload (upload command only)

Upload a file to a specific path

Use this curl command to upload a file:

curl -XPUT 'https://pkg.harness.io/pkg/<ACCOUNT_ID>/<REGISTRY_NAME>/files/<FILE_PATH>' \
--header 'x-api-key: <API_KEY>' -T '<LOCAL_FILE_PATH>'

Download a file from a specific path

Use this curl command to download a file:

curl --location 'https://pkg.harness.io/pkg/<ACCOUNT_ID>/<REGISTRY_NAME>/files/<FILE_PATH>' \
--header 'x-api-key: <API_KEY>' -J -O

Get file metadata

Retrieve file metadata using a HEAD request:

curl --location --head 'https://pkg.harness.io/pkg/<ACCOUNT_ID>/<REGISTRY_NAME>/files/<FILE_PATH>' \
--header 'x-api-key: <API_KEY>'

Delete a file

Delete a file from a specific path in the registry:

curl --location --request DELETE 'https://pkg.harness.io/pkg/<ACCOUNT_ID>/<REGISTRY_NAME>/files/<FILE_PATH>' \
--header 'x-api-key: <API_KEY>'
Nested vs flat paths

File operations support both nested paths (for example, config/prod/settings.json) and flat paths (for example, settings.json), giving you flexibility in how you organize your files.

URL encoding and hostnames

Use the exact URL pattern shown in Setup Client for your registry if it differs from the examples (for example, cluster-specific hostnames). For paths that contain special characters, use the commands from Setup Client or URL-encode path segments as needed.

To complete the in-product flow, click Done in Setup Client.