-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Caption and Transcript Uploads Via API #5801
Comments
Need to adjust things on the language support for the API; Language value is set on the model based on default value. We'll need to update that behavior for this purpose, so that the value can be set up front when the supplemental file is created. Should look at the JSON API standard and other schemas for API architecture. GET to /supplemental_file/#{id} returns the binary; we don't have a place to get the metadata from one of these routes. |
The model has a couple required metadata fields but with Active Storage attachment, you can create the supplemental file object but not have a file attached immediately. We probably wouldn't be able to create the file without any associated metadata. At the very least it would need to be metadata first, file second. Ideally, though, find a way to bundle it all together. |
Two relevant options here: |
Ex:
When you POST to supplemental_files, it will save or update the media object, OR don't worry about it because it's handled by the handling on the masterfile. Supplemental file create/update should ensure that saves and index updates are done accordingly as needed. |
Request: Add new supplemental file to masterfileCreate with file and metadata:
Create with file and inline metadata:
Create with just file:
Create with just metadata:
Create with just metadata inline:
Response: Request: replace existing supplemental file with a new binary fileUpdate attached file:
Response: Request: Get data on supplemental file
Response:
Request: Update data on supplemental fileUpdating metadata requires ALL existing fields except language to be included in the payload. Any existing non-language metadata field that is left out of the payload will be removed. Update metadata:
Payload file:
Update metadata inline:
Response: Request: Get listing of supplemental files on masterfile
Returns an array of supplemental files
Paginated:
Returns array containing per_page results:
Request: Delete supplemental file
Deletes a supplemental file from the masterfile
|
Description
Following from #5710; caption and transcripts should be manipulable via the Avalon API so that these documents can be uploaded and attached to records programatically.
As a user, I want to programmatically add captions, transcripts and supplemental files to master files on a media object.
API
Requirements
For a masterfile:
Upload/attach and set metadata:
Deliberately nice API responses would be nice; that could be an extension past this work
Routes
Questions
does Content Type need to be explicitly added for requests? VTT, DOCX, etc.
Could we do both single request upload and multi-part upload with metadata in json?
Does the request URL need an extra parameter to return JSON? As in /master_files/#{fedora_id}/supplemental_files?format=json. I'm guessing we don't want to clobber the existing responses from the route.
There is already some json handling (not sure what the extent is; may have been autogenerated with scaffolding), so we'll need to make sure existing usage doesn't get changed or is moved to a different route if needed
Request: Add new supplemental file to masterfile
Request: replace existing supplemental file with a new binary file
Request: Get data on supplemental file
GET /master_files/#{fedora_id}//supplemental_files/#{id}.json
Request: Update data on supplemental file
PUT /master_files/#{fedora_id}//supplemental_files/#{id}.json
Request: Get listing of supplemental files on masterfile
GET /master_files/ns064602j/supplemental_files.json
Returns an array of supplemental files
Request: Delete supplemental file
DELETE /master_files/#{fedora_id}//supplemental_files/#{id}
Deletes a supplemental file from the masterfile
Done Looks Like
QA
Current Caption Upload Example
Current Form Data send on POST
The text was updated successfully, but these errors were encountered: