/  Yamcs HTTP API  /  Buckets  /  Upload Object

Upload ObjectΒΆ

Upload an object

Simple upload:

In case of simple upload, the object name has to be specified as part of the URL and the Content-Type header has to be set to the type of the object. The body of the request is the object data.

Form upload:

The form-based upload can be used to upload an object from an HTML form. In this case the Content-Type of the request is set to multipart/form-data, and the body will contain at least one part which is the object data. This part includes a filename which is used as the object name as well as a Content-Type header.

The name attribute for the file part is ignored.

Additional parts (which do not specify a filename) will be used as metadata: the name is specified as part of the Content-Disposition and the value is the body of the part.

This can be tested with curl using the -F option.

POST /api/storage/buckets/my_bucket/objects HTTP/1.1
Host: localhost:8090
User-Agent: curl/7.58.0
Accept: */*
Content-Length: 1090
Content-Type: multipart/form-data; boundary=------------------------7109c709802f7ae4

--------------------------7109c709802f7ae4
Content-Disposition: form-data; name="file"; filename="object/name"
Content-Type: text/plain

[object data]
--------------------------7109c709802f7ae4
Content-Disposition: form-data; name="name1"

value1
--------------------------7109c709802f7ae4
Content-Disposition: form-data; name="name2"

value2
--------------------------7109c709802f7ae4--

This will create an object named object/name with two metadata properties:

{
  "name1": "value1",
  "name2": "value2"
}

URI Template

POST /api/storage/buckets/{bucketName}/objects/{objectName}
{bucketName}

Bucket name.

{objectName}

Object name.

This parameter may be omitted when using form-based uploads.

This route parameter may contain forward slashes. Alternatively you may also use URL-encoded characters, such as %2F

Request Body

interface HttpBody {

  // The Content-Type header value for this body.
  // If unspecified, defaults to application/octet-stream
  contentType: string;

  // If set, a Content-Disposition header is added
  // to the response. Weg agents use this to trigger
  // a download.
  filename: string;

  // The body as raw binary
  data: string;  // Base64

  // Any other metadata (used in multipart/form)
  metadata: {[key: string]: string};
}