Update API design philosophy #942
Replies: 4 comments 6 replies
-
Thanks for writing all this up, Mike -- I'm in agreement with the vast majority of what you have laid out above. I'll try to organize my comments similarly to yours:
|
Beta Was this translation helpful? Give feedback.
-
This is great, and could allow client-side software to switch between versions of the server. I.e. enable/disable client-side features based on the target server's resultant list. Ideally have a verbose and minified version of these features. (URI Param?) Also +1 to everything Brandon said |
Beta Was this translation helpful? Give feedback.
-
This alludes to a lack of database support (i.e. forecast API updates). I believe the comment is intentionally vague to not limit to just the database schema version (such as message queue support), but for general dissemination I think including a sentence to call out the database is worthwhile. I'm also interested if the eventual goal, given CDA will be the only access to the database, is that database schema would also be continuously deployed with along with CDA. |
Beta Was this translation helpful? Give feedback.
-
I don't really understand the catalog endpoint and would personally vote for its removal. It seems like all other datasets created after the initial catalog was created started to follow the Javalin CrudHandler format (while I don't think our API design should be constrained to a framework design) where each endpoint has getOne and a getAll methods. The timeseries catalog can be replaced by the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Okay, so everyone (me too, just worried about the security people) wants a simple "WTF version is this instance", I want to switch to calendar versioning (CalVer) and provide such an endpoint. However, beyond that I think we need to better formalize what our total versioning is since there's definitely been some confusion on that point.
The following will likely read as a manifesto so bear that in mind as at this time I'm not dictating exactly this as the solution but soliciting feedback. So please argue with me, I will attempt to bring references, you should do the same.
Some of this is already stated on the wiki page, but it keeps coming up in various PRs and issues so I think good to bring up a more general case and formalize the docs in a way easier for others to common and propose changes.
There may be differences from https://github.com/USACE/cwms-data-api/wiki/API-Design, That was written a while ago and we have some experience with the API and it's usage now. Anything we decide in this discussion will supersede that document and that page will either be deleted or updated.
The general philosophy of CDA
In general
Identification of data
/rating/South%20Diversion%Canal%.Stage;Flow.Prod
along with any query parameters/rating/8d7197ee-7670-429f-a57e-38abb9c8c4ea
. OR some sort of SLUG that internal can used.Underlying data stores
As CDA is intended to be the primary way into data, it is connected to a database. It is not a goal or requirement of the API to directly map end points to tables, procedures, or views. It is acceptable to do so ; however, the general usage of data expected should be considered and provided in a friendly way that could be rendered as-is in a web page.
Without good reason, we should not expose relational database design constructs through the API. The API exposes Data, not Tables.
Primary target of operations
Usage within websites and system grabbing just data are the primary user base. The design and documentation should focus on those usages, the API itself while providing a simple swagger-ui is NOT intended to be consumed manually. While we should strive to make it easier to do so, it's not the job of the API but systems that use the API on those users behalf.
Versioning of data variable shape data
As stated the data, by content-types, are versioned. In the past there was some severe confusion on this part and it was treated as anything new was "version=2" in the content-type. To allow this design but reduce confusion going forward
Database interaction design
Searchability (this one is really just a question, not an assertion.)
We need to decide on a single "CATALOG" end point, using the plain endpoint as a catalog e.g.
/timeseries
, or a catalog for each data type, e.g./timeseries/catalog
While the current Catalog of time series and locations has query parameters than overlap well, I suspect it will get rather confusing if we add anymore.
@MikeNeilson is in favor of the
<datatype>/catalog
concept as it makes it explicit.Alternativaely current
/catalog/<datatype>
uses a PATH parameter and that could instead just be a path to a separate endpoint. That would group all of the CATALOG endpoints in swagger while allowing them to list and document their own parameters.Deployment philosophy
CDA should be continuously deployed (at a minimum into test environments) so that all code is affected whenever important changes are made while also not stopping development. As such any endpoint can, and new endpoint must, determine by some method if they can reasonably execute and if not return an appropriate "operation not supported" response to the user.
The result of this check may be cached. A negative results should be cached no more than 1 hour.
Source our eventual version endpoint generate and provide this list? I believe we've all said at one point it's important for systems to be able to determine what's available and give it's a publicly documented and open source API it's not like we're really giving anything away from a security standpoint.
Follow up
After probably both way to much and not enough discussion (RMA folks don't go overboard on the time), I will document the consensus. Probably in a similar, if not identical, style as cwms-python.
Will also separately document anything that still has clear disagreement and requires follow up discussion or more information. Was looking up some of the ADR type docs for OpenDCS and that's not uncommon and it would be could to leave such these in the same place as it would make it easier to move to accepted.
@jbkolze @krowvin @DanielTOsborne @adamkorynta @rma-bryson @rma-psmorris @rma-rripken @zack-rma
@ktarbet @mdstanfill @katfeingold @adamscarberry @jeffsuperglide @rgoss @oskarhurst @jvanaalsburg
Please send anyone who may be interested a link to this to comment on. Above are just the names that have either previously comment on such, may be interested, or whose opinion I value (okay, I value them all. Favor, perhaps?... we all have our biases.)
Beta Was this translation helpful? Give feedback.
All reactions