Closed jczaplew closed 7 years ago
What do you think would be a sensible API for this functionality? I was thinking something like children_of=<wof_id of parent>
Also, I plan to set this up so that only the first level of children is provided. If the user wants additional levels they can recursively query.
I agree. Only first level is necessary if we do it that way.
Alternatively, name=UnitedStaes&placetype=country&children=counties to get all US counties?
On May 1, 2017 8:50 AM, "John J Czaplewski" notifications@github.com wrote:
What do you think would be a sensible API for this functionality? I was thinking something like children_of=
Also, I plan to set this up so that only the first level of children is provided. If the user wants additional levels they can recursively query.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/UW-Macrostrat/macrostrat-api/issues/189#issuecomment-298336526, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ8JQ3JYLMBfjWI55Bw7Wu6MnGb5jWiCks5r1eMtgaJpZM4NNDWE .
That's a good point, I like that better.
There is only one thing in that form that complicates things a bit. We would need to check for and throw errors in the following situations:
name
is provided but a placetype
is not and there is ambiguity placetype
that corresponds to the name
is incorrect, and thus thechildren
is invalidWe could either just deal with these or force the user to provide a wof_id
when asking for children
Thoughts?
Just return nothing. That's how we already handle errors for this route.
To get children the parameter will be called child_type
or (child_placetype
?), and accepts any valid placetype
.
Should be childtype
to be consistent with placetype
which is not snake_case
or change placetype
to snake_case.
I feel like we obviously want to support both?
Yes, I am just demonstrating the two ways of querying. Both will be supported.
Are you including this route in Velociraptr?
Yes, there will be a wrapper for this, but the true path will be hidden in the package. I'll be hiding it in kind of a jenky way by putting a wrapper around the wrapper, but this will avoid people writing their own larger queries that overwhelm our server.
Alright, because currently there are no safeguards against people asking for all localities in a continent as a GeoJSON
Oh... hmmm... that IS a problem even with my wrapper. Maybe I will only use the MapZen API and assume they've built in protections? Security through obscurity is not good.
I could build in a rudimentary safeguard that does something like throw an error if more than x features will be returned.
Perhaps add a parameter that we can toggle for limits. &response=long
or &response=short
. short
will throw an error for geojson's over a certain character length, long
will give you everything. This way we can make larger calls internally.
I will fix the response option to short
in the velociraptr version?
Or limit=TRUE
limit=FALSE
Added an upper limit of 5000 results in d3cd68fb8fd658127bba92abd7ca852b7fd840b7.
Can we consider this resolved?
Can we update the documentation to included childtype
?
I am reopening this issue. The current childtype
parameter only works if a single parent is given. It should work for multiple parents.
While fixing this I'm going to modify the route so that you can only query down one level. I.E. you will not be able to say name=North%20America&placetype=continent&childtype=locality
Makes sense, is that to prevent overburdening the system?
On Tue, Jun 20, 2017 at 7:55 AM, John J Czaplewski <notifications@github.com
wrote:
While fixing this I'm going to modify the route so that you can only query down one level. I.E. you will not be able to say name=North%20America& placetype=continent&childtype=locality
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/UW-Macrostrat/macrostrat-api/issues/189#issuecomment-309784368, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ8JQ0As61v1XCr5UOokuQWM6E4E1iEPks5sF91WgaJpZM4NNDWE .
Yes. Don't want someone asking for gigabytes of data all at once....
Migrated from https://github.com/UW-Macrostrat/wof/issues/3
@aazaff - "We need to adjust the API route so that you can get all immediate children of a parent - e.g., all countries of Europe, all regions of France, all counties of Wisconsin."