Attachment Upload API
In Dovetail Seeker, uploading attachments is a two step process. First get a token to upload, then upload the file attachment to Dovetail Seeker. Dovetail Seeker will save the file to the file system, and create the attachment records (doc_inst and doc_path) in the database for the appropriate workflow entity.
The application will first call the Upload Token API to create an upload token which will be given to the application user.
The user then directly uploads the file to Dovetail Seeker via the Attachment Upload API.
Upload Token
This API provides a token that will be used for the actual upload of a file attachment.
Applications need to call this API before users can upload file attachments. Users will use the token returned from this API when uploading a file attachment.
Input
URL:
/seeker/attachment/upload/token
HTTP Method(s):
- GET
Parameters
Parameter | Required | Default | Description |
---|---|---|---|
Key | Yes | N/A | The ID of the object that the attachment will be related to. For example: Case ID Subcase ID Solution ID |
FileName | Yes | N/A | Name of the file to be uploaded. |
Response
Parameter | Description |
---|---|
Token | Upload permission token which should be posted with the file upload. |
Examples
Request:
GET /seeker/attachment/upload/token?Key=4213&FileName=myfile.txt
Response:
{
Token: "biglongrandomtokenstring"
}
Attachment Upload
The Attachment File Upload API is for application users to upload a file attachment. Dovetail Seeker will save the file to the file system, and create the attachment records (doc_inst and doc_path) in the database for the appropriate workflow entity.
Applications will typically setup the web browser to POST to this API using the results returned from the Attachment Upload Token API.
There are 2 application configuration settings that influence the behavior of this API.
Setting | Description |
---|---|
seekerWebService.attachmentDirectoryPath | The base path where file attachments should be stored. |
seekerWebService.attachmentMode | The AttachmentMode specifies which sub-folder mode should be used when saving file attachments. Valid values are ModeA, ModeB, or ModeC. For specific details, refer to the AttachmentMode Knowledgebase Article. |
<add key="seekerWebService.attachmentDirectoryPath" value="C:\attach" />
<add key="seekerWebService.attachmentMode" value="ModeB" />
Input
URL:
/seeker/attachment/upload
HTTP Method(s):
- POST
Parameters
Parameter | Required | Default | Description |
---|---|---|---|
UploadToken | Yes | N/A | The upload token returned by the file upload token API. When the token is invalid a 404 status will be returned. When the token has expired a 403 status will be returned. |
Files | Yes | N/A | The form used to POST the file should have a file input with a name of "Files". Only one file can be uploaded at a time. If no files or more than one file were uploaded a 400 status will be returned. |
ObjectType | Yes | N/A | The type of object that this attachment is for. e.g. case, subcase, solution, etc. |
Username | No | N/A | The username of the employee who the act_entry for uploading a file should be recorded as. If not specified, it will be Seeker's application user. |
Response:
Parameter | Description |
---|---|
path | Full path and filename of where the file was saved to |
Id | Objid of the doc_inst record that was created |
workflowObject.Id | ID number of the object that the attachment is for |
WorkflowObject.Type | Type of the object that the attachment is for |
Name | Saved filename. This may be different than the name of the file uploaded to prevent duplicates. For example, if file.log is uploaded twice, the first time the saved filename will be file.log. The second time it will be file-1.log |
Examples
Request:
POST /seeker/attachment/upload
Response:
{
"Path": "C:\\attach\\004xxx\\004213\\file-1.log",
"Id": 268436690,
"WorkflowObject": {
"Id": "12345",
"Type": "Case"
},
"Name": "file-1.log"
}