Uploading Files

Approaches

Sentera's GraphQL API supports two different approaches for uploading files to Sentera's cloud storage

Single-part Uploads

This is the easiest way to upload small files. You use a single PUT request to upload the file, and either the entire request succeeds or it fails. This approach is explained in detail here.

Multi-part Uploads

This is the preferred way to upload larger files (greater than 10MB), and the only way to upload files larger than 5GB. With this approach, you upload a large file in parts of 5MB or more. Multi-part file uploads have an advantage in that if uploading a single part fails, you can retry the upload of just that part. You don't need to upload the entire file again. This approach is explained in detail here.

File Upload Owners

Certain mutations accept a list of file IDs representing uploaded files to be attached to the resource being mutated. An example of this is the upsert_feature_set mutation, which accepts annotation_file_keys and document_file_keys arguments.

In order to attach uploaded files to a resource using these upsert_* mutations, the file IDs must be obtained from the create_file_upload or create_file_uploads mutations using a file upload owner. These two mutations accept an optional file_upload_owner argument of type FileUploadOwnerInput, which describes the resource that the uploaded file will be attached to within FieldAgent. For example, a file upload owner can represent a feature set or mosaic among other things.

At the time that you use the create_file_upload or create_file_uploads mutations, the file upload owner can either exist (provide the file upload owner's Sentera ID as part of FileUploadOwnerInput), or you can create the file upload owner when the file upload is created (do not provide a file upload owner Sentera ID as part of FileUploadOwnerInput).

When you provide a file upload owner to the create_file_upload or create_file_uploads mutations, the FileUpload returned by the mutation will contain an owner_sentera_id. You will need to provide the owner_sentera_id value when calling the upsert_* mutation, so that the uploaded file(s) get attached to the correct resource (e.g. the file upload owner) within FieldAgent.

Some import_* mutations require that you must use file IDs that were obtained from the create_file_upload or create_file_uploads mutations without specifying a file owner. These mutations will not work properly if provided file IDs for uploaded files that are already associated to an existing resource (e.g. file upload owner).

Exceptions to this are the import_feature_set and import_mosaic mutations, which will work correctly for either scenario.

The documentation that follows demonstrates how to upload a file without specifying a file upload owner.