Skip to main content

mr resource upload

Upload a local file as a new Resource. Sends the file via multipart form to POST /v1/resource. The Resource's name defaults to the source filename if --name is not set. Use --meta for a JSON blob of custom metadata that is merged into the new record.

Usage

mr resource upload <file>

Positional arguments:

  • <file>

Examples

Basic upload (name defaults to the filename)

mr resource upload ./photo.jpg

Upload with ownership and meta JSON

mr resource upload ./photo.jpg --owner-id 3 --meta '{"camera":"Pixel"}'

Flags

FlagTypeDefaultDescription
--namestring``Resource name
--descriptionstring``Resource description
--owner-iduint0Owner group ID
--metastring``Meta JSON string
--categorystring``Category
--content-categorystring``Content category
--resource-category-iduint0Resource category ID
--original-namestring``Original file name

Inherited global flags

FlagTypeDefaultDescription
--jsonboolfalseOutput raw JSON
--no-headerboolfalseOmit table headers
--pageint1Page number for list commands (default page size: 50)
--quietboolfalseOnly output IDs
--serverstringhttp://localhost:8181mahresources server URL (env: MAHRESOURCES_URL)

Output

Resource object with id, name

Exit Codes

0 on success; 1 on any error

See Also