A public API for ACMI's collection data - api.acmi.net.au
Public documentation: https://www.acmi.net.au/api
Internal documentation: https://kb.acmi.net.au/display/OPS/XOS+Public+API
This repository contains a full archive of ACMI collection JSON data files.
Find them at: /app/json/
This repository contains a full archive of ACMI collection metadata in TSV (tab separated values) format.
Find them at: /app/tsv/
The 2017 collections TSV can be found in the deprecated repository: github.com/ACMILabs/collection
Image and video assets will be found in the public S3 bucket when we have arranged suitable licenses with our partners: s3://acmi-public-api
Works that were imported from TMDB or IGDB have their source saved in the field source and their originating ID saved in the field source_identifier. This allows you to use the TMDB API or IGDB API to retrieve images for these Works.
- Software: Mozilla Public License Version 2.0
- Collection metadata in
/app/json/: Creative Commons CC0 - Images: coming soon...
- Videos: coming soon...
This API server exposes the following routes:
/- a list of API routes/constellations/- a list of ACMI Constellation records/constellations/<id>- an individual ACMI Constellation record/creators/- a list of ACMI Creator records/creators/<id>- an individual ACMI Creator record/search/- a search engine for the ACMI API/works/- a list of all public ACMI Work records/works/<id>/- an individual ACMI Work record
This repository includes a cron job to update itself automatically each night. The job runs the updater script /scripts/update-api.sh, which runs:
python -u -m app.api- pulls changes from the XOS APIgit add app/jsonandgit commit- adds changes in a commitgit push- merges changes back into themainbranch and pushes- This push to
maincauses a GitHub Action to deploy onto our Staging API infrastructure - After updating from XOS, the search index is updated
Search is handled by Elasticsearch.
In production we're using Elastic Cloud for our search.
The search index is updated every time the API update runs.
To update it manually, run:
- Add Elastic Cloud credentials
ELASTICSEARCH_CLOUD_IDandELASTICSEARCH_API_KEYto yourconfig.env - Start only the API container:
cd developmentanddocker-compose -f docker-compose-base.yml up --build - Connect to a Python shell:
docker exec -it api python - Inside that shell run:
from app.api import SearchandSearch().update_index('works') - The production search will now be indexed: http://localhost:8081/search/
To update the development search index locally:
- Add
UPDATE_SEARCH=trueandDEBUG=trueto yourconfig.env - Run
cd developmentanddocker-compose up --build - The search will now be indexed at: http://localhost:8081/search/
- You can see the Elasticsearch files:
/elasticsearch_data/
To run the Flask development server:
- Copy
config.tmpl.envtoconfig.env - Add
DEBUG=trueto yourconfig.env - Run
cd developmentanddocker-compose up --build - Visit: http://localhost:8081
To update Works json files modified in the last day from XOS:
- Add
UPDATE_ITEMS=trueandDEBUG=trueto yourconfig.env - Run
cd developmentanddocker-compose up --build - Works appear in
/app/json/
To update ALL Works from XOS:
- Add
ALL_WORKS=trueandUPDATE_ITEMS=trueandDEBUG=trueto yourconfig.env - Run
cd developmentanddocker-compose up --build
To update ALL Creators from XOS:
- Add
ALL_CREATORS=trueandUPDATE_ITEMS=trueandDEBUG=trueto yourconfig.env - Run
cd developmentanddocker-compose up --build
To run the gunicorn server:
- Set
DEBUG=falsein yourconfig.env - Run
cd developmentanddocker-compose up --build - Visit: http://localhost:8081
To run linting and tests:
- Run
cd developmentanddocker-compose up --build - In another terminal tab run
docker exec -it api make linttest
To run a speed test against ACMI_API_ENDPOINT (defaults to https://api.acmi.net.au):
- Run
cd developmentanddocker-compose up --build - In another terminal tab run
docker exec -it api make speed
To run a load test against https://api.acmi.net.au /, /works/ and /works/<ID>:
- Modify the
load_test.jsfile if needed - Run
cd developmentanddocker-compose up --build - In another terminal tab run
docker exec -it api make load
Flask app
- Gets public XOS API
jsonfiles - Replaces signed S3 asset links with public S3 bucket links
- Puts assets into the public S3 bucket
s3://acmi-public-api - Updates from XOS nightly, auto-deploying to the Staging API