Upload or replace a hosted asset

PUT /groups/{groupId}/apps/{appId}/hosting/assets/asset

Upload or replace a hosted asset at a specific resource path.

Path parameters

Query parameters

  • path string Required

    The resource path of a hosted asset.

application/json

Body Required

The hosted asset file and its metadata. (Must use Content-Type: multipart/mixed)

  • meta object
    Hide meta attributes Show meta attributes object
    • path string

      The resource path of the asset

    • size integer

      The size of the asset in bytes

    • attrs array[object]

      An array of documents that each describe a metadata attribute that applies to the asset.

      Hide attrs attributes Show attrs attributes object
    • hash string

      The MD5 checksum hash for the asset

  • file string(binary)

    The asset file to upload (encoded as binary).

Responses

  • 204

    Successfully added/replaced the hosted asset.

  • 400 application/json

    There is an error in the request.

    Hide response attributes Show response attributes object
    • error string

      A message that describes the error.

    • error_code string

      The error type.

PUT /groups/{groupId}/apps/{appId}/hosting/assets/asset
curl \
 --request PUT 'https://services.cloud.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appId}/hosting/assets/asset?path=string' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"meta":{"path":"string","size":42,"attrs":[{"name":"string","value":"string"}],"hash":"string"},"file":"@file"}'
Request examples
{
  "meta": {
    "path": "string",
    "size": 42,
    "attrs": [
      {
        "name": "string",
        "value": "string"
      }
    ],
    "hash": "string"
  },
  "file": "@file"
}
Response examples (400)
{
  "error": "string",
  "error_code": "string"
}