Document attachments, uploads, downloads

Lucity offers two ways of attaching a document to a record. It can be attached, which means that the user has manually copied it out to a file share somewhere and we store the path to the document. This works well for existing documents where the user has read/write permissions to the place where the document is loaded and when the share is available (the user is in the office and is not out in the field on a remote device like an iPad). Alternately, documents can be downloaded and uploaded to and from the server. This is effective if the client device does not have direct access to the file share or if the user does not have read (or write in the case of upload) permissions to the directory where the file is being uploaded.

Before attempting to get upload and download functioning in the REST API, it is strongly advised that the client make sure that document upload and download is working in Lucity Web. It is much easier to troubleshoot problems with upload and download configurations in the Lucity Web application.

The action links provides information for how to do both options. Add Document allows a new item to be added with a path to an existing document someplace. Upload Document allows a document to be streamed to the server (the server will persist the document on a file share designed by an administrator).

If you know that you will always be uploading to a single module like TV Inspections, you can easily figure out the url without using action links. You would need to get the module Id for TV Inspections and you will need the AutoNumber of the TVInspection you want to attach the document to:

Adding a document:

Uploading a document:

If you attempt an upload greater than the maximum size, the server will return a 413 (Request Entity Too Large) or a 400 (Bad Request)

This is what a typical upload looks like:

Documents

To get a list of existing documents and get the path or download the documents, you can use the action links (View Documents) or construct the url if you know the module id and AutoNumber:

documents 2

Notice that this document provides general information about the document (description, who last modified or inserted the document). It also provides a DataUrl. The data url provides what can be done with this attached document. For example, can it be edited, can it be viewed, can it be downloaded and the urls and verbs for each of these actions.

In the case of the above document, it is a web page link and therefore does not support a download option

documents 3

This is another document which represents a physical file:

documents 4

The action links for the above document includes Download Document

documents 5

See Also

Special Functions

Getting Record Counts: $count

Getting pick lists: {PropertyName}/ and {PropertyName}/$count

Caching support on lookups

Special lookups

Getting a new empty object: $new

Getting metadata: $fields

Discoverability

Working with Existing Filters: $filters and $myfilters

Errors

Commands

Tools

Clearing Cached Data: $cache

Warnings and Conflicts

Getting live updates based on property changes made by an end user

Secure Fields

ObjectCanBeEditied,ObjectCanBeDeleted

SQL Injection Considerations