Open maxachis opened 1 month ago
The namespace idea is a good one. Most of these make sense to me. My comments here apply, but what about:
GET data-sources/
gets all (I think we should prefer the search endpoint for most use cases)
GET data-sources/{data_source_id}
gets one
GET data-sources/id/{data_source_id}
could be used if needed
POST data-sources/
adds one
PUT data-sources/{data_source_id}
changes one
GET data-sources/search
gets multiple too
We might just want to talk this through, though. It's pretty foundational
To reorganize
data-sources
, partly in line with the requirements in #362, I propose the following:Associate all endpoints with the
data-sources
namespace. In other words, all endpoints affecting the data sources begin with/data-sources/
. The changes would be as follows:/data-sources
GET
method becomes/data-sources/all
/data-sources
POST
method becomes/data-sources/add
/data-sources-by-id/{data_source_id}
becomes/data-sources/by-id/{data_source_id}
for bothGET
andPUT
methods/data-sources-map
becomes/data-sources/map
/data-sources-needs-identifications
becomes/data-sources/needs-identification
/data-sources/link-to-agency
endpoint, which associates a data source with an existing agency (POST
), obtains information about an existing link (GET
), updates an existing link (PUT
) or deletes an existing link (DELETE
).The rationale for this is as follows:
GET
andPOST
methods of/data-sources
enables better clarity in endpoint logic, and additionally enables performing #365 to add aGET
method to/data-sources/add
which retrieves all columns which can be added.data-sources
logic in the future, by associating them with a separate namespace.data-sources/link-to-agency
endpoint enables us to add management of linking logic between data sources and agencies, which previously was only done by https://github.com/Police-Data-Accessibility-Project/data-sources-mirror and by directly interfacing with the database, rather than through an endpoint.