Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Panel
titleContent REST Methods

Get Content

  • Purpose: Retrieves a piece of content along with its properties
  • Request: GET https://host:port/durastore/spaceID/contentID ? (storeID) (attachment)
    • if attachment param value is true, a Content-Disposition header is included with the response
  • Request Headers: Range of bytes to retrieve from the file (optional) (Available in DuraCloud v5.0.0+)

    Code Block
    Range:bytes=byte_range


    • Value of Range header must begin with "bytes=" followed by the byte range

    • Only 1 byte range is supported per request, all ranges specified beyond the first are discarded

    • Examples of valid Range header values:
      • bytes=0-499 (retrieves the first 500 bytes from a file)
      • bytes=500-999 (retrieves the second 500 bytes from a file)
      • bytes=1000- (retrieves all bytes starting with 1000 to the end of the file)
  • Response Code:
    • 200 (on success, for a complete file)
    • 206 (on success, for a range-limited set of bytes in the file)
    • 400 (on invalid request, such as if a Range header includes an invalid value)
  • Response Body: The content stream
  • Response Headers: All available content properties, example:

    Code Block
    languagenone
    Content-Type: text/plain
    Content-Length: 5732
    Content-MD5: 3456709234785097473839202
    ETag: 3456709234785097473839202
    x-dura-meta-content-name: Testing Content
    x-dura-meta-content-owner: JSmith
    


Get Content Properties

  • Purpose: Retrieves the properties of a piece of content without the content itself
  • Request: HEAD https://host:port/durastore/spaceID/contentID ? (storeID)
  • Response Code: 200 (on success)
  • Response Headers: Same as Get content (above)

Store Content

  • Purpose: Adds a piece of content to the store
  • Request: PUT https://host:port/durastore/spaceID/contentID ? (storeID)
  • Request Body: Content to be added
  • Request Headers: Properties about the content, example:

    Code Block
    languagenone
    Content-Type: text/plain
    Content-MD5: 4cd56e137a93a1accb43c5d32f4afffb
    x-dura-meta-content-name: Testing Content
    x-dura-meta-content-owner: JSmith
    


  • Response Code:
    • 201 (on success)
    • 400 (if the content ID is invalid)
    • 404 (if the the given space does not exist)
    • 409 (if the provided checksum did not match the stored content checksum)
    • 500 (on error)
  • Response Headers:
    • MD5 checksum of stored content
    • ETag of stored content
    • Location of the new content (i.e. the URL used to create the content), example:

      Code Block
      languagebash
      Content-MD5: 4cd56e137a93a1accb43c5d32f4afffb
      ETag: 4cd56e137a93a1accb43c5d32f4afffb
      Location: https://myhost:8080/durastore/space1/content1
      


  • Usage Notes
    • When the optional Content-MD5 header is included, the final checksum of the stored file is compared against the MD5 value included in the header to ensure that the file was stored correctly. If the header is not included, an MD5 checksum is computed as the file is transferred to storage, and that value is used in the final comparison.
    • All properties to be set must be included as a request header with the prefix "x-dura-meta-". Any header using the "x-dura-meta-" prefix will be stored as a content property, with a few exceptions, which are used for specific other purposes:
      • Headers used as part of the Copy Content request

        Code Block
        x-dura-meta-copy-source
        x-dura-meta-copy-source-store


      • Headers used to provide details about a space

        Code Block
        x-dura-meta-space-count
        x-dura-meta-space-created


      • Headers used as part of the Set Space ACLs call (the * is replaced by the user or group name)

        Code Block
        x-dura-meta-acl-*
        x-dura-meta-acl-group-*


      • Headers used internal to DuraCloud

        Code Block
        x-dura-meta-content-mimetype (set Content-Type header instead)
        x-dura-meta-content-size (automatically written as Content-Length header)
        x-dura-meta-content-checksum (automatically written as Content-MD5 header)
        x-dura-meta-content-modified (automatically written as Last-Modified header)


      • Headers used by the DuraCloud SyncTool to automatically capture file details

        Code Block
        x-dura-meta-creator
        x-dura-meta-content-file-created
        x-dura-meta-content-file-modified
        x-dura-meta-content-file-last-accessed
        x-dura-meta-content-file-path


    • Use only US-ASCII characters for property names and values

    • There is a 2 KB total size limit on all content properties (this includes both auto-generated and user contributed properties.)

    • The "x-dura-meta-" prefix is case-sensitive (make sure your clients do not automatically change case.)

Copy Content

  • Purpose: Copies a piece of content from a source space to a destination space within a given store
  • Request: PUT https://host:port/durastore/spaceID/contentID ? (storeID)
  • Request Body: must not exist
  • Request Headers: Copy source, example:

    Code Block
    languagenone
    x-dura-meta-copy-source: space-id/content-id
    


  • Optional Request Headers: Copy source store, example:

    Code Block
    languagenone
    x-dura-meta-copy-source-store: storeId
    


  • Response Code: 201 (on success)
  • Response Headers:
    • MD5 checksum of stored content
    • ETag of stored content
    • Location of the new content (i.e. the URL used to create the content), example:

      Code Block
      languagebash
      Content-MD5: 4cd56e137a93a1accb43c5d32f4afffb
      ETag: 4cd56e137a93a1accb43c5d32f4afffb
      Location: https://myhost:8080/durastore/space1/content1
      


  • Usage Notes
    • The properties associated with the source content item are copied to the destination content item.
    • The source and destination spaces may be the same.
    • Including the optional header indicates that the copy action should retrieve the source file from a space in the specified storage provider. This allows for copying a file from one storage provider to another.

Set Content Properties

  • Purpose: Updates the properties associated with a piece of content. Note: You must include ALL properties you would like associated with the given content item in this call. Any properties that exist before this call but are not included in the call itself will be removed. This is to allow for both adding and removing properties.
  • Request: POST https://host:port/durastore/spaceID/contentID ? (storeID)
  • Request Headers: Same as Store content (above)
  • Response Code: 200 (on success)
  • Response Body: "Content $contentID updated successfully"

Delete Content

  • Purpose: Removes a piece of content from the store
  • Request: DELETE https://host:port/durastore/spaceID/contentID ? (storeID)
  • Response Code: 200 (on success)
  • Response Body: "Content $contentID deleted successfully"

...