Files
notifications-api/docs/api-usage.md

39 lines
1.0 KiB
Markdown
Raw Normal View History

2022-10-26 15:45:45 +00:00
# API Usage
## Connecting to the API
To make life easier, the [UK API client libraries](https://www.notifications.service.gov.uk/documentation) are compatible with Notify.
For a usage example, see [our Python demo](https://github.com/GSA/notify-python-demo).
An API key can be created at https://notifications-admin.app.cloud.gov/services/YOUR_SERVICE_ID/api/keys. However, in order to successfully send messages, you will need to receive a secret header token from the Notify team.
2022-11-17 10:57:34 -05:00
## Using OpenAPI documentation
### Retrieving a jwt-encoded bearer token for use
2022-11-17 10:57:34 -05:00
On a mac, run
#### Admin UI token
2022-11-17 10:57:34 -05:00
```
flask command create-admin-jwt | tail -n 1 | pbcopy
```
#### User token
```
flask command create-user-jwt --token=<USER_API_TOKEN> | tail -n 1 | pbcopy
```
2022-11-18 12:39:50 -05:00
to copy a token to your pasteboard. This token will expire in 30 seconds
2022-11-17 17:04:51 -05:00
### Disable token expiration checking in development
Because jwt tokens expire so quickly, the development server can be set to allow tokens older than 30 seconds:
2022-11-17 17:04:51 -05:00
```
env ALLOW_EXPIRED_API_TOKEN=1 make run-flask
```