Skip to content

Commit 6ab6e98

Browse files
author
Tom Schenk Jr
committed
Added instructions for authentication
1 parent 5f91838 commit 6ab6e98

2 files changed

Lines changed: 31 additions & 5 deletions

File tree

docs/api.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,39 @@
11
# API Documentation
22

33
## Submitting Patient Record
4-
5-
Submit a patient record and retrieve the estimated risk of having elevated blood-lead levels.
4+
5+
### Authentication
6+
7+
Submitting patient records to Lead Safe requires client credentials to retrieve a token, which is required for all API calls. City of Chicago will issue a client ID and a client secret ID which will be used to obtain a token.
8+
9+
10+
```bash
11+
GET --user CLIENT_ID:CLIENT_SECRET --data "grant_type=client_credentials" <url>/oauth/token
12+
```
13+
14+
Successful requests for a token will return a JSON file similar to this:
15+
16+
```json
17+
{"access_token":"TOKEN","token_type":"bearer","expires_in":3600}
18+
```
19+
20+
Tokens are set to expire every 3,600 seconds (1 hour) and a new token will need to be obtained.
21+
22+
To upload a patient record, the POST command must include a header called `Authorization: Bearer` followed by the TOKEN obtained in the previous steps.
23+
24+
An upload would look like:
625

726
```bash
8-
POST {json file} <url>/insert/
27+
POST --header "Content-Type:application/json" --header "Authorization: Bearer TOKEN" FILE.JSON <url>/upload/insert/
928
```
1029

30+
The format for `FILE.JSON` is described in the next section.
31+
32+
### Schema
33+
34+
Submit a patient record and retrieve the estimated risk of having elevated blood-lead levels.
35+
36+
1137
| Field | Format | Constraints | Notes |
1238
|-----------------|----------|------------------------------------|-------------------------------------------------------------------------------------------------------------------|
1339
| timestamp | TimeDate | yyyy-mm-dd hh:mm:ss.sss-hh:mm | Current timestamp (RFC 3339 compliant date) |

mkdocs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
# Site Information
3-
site_name: Lead Safe API v0.6.0
3+
site_name: Lead Safe API v1.0.0-rc.1
44
site_author: City of Chicago
55
site_description: Lead Free API Documentation
66
site_url: http://dev.cityofchicago.org/docs/lead-free
@@ -19,7 +19,7 @@ pages:
1919
- 'Terms of Service': 'tos.md'
2020

2121
# Copyright
22-
copyright: Copyright &copy; 2016-2017 <a href="http://www.cityofchicago.org">City of Chicago</a> and licensed under <a href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International</a>.
22+
copyright: Copyright &copy; 2016-2018 <a href="http://www.cityofchicago.org">City of Chicago</a> and licensed under <a href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International</a>.
2323

2424
# Repository Information
2525
# repo_name: Chicago/open311-api-docs

0 commit comments

Comments
 (0)