codeforboston / codeforboston/police-data-trust
[BUG] API doc incorrect (create source)
- Dominant language
- Python
- Stars
- 64
- Forks
- 102
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
The [API](https://npdindex.readme.io/reference/createsource-1) doc informs users that "name" and "contact_email" are the required body fields, however in [the code](https://github.com/codeforboston/police-data-trust/blob/main/backend/routes/sources.py#L52) an undocumented "url" field is also required.
**To Reproduce**
> import requests
>
> base_url = "http://127.0.0.1:5001/api/v1/"
> url = base_url + "sources"
>
> payload = {
> "name": "Testy McTestface",
> "contact_email": "testy.mctestface@gmail.com"
> }
>
> headers = {
> "accept": "application/json",
> "content-type": "application/json",
> "Authorization": "Bearer {0}".format(token)
> }
>
> response = requests.post(url, headers=headers, json=payload)
returns error
> {
> "message": "Failed to create source. Please include all of the following",
> "status": "error"
> }
@DMalone87
Contributor guide
Assessment
This issue has not been assessed yet.