Skip to content
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

Feature/api #48

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,6 @@ node_modules
web/themes/custom/giv_din_stemme_theme/build/

yarn-error.log

# Private files
private
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ See [keep a changelog] for information about writing changes to this log.

## [Unreleased]

* [PR-48](https://github.com/itk-dev/giv-din-stemme/pull/48)
Add API.
* [PR-49](https://github.com/itk-dev/giv-din-stemme/pull/49)
Fix underlining
* [PR-44](https://github.com/itk-dev/giv-din-stemme/pull/44)
Expand Down
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,35 @@ docker compose run --rm node yarn install
docker compose run --rm node yarn coding-standards-apply
docker compose run --rm node yarn coding-standards-check
```

## API

Before using the api the site owner must create a user and add an API key to
the user. Api endpoints are accessible through browser with the right user
permissions, but private file access requires an API key.

See accessible endpoints:

```shell
curl --url https://donerdinstemme.dk/jsonapi --header "api-key: <API KEY>"
```

Get recordings metadata and file relationship:

```shell
curl --url https://donerdinstemme.dk/jsonapi/gds/gds --header "api-key: <API KEY>"
```

Get file info:

```shell
curl --url https://donerdinstemme.dk/jsonapi/gds/gds/<FILE_ID>/file --header "api-key: <API KEY>"
```

### File download path

Use the file info endpoint data to construct a file path i.e.

```shell
curl --url https://donerdinstemme.dk/system/files/audio/<FILE_NAME>.wav --header "api-key: <API KEY>" > myLocalFile.wav
```
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"drupal/core-composer-scaffold": "^11.0",
"drupal/core-project-message": "^11.0",
"drupal/core-recommended": "^11.0",
"drupal/jsonapi_extras": "^3.26@beta",
"drupal/key_auth": "^2.2",
"drupal/openid_connect": "dev-3452009-drupal-11-compatibility",
"drupal/paragraphs": "^1.18",
"drupal/pathauto": "^1.13",
Expand Down
Loading