Open Content
Docs homeNaviga web
  • Introduction
  • Overview
  • Key features
  • Meta data standards
  • Architecture
  • Open Content API
  • Headless and end-to-end CMS workflows
  • Use and explore
    • How does it work
    • Open Content Docker
    • OC REST API
    • Event logs
    • Replication
    • Open Content Notifier
    • New JSON API:s - CCA and Duppy
    • Terminology: Other backend services
    • Lab: upload
      • Curl for object upload
      • Environment
      • Lab 0: Configuration
      • Lab 1: Concept upload
      • Lab 2: Image upload
      • Lab 3: Article Upload
      • Lab 4: Search
      • Lab 5: Delete objects
      • Lab 6: Event sourcing using event log
  • Releases
    • Release documentation and admin guides
      • Open Content 2.3
    • New in OC 3.0 (draft)
      • Removed features in OC 3.0
  • XLibris Archive
    • Archive everything you ever created or published
    • Import content to XLibris
Powered by GitBook
On this page
Export as PDF
  1. Use and explore
  2. Lab: upload

Curl for object upload

Upload can be done by using the curl command

Upload is a multipart request towards Open Content /opencontent/objectupload endpoint.

Curl

Below is how a curl request for upload can look like:

/usr/bin/curl \
http://<server>:8080/opencontent/objectupload \
-u admin:admin \
-F id=<uuid> \
-F batch=<boolean> \
-F file=<file> \
-F file-mimetype=<mimetype> \ 
-F <file>=@<file> \
-F metadata=<metadata> \
-F metadata-mimetype=npexchange/article \
-F <metadata>=@<metadata> \
-F metadata2=<metadata2> \
-F metadata2-mimetype=npexchange/article \
-F <metadata2>=@<metadata2> \
-F preview=<preview>.jpg \
-F preview-mimetype=image/jpg \ 
-F <preview>.jpg=@<preview>.jpg \
-F thumb=<thumb>.jpg \
-F thumb-mimetype=image/jpg \ 
-F <thumb>.jpg=@<thumb>.jpg \
-F source=<source>

Field

M/O

Description

-F id=<uuid>

O

The desired Uiid for the uploaded content object. Open Content will return the given id for the uploaded content.

-F batch=<boolean>

O

Default = false, used to upload content that should be indexed later using the batch indexing mechanism.

-F file=<file>

M

The File Name of the uploaded content.

-F file-mimetype=<mimetype>

M

Mime type for the uploaded content.

-F <file>=@<file>

M

<file> is the same as the given file=<file>, the file itself

-F metadata=<metadata>

M

Meta Data file

-F metadata-mimetype=<metadata-mimetype>

M

Meta Data Mime type

-F <metadata>=@<metadata>

M

The Meta Data file

-F metadata2=<metadata2>

O

If multiple meta data files should be uploaded, use this syntax with index starting at 2.

-F metadata2-mimetype2=npexchange/article

O

-F <metadata2>=@<metadata2>

O

-F preview=<preview>.jpg

File name for preview image

-F preview-mimetype=<mimetype>

Mime type for the preview image

-F <preview>.jpg=@<preview>.jpg

The Preview image

-F thumb=.jpg

File Name for the image thumbnail

-F thumb-mimetype=<mime.type>

Mime type for the image thumbnail

-F <thumb>.jpg=@<thumb>.jpg

The image thumbnail

-F source=<source>

Set the property source to the given value. Please note that the value of this property not can be re-created during a re-index process.

-F reuseFiles=<boolean>

(*)

If true, the object will get its files from one of the registered storages. Any files in the HTTP request will be ignored. This is used in eventlog replication for example.

-F version=<version>

(*)

The version of the of the object where files should be reused

-F created=<created-date>

(*)

The created date of the of the object where files should be reused, format: YYYY-MM-ddTHH:mm:ssZ, example: 2017-05-15T04:41:45Z

-F updated=<updated-date>

(*)

The updated date of the of the object where files should be reused, format: YYYY-MM-ddTHH:mm:ssZ, example: 2017-05-15T04:41:45Z

-F eventtype=<eventtype>

(*)

Possible values: ADD UPDATE DELETE

-H "If-Match:<hexdecimal etag>"

Enables optimistic locking. This upload will fail if the current object checksum does not match this e-tag. After upload the new e-tag will be returned in response header "ETag"

(*) Is used by the Open Content Replicator when performing replications towards a read only Open Content server

Http statuscode

Description

200

Upload was successful and the object has been updated. The HTTP response body contains the uuid.

201

Upload was successful and an object has been created. The HTTP response body contains the uuid.

400

Upload failed because of an invalid request. The HTTP response body contains the error message.

401

Authentication is missing or is incorrect

409

Upload failed because it is part of batch indexing.

412

Upload failed because the E-Tag doesn't match the checksum of the object.

500

Internal server error, unexpected error. The HTTP response body contains the error message.

PreviousLab: uploadNextEnvironment

Last updated 5 years ago