-
Notifications
You must be signed in to change notification settings - Fork 11
Superdesk Content API blueprint first draft #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
content-api.apib
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to have a hard limit in place and document it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also use a default soft limit, e.g. 50 or 100 so that by default one cannot accidentally pull a huge amount of data (up to the hard limit, which might be quite high).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well from the apiary doc I get it that the 25
is the default one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meh, of course. I was replying directly to Adrian's comment without looking at the context in which it was written. My bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
25 is default one, but the user should not be able to specify 1000 for example and get this number or records.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you raise an error if the given value exceeds the hard limit, or would you silently retrieve a maximum of HARD_LIMIT
items?
IMO an error is better as it makes it more explicit that there exists a hard limit, and it also immediately warns a client that there might be something wrong with its configuration or the code itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO hard limit doesn't have to be number of items. in case of reuters the limit is that you can get content for last 30 days. we can do something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or to generalize - there might co-exist several "hard" limits at the same time (configurable?). If an organization allows retrieving 1000s of items at the same time, as long as they are not "too old", then we should let them do it IMO (as long as it is technically feasible, of course).
The potential problem of somebody requesting "too much" data should be solved on the quota level anyway, and we'll need to add that sooner or later.
👍 |
content-api.apib
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a discussion regarding this for liveblog,
and the conclusion was that passing along information that this is a elastic search
, mongo
or not
should not be relevant for open api.
In this regards the backend can be changed without affecting the open api.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I definitely agree here. Clients should be oblivious to what system we use in the backend for storing data. We should specify what search parameters they can use and then transparently transform these queries into the actual elasticsearch queries or whatever is used on the server.
👌 Can you add a link to define ninjs please ? |
@vied12 You mean this? http://dev.iptc.org/ninjs |
content-api.apib
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how this range will be given? [starting_date, enddate] or { gt: starting_date, lt: enddate}
data_since, date_until.
We need standardize the date_range format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, and because I like having only simple parameter, I would prefer
begin_date
and end_date
or
from_date
and to_date
instead of date_range
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.) I prefer flat parameters as well, e.g. start_date
and end_date
, especially because one of the pair can be omitted in queries like "give me the items created after XYZ".
2.) We need to make sure that it's perfectly clear whether the date range boundaries are inclusive or exclusive (a common source of confusion). Preferably by finding even more descriptive, yet still nice, parameter names (e.g. newer_than)
3.) Since the parameters' data type will most likely be datetime (to be decided...), their names should reflect that to avoid any confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vied12 almost all open API use the since
and until
so from my point is just a conformity.
but still we may need this range for more then one field and then we need to find a solution for that.
ex: in liveblog we need range for updated
and created
fields.
http://stackoverflow.com/questions/7655403/twitter-api-tweets-for-time-range
http://stackoverflow.com/questions/6205161/select-date-range-to-get-insight-of-the-page
I added this comment also on api document. |
It seemed less likely someone would simultaneously want to fetch both structured and unstructured content, thus the /search endpoint has been removed (for now at least). I hope the rationale behind the proposal is now more clear. On top of that it also allows us to defer decisions regarding the things you pointed out until there is a clear need to add such feature. But at that point we will have much more information and will be able to actually ask the clients about their exact needs. |
+ date_range removed in favor of start_date and end_date for collections + hard limit added for collections + Elasticsearch query reference removed from *q* parameter
So, this is an initial proposal, we kept it very simple as seen, simple in terms of endpoints available. Idea is as follows:
From this proposal it is clear that we see News Item and Package Item as separate resources. They are actually separate resources and that should be reflected in the API. A Package Item is seen as a content type (i.e. composite) but it has an entirely different nature than text, video, audio, photo.
A package is build on editorial choice and it has an specific purpose. Delivering Package Items as part of /items would not be a good practice. The /packages endpoint will have even more relevance when the distribution system will be in place, but even since now having a clear separation from News Items can be considered a good strategy.
A few things to discuss:
1- You must wonder where the /search is. Well, we removed it. Why? Because /search makes sense only when searching across different resources. We have validated and searching for Package Items at the moment does not constitute a use case. Our proposal is to target only News Items for searching and therefore moving the search to the specific /items endpoint via the "q" parameter
2- We didn't look much at the Data schema for this first draft. We went with ninjs because we consider it has an important value from the business point of view. This is something that requires further discussion though.
3- Feedback on any other aspect is very much welcome as well.