Creating an Ingest Form – the Easy Way
The Alma Digital Repository provides many ways to add files, and the documentation in the Developer Network includes examples of how to leverage ingest and deposit capabilities from external apps. In a recent Alma release, the General Configuration API has been enriched with additional fields that make easy work of creating an ingest form. In this post, we will show how to use the new fields to ingest a single file, and will show how the form can be used in a Cloud App to create new digital inventory.
Simple Ingest Form
The configuration API includes an option parameter,
expand=ingest_form. When the parameter is provided, the API returns a new
ingest_form section within the
digital object. The
ingest_form includes the required fields to create an ingest form, including a signed policy which authorizes the browser to add a file to the repository.
In the PHP file below, we do the following:
- Call the API with the new
- Build a form using all of the fields in the
ingest_formsection, with the
ingest_urlfield as the form action
Content-MD5fields, which are populated using the script described below
- Add a file picker to select the file for upload
That’s all there is to it- our simple form is now ready to upload a new file.
Add Digital Inventory – Cloud App
In this section we will use the form fields from the API to add digital inventory to Alma from a Cloud App. In a previous blog post, we saw that the steps to add digital inventory programmatically are as follows:
- Create a BIB record
- Add the BIB to a collection
- Add a representation to the BIB record
- Upload the file to AWS
- Add the file to the representation
Our Cloud App builds a form on the fly to upload a generated file. The form is built using the values from the API. Then an HTTP POST is done using the Angular
HttpClient, and progress events are tracked to provide feedback to the user while the file is uploading.
The full example is available in this repository.
These two examples show how the new fields in the general configuration API enable uploading files to Alma.