Create an Attachment
/capture/api/v1.1/documents/{docId}/attachments
This operation can be used to create an attachment for a given document.
The request body of the operation requires at least the content
parameter. The attributes that make up an
attachment can be obtained from the content
(e.g. the attachment title). However, if desired, the
attachment
parameter can be used to set attributes. And, this is necessary if the attachment is to be of a
specific attachment type.
The attachment
parameter is an attachment object and essentially patches the default attributes that
make up and attachment. Just the attributes that are desired to be set are required in the object. The only attributes that
can be set are:
title
type
comment
Both the title
and comment
are simple strings. To set the attachment type (type
)
requires specifying an attachment type object. The object must contain either the id
attribute or the
name
attribute, or it can contain both. Only one attribute is necessary because the names are unique in the
procedure definition.
Note: The OAuth token used in this request must represent an account that has been granted explict access to the step in which the attachment's document presently resides. It makes no difference if the account represents a Capture Administator or a Capture User.
Request
- multipart/form-data
-
docId: string
The unique identifier of the document in Capture.
-
X-Requested-With: string
A header used to prevent Cross-Site Request Forgery (CSRF) attacks. The only supported value is XMLHttpRequest.
-
attachment(optional): string
This is an attachment object. The Content-Type of the mulitpart must be used and must identify the application encoding used for the string value. This must be application/json.
-
content: file
This is the actual attachment content, for instance, an image as a result of processing.
The Content-Type of the multipart must identify the type of file. And, the Content-Disposition must contain the filename.
Response
- application/json
201 Response
The new attachment
object
Attachment
An Attachment in Capture is a file that contains auxiliary content for a Document. In essence, its structure is very similar to that of a Document; however, there are no metadata fields.
-
batch(optional):
object batch
The Capture Batch that contains this attachment's parent document.
-
comment(optional):
string
A general use comment of this attachment.
-
createdBy(optional):
object createdBy
The user that created the attachment.
-
createdDate(optional):
string(date-time)
This identifies when the attachment was created. The date/time in ISO-8601 Date Time format (
yyyy-MM-dd'T'HH:mm:ss.SSSZ
) UTC, governed by RFC 3339. -
documentId(optional):
string
The unique identifier of the document in Capture to which this attachment belongs.
-
id(optional):
string
The unique identifier of the attachment in Capture.
-
links(optional):
array links
HATEOS link to related resources and actions or actions on this resource. This will include at least a canonical related link to the resource.
-
mediaType(optional):
string
This represents the media type of the attachment. That is the two-part identifier for file formats and format contents transmitted on the Internet.
-
size(optional):
integer(int64)
The size, in bytes, of the attachment.
-
sourceName(optional):
string
The filename of the attachment when imported.
-
stateToken(optional):
string
A generated string value that represents a particular state of the attachment.
In general, it is used to allow modifications of the attachment to proceed. It is essentially saying ... modify this attachment if its current
stateToken
matches this value. If the values do not match, the modification is not permitted and the operation results in an error. -
step(optional):
object step
The current processing step, if any, this attachment's parent document is undergoing.
-
title(optional):
string
The title of the attachment. This is generally the filename of the attachment used during document import.
-
type(optional):
object type
The attachment type that has been assigned to this attachment.
-
updatedBy(optional):
object updatedBy
The last user that updated the attachment.
-
updatedDate(optional):
string(date-time)
This identifies when the last time the attachment was updated.
object
The Capture Batch that contains this attachment's parent document.
-
object
Capture Batch
Title:
Capture Batch
A collection of documents in Capture that represent a unit of work in a procedure.
object
The user that created the attachment.
-
object
User Information
Title:
User Information
This object contains information about a given user of Capture.
Models use this object to denote some relation between a user and some other object. For instance, a model of the API may define the attribute
updatedBy
that is a user object. This indicates it was last updated by that given user.
array
HATEOS link to related resources and actions or actions on this resource. This will include at least a canonical related link to the resource.
-
Array of:
object HATEOAS Link
Title:
HATEOAS Link
This is a HATEOAS link and related metadata. If responses provide links (for example, a
self
link to the resource itself) the links provided will include one or more of the properties defined on this link structure.Internet Assigned Numbers Authority (IANA) maintains a registry of link relations for use in a HATEOAS link. These are well known relations and have specific meanings. If they are applicale in Capture, they are used. For instance, canonical is well known relation, and Capture does use it.
Capture does define its own link relations in certain cases because none of the registered relations provided the proper meaning. As defined in RFC for Web Linking (RFC 8288) the relation needs to be a URI. The following link relations are defined by Capture:
urn:oce:capture:document-content
- Represents the link used to obtain a document's contenturn:oce:capture:document-complete
- Represents the link used to complete processing a document in a Step task queueurn:oce:capture:attachment-content
- Represents the link used to obtain an attachment's content
object
The current processing step, if any, this attachment's parent document is undergoing.
-
object
Procedure Step
Title:
Procedure Step
A step in a procedure flow.
object
The attachment type that has been assigned to this attachment.
-
object
Attachment Type
Title:
Attachment Type
An Attachment Type can be used to categorize, and provides process filtering, of attachents of documents.
object
The last user that updated the attachment.
-
object
User Information
Title:
User Information
This object contains information about a given user of Capture.
Models use this object to denote some relation between a user and some other object. For instance, a model of the API may define the attribute
updatedBy
that is a user object. This indicates it was last updated by that given user.
object
Capture Batch
A collection of documents in Capture that represent a unit of work in a procedure.
-
createdBy(optional):
object createdBy
The user that created the batch.
-
createdDate(optional):
string(date-time)
This identifies when the batch was created. The date/time in ISO-8601 Date Time format (
yyyy-MM-dd'T'HH:mm:ss.SSSZ
) UTC, governed by RFC 3339. -
error(optional):
string
The current error message of the batch, if any.
If the batch is in the ERROR
state
, this will contain the error message detailing why the batch failed processing. This message will remain until the batch re-enters processing. -
id(optional):
string
The unique identifier of the batch.
-
links(optional):
array links
HATEOS link to related resources and actions or actions on this resource. This will include at least a canonical related link to the resource.
-
lock(optional):
object lock
If the batch is locked (by a user creating/editing the batch or if Capture is currently processing the batch), this object will contain information about the lock. The
state
of the batch determines if this object exists. -
name(optional):
string
The name given to the batch.
When Capture creates a batch, the name is some defined prefix and a sequence number. For example, inv_4781
-
notes(optional):
string
User supplied general notes associated with a batch.
-
priority(optional):
integer(int32)
Minimum Value:
0
Maximum Value:10
Default Value:0
A user specified priority of the batch.
This value is used prioritize the batch for a user's attention. Its used to filter and sort batches for viewing in the client.
-
procedure(optional):
object procedure
The Capture Procedure associated with this batch.
-
state(optional):
string
Default Value:
READY
The current state of the batch.
READY
- The standard resting state of a batch. It is available to be locked by a client.LOCKED
- The batch is locked by a client for editing, such as adding/removing documents and setting metadata field values.ERROR
- An error occurred during processing. It is available to be locked by a client for edits to correct processing errors.PROCESSING
- Capture is presently processing the batch. The batch is in one of the jobs defined in the Capture procedure.
-
status(optional):
string
The current status assigned to the batch.
The status values are defined in the procedure and can be assigned during batch creation, and during transitions between processing jobs.
-
updatedBy(optional):
object updatedBy
The last user that updated the batch. This can be the Capture system.
-
updatedDate(optional):
string(date-time)
This identifies when the last time the batch was updated. The date/time in ISO-8601 Date Time format (
yyyy-MM-dd'T'HH:mm:ss.SSSZ
) UTC, governed by RFC 3339.
object
The user that created the batch.
-
object
User Information
Title:
User Information
This object contains information about a given user of Capture.
Models use this object to denote some relation between a user and some other object. For instance, a model of the API may define the attribute
updatedBy
that is a user object. This indicates it was last updated by that given user.
array
HATEOS link to related resources and actions or actions on this resource. This will include at least a canonical related link to the resource.
-
Array of:
object HATEOAS Link
Title:
HATEOAS Link
This is a HATEOAS link and related metadata. If responses provide links (for example, a
self
link to the resource itself) the links provided will include one or more of the properties defined on this link structure.Internet Assigned Numbers Authority (IANA) maintains a registry of link relations for use in a HATEOAS link. These are well known relations and have specific meanings. If they are applicale in Capture, they are used. For instance, canonical is well known relation, and Capture does use it.
Capture does define its own link relations in certain cases because none of the registered relations provided the proper meaning. As defined in RFC for Web Linking (RFC 8288) the relation needs to be a URI. The following link relations are defined by Capture:
urn:oce:capture:document-content
- Represents the link used to obtain a document's contenturn:oce:capture:document-complete
- Represents the link used to complete processing a document in a Step task queueurn:oce:capture:attachment-content
- Represents the link used to obtain an attachment's content
object
If the batch is locked (by a user creating/editing the batch or if Capture is currently processing the batch), this object will
contain information about the lock. The state
of the batch determines if this object exists.
-
lockedBy(optional):
object lockedBy
If the batch is locked within a Capture Client instance, this attribute will contain the user that locked the batch.
-
lockedDate(optional):
string(date-time)
This identifies when the batch was locked. The date/time in ISO-8601 Date Time format (
yyyy-MM-dd'T'HH:mm:ss.SSSZ
) UTC, governed by RFC 3339. -
step(optional):
object step
If Capture is currently processing the batch, this object will contain current processing step the batch is undergoing.
-
workstation(optional):
string
If the batch is locked within a Capture Client instance, this attribute will contain the computer name where the Capture Client instance locked the batch.
object
The Capture Procedure associated with this batch.
-
object
Capture Procedure
Title:
Capture Procedure
A Capture Procedure defines metadata and procesing steps of a flow.
object
The last user that updated the batch. This can be the Capture system.
-
object
User Information
Title:
User Information
This object contains information about a given user of Capture.
Models use this object to denote some relation between a user and some other object. For instance, a model of the API may define the attribute
updatedBy
that is a user object. This indicates it was last updated by that given user.
object
User Information
This object contains information about a given user of Capture.
Models use this object to denote some relation between a user and some other object. For instance, a
model of the API may define the attribute updatedBy
that is a user object. This indicates it
was last updated by that given user.
-
name:
string
The user's name.
object
HATEOAS Link
This is a HATEOAS link and related metadata. If responses provide links
(for example, a self
link to the resource itself) the links provided will include one or more of the
properties defined on this link structure.
Internet Assigned Numbers Authority (IANA) maintains a registry of link relations for use in a HATEOAS link. These are well known relations and have specific meanings. If they are applicale in Capture, they are used. For instance, canonical is well known relation, and Capture does use it.
Capture does define its own link relations in certain cases because none of the registered relations provided the proper meaning. As defined in RFC for Web Linking (RFC 8288) the relation needs to be a URI. The following link relations are defined by Capture:
urn:oce:capture:document-content
- Represents the link used to obtain a document's contenturn:oce:capture:document-complete
- Represents the link used to complete processing a document in a Step task queueurn:oce:capture:attachment-content
- Represents the link used to obtain an attachment's content
- href(optional): string
-
mediaType(optional):
string
Default Value:
application/json
Media type, as defined by RFC 2046, describing the link target. The property can be assumed to be
application/json
if the property is not present. -
method(optional):
string
Default Value:
GET
HTTP method for requesting the target of the link.
Valid values are:
OPTIONS
- HTTP OPTIONSHEAD
- HTTP HEADGET
- HTTP GETPOST
- HTTP POSTPUT
- HTTP PUTPATCH
- HTTP PATCHDELETE
- HTTP DELETE
The property can be assumed to be
GET
if the property is not present. -
profile(optional):
string(uri)
Link to the metadata of the resource, such as JSON-schema, that describes the resource expected when dereferencing the target resource. If not available, this property will not be present.
-
rel(optional):
string
Name of the link relation that, in addition to the type property, can be used to retrieve link details.
-
templated(optional):
boolean
Default Value:
false
Boolean flag that specifies the
href
property is a URI or URI Template. The property can be assumed to befalse
if the property is not present.
object
If the batch is locked within a Capture Client instance, this attribute will contain the user that locked the batch.
-
object
User Information
Title:
User Information
This object contains information about a given user of Capture.
Models use this object to denote some relation between a user and some other object. For instance, a model of the API may define the attribute
updatedBy
that is a user object. This indicates it was last updated by that given user.
object
If Capture is currently processing the batch, this object will contain current processing step the batch is undergoing.
-
object
Procedure Step
Title:
Procedure Step
A step in a procedure flow.
object
Procedure Step
A step in a procedure flow.
-
id(optional):
string
The unique identifier of the step within the procedure.
-
name(optional):
string
The name given to the step when created. For instance, the name of the processing job or commit profile.
-
type(optional):
string
The type of step. Some example include: External Processor, TIFF Conversion Processor, Asset Lookup Processor, etc.
object
Capture Procedure
A Capture Procedure defines metadata and procesing steps of a flow.
-
id(optional):
string
The unique identifier of the procedure in Capture.
-
name(optional):
string
The name given to the procedure when created
object
Attachment Type
An Attachment Type can be used to categorize, and provides process filtering, of attachents of documents.
-
id(optional):
string
The unique identifier of the attachment type.
-
name(optional):
string
The name given to the attachment type.
400 Response
Bad Request
The request could not be processed because it contains missing or invalid information, such as a validation error on an input field or a missing required value. The response will be an Error Detail object.
403 Response
Forbidden
The request was valid and was understood, but the server is refusing action. This may be due to the account not having the necessary permissions for a resource, or attempting a prohibited action (e.g. creating a duplicate item where only one is allowed). The response will be an Error Detail object.
404 Response
Not Found
The request includes a resource URI that does not exist. The response will be an Error Detail object.
409 Response
Conflict
This response indicates the request conflicts with current state of the target resource. The response will be an Error Detail object.
Generally, this will typically occur when the given document is not presently in a processing step.
500 Response
Internal Server Error
The server encountered an unexpected condition that prevented it from fulfilling the request. The response will be an Error Detail object.
Examples
Example 1:
The following example shows how to create an attachment.
curl -X POST -H 'Accept: application/json' 'https://host:port/content/capture/api/v1/documents/dcf65d45-4f53-4f82-998c-5e189de1b6a1/attachments'
This creates a new attachment for the document with the ID of 'dcf65d45-4f53-4f82-998c-5e189de1b6a1'. The request body for this operation is a content type of multipart/form-data
. So, the example shows the raw HTTP PUT.
Request Body
PUT /capture/api/v1/documents/dcf65d45-4f53-4f82-998c-5e189de1b6a1 HTTP/1.1 Host: server.example.com:443 X-Requested-With: XmlHttpRequest Authorization: Basic c3N2cmludC5tdGFkbWluOndlbGNvbWUx Content-Length: 4867 Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW ----WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="content"; filename="/C:/Invoices/notes/Invoice5Notes.txt" Content-Type: text/plain ... ----WebKitFormBoundary7MA4YWxkTrZu0gW
Response Body
{ "id": "da259c38-1f44-4392-af75-e31ae0b5ab67", "documentId": "dcf65d45-4f53-4f82-998c-5e189de1b6a1", "title": "Invoice5Notes.txt", "batch": { "id": "864", "name": "ep_53" }, "step": { "id": "a82321c2-f288-4545-8795-e3c0f035f7ba", "name": "Find Invoice Date", "type": "External Processor" }, "stateToken": "53b2abf178702fd5e6f81dcfdb1a3b25", "mediaType": "text/plain", "sourceName": "Invoice5Notes.txt", "size": 4815, "createdBy": { "name": "ssvrint.mtadmin" }, "createdDate": "2021-09-19T20:05:14.215Z", "updatedBy": { "name": "ssvrint.mtadmin" }, "updatedDate": "2021-09-19T20:05:14.215Z", "links": [ { "rel": "canonical", "href": "http://server.example.com/documents/dcf65d45-4f53-4f82-998c-5e189de1b6a1/attachments/da259c38-1f44-4392-af75-e31ae0b5ab67", "method": "GET", "mediaType": "application/json" }, { "rel": "urn:oce:capture:attachment-content", "href": "http://server.example.com/documents/dcf65d45-4f53-4f82-998c-5e189de1b6a1/attachments/da259c38-1f44-4392-af75-e31ae0b5ab67/content", "method": "GET", "mediaType": "text/plain" } ] }
Example 2:
The following example shows how to create an attachment.
curl -X POST -H 'Accept: application/json' 'https://host:port/content/capture/api/v1/documents/dcf65d45-4f53-4f82-998c-5e189de1b6a1/attachments'
This creates a new attachment for the document with the ID of 'dcf65d45-4f53-4f82-998c-5e189de1b6a1', and specifies a title
and type
for the attachment. The request body for this operation is a content type of multipart/form-data
. So, the example shows the raw HTTP PUT.
Request Body
PUT /capture/api/v1/documents/dcf65d45-4f53-4f82-998c-5e189de1b6a1 HTTP/1.1 Host: server.example.com:443 X-Requested-With: XmlHttpRequest Authorization: Basic c3N2cmludC5tdGFkbWluOndlbGNvbWUx Content-Length: 5148 Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW ----WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="attachment" Content-Type: application/json { "title": "Notes Title", "stateToken": "340f804ff4118f2f419bc3ca87ef1213", "type": { "id": "1d3340ca-3fcb-43f7-9304-89cfedb1ac69", "name": "Invoice Notes" } } ----WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="content"; filename="/C:/Invoices/notes/Invoice5Notes.txt" Content-Type: text/plain ... ----WebKitFormBoundary7MA4YWxkTrZu0gW
Response Body
{ "id": "27d68830-ee2d-4b75-9b75-e2feeeb11909", "documentId": "dcf65d45-4f53-4f82-998c-5e189de1b6a1", "title": "Notes Title", "batch": { "id": "864", "name": "ep_53" }, "step": { "id": "a82321c2-f288-4545-8795-e3c0f035f7ba", "name": "Find Invoice Date", "type": "External Processor" }, "type": { "id": "1d3340ca-3fcb-43f7-9304-89cfedb1ac69", "name": "Invoice Notes" }, "stateToken": "23421e50c982fad3d8375737a1c46eee", "mediaType": "text/plain", "sourceName": "notes5.txt", "size": 4815, "createdBy": { "name": "ssvrint.mtadmin" }, "createdDate": "2021-09-19T20:05:14.215Z", "updatedBy": { "name": "ssvrint.mtadmin" }, "updatedDate": "2021-09-19T20:05:14.215Z", "links": [ { "rel": "canonical", "href": "http://server.example.com/documents/dcf65d45-4f53-4f82-998c-5e189de1b6a1/attachments/27d68830-ee2d-4b75-9b75-e2feeeb11909", "method": "GET", "mediaType": "application/json" }, { "rel": "urn:oce:capture:attachment-content", "href": "http://server.example.com/documents/dcf65d45-4f53-4f82-998c-5e189de1b6a1/attachments/27d68830-ee2d-4b75-9b75-e2feeeb11909/content", "method": "GET", "mediaType": "text/plain" } ] }