Is there a standard protocol in JSON Rest Apis for getting Effective Start and specifically End Dates? Say a gym membership is currently active. Should JSON display Effective End Date be 12/31/9999 or null?
Trying to look at different API Specs.
I know in SQL they argue for 12/31/9999, 12/30/9999, and null. Not sure if API standards are different.
https://jsonapi.org/format/
trying to look at different stack articles: Recommended date format for REST GET API
I’d use these Defaults for formatting. Ultimately it comes down to how you wish to design the API. Changing it later will be very difficult to the point of needing an entirely new API version.
If I were to design this, I’d choose the RFC3339 format:
YYYY-MM-ddTHH:mm:ss.ss±hh:mm
Drop Time if you believe you will never need or do 11:59 and 59 seconds if you wish.
For the case of End date, I’d use NULL.
Related
I'd like to explore patterns of Google reviews for a specific business (that I do not own). It would be useful to get the exact date of a review, rather than just the "3 months ago" or "1 year ago" approximation that you get via the web interface.
Does anyone know a way to do this? Here are the options I've explored so far:
I tried "manually" scraping the review list HTML (e.g. from a page like this), but it does not contain any review timestamp that I could recognise, other than the approximated relative date (e.g. "1 year ago").
The Google "My Business" API does seem to provide exact review dates, but to use this API, you need to own the business for which you're retrieving the reviews.
The Google Places API does expose review dates, but only for 5 reviews per place. According to this API feature request, this limitation remains in place even if you pay for Premium data access.
Results from party review analysis tool Reviewshake contain an absolute date field, but it is derived from the approximate relative date. So it erroneously makes it seem like most past reviews occurred exactly on this day each month, or exactly on this day on previous years!
Any help much appreciated!
The unix timestamp you're referring to can be easily converted from you first bullet point; what occurs when you view the reviews is Google's ReviewService is polled and the date comes in a unix format, that unix format is processed by a date/time function in the JS file on maps that returns the duration in length resulting in a week ago, a month ago, etc.
There is no known interface other than some of what you've already looked at; the closest you've got in your first point is the direct maps URL however you would need to rip the JS feed and convert the timestamps where you can make sense of them.
There aren't many sources that can do this but I can recommend you try https://www.reviewsmaker.com/api/demo/google/ or sign up free at reviewsmaker.com and add the business as a listing and you'll be able to crawl the results; otherwise you'll be stuck scraping the same data.
If you find another way please do share your results!
I can get a list of summaries of violating sites, using the following link:
https://developers.google.com/ad-experience-report/[...]/violatingSites/list
My questions:
Is this list exhaustive?
If not, is it possible to get an exhaustive list (or not) and how?
Is it possible to know how these websites are pulled (the share of websites analysed, etc)?
- Is this list exhaustive?
What's size of your actual API return?
If you have an API return statement increasingly longer and longer with new data at each new request, you can think have the exhaustive list (with a possible update
latency).
If the API return statement have always same size with different data, in example old data will not appears and it replaced by new data, it's not exhaustive.
- If not, is it possible to get an exhaustive list (or not) and how?
I have no idea at the moment, the total number of websites can be in billion ...
- Is it possible to know how these websites are pulled (the share of websites analysed, etc)?
I have no idea for the moment too, I think it is either a confidential process or that it is described in the general conditions and subtily in the documentation...
I am writing a REST api using ruby on rails. I am using json api as a guide for the standards to use when building the api.
I am trying to figure out the best way to use filtering in the GET requests. The json api recommendations for filtering only include where something is exactly equal to. eg.
GET /comments?filter[post]=1
How would I go about filtering for greater than, less than, not equal to, like, contains etc.?
I have done a lot of searching through google results but there doesn't seem to be a standard of the best way to do the filtering. There are some suggestions for example this one.
I'm looking for a solid spec or standard that I can refer to specifically for the filtering for my api, as the json api spec is very limited when it comes to filtering.
I looks like there are a few more resources for this now 6 years later.
From what I read quickly it looks like the JSON:API spec may not specify this exactly. However this supposedly compliant framework documentation looks helpful:
https://www.jsonapi.net/usage/reading/filtering.html
Going by their method you could do this
GET /games?filter=greaterThan(id,20345)
GET /games?filter=lessThan(id,345334)
See the link as they have a lot of other standard looking filters that could be useful.
As an example: I'd like to know, when was the Key "tourism" added (or last edited) of this amenities:
http://overpass-turbo.eu/s/1N4
I tried with different APIs but didn't get very far.
Is there a way over any API or do I have to get as SQL Snapshot and somehow look for the last changeset?
You can use the history call of the main OSM API if you know the IDs of the objects wich you want to inspect. The resulting XML includes all versions of the respective object, thus allows one to determine when certain changes were made:
http://www.openstreetmap.org/api/0.6/node/277528308/history
Overpass API supports these kinds of queries since version 0.7.50. Referring to the History API call or extracting that details from a full history planet wouldn't be necessary anymore.
Please refer to this post with more details on diff and adiff keywords.
As the overpass database rebuild is still ongoing, I'll add a working example to this post a bit later. At the moment, June 2014 would be the earliest possible starting date for queries.
Horribly worded question...I know.
I'm working on an application that processes data for the previous day. The problem is that I know the customer is going to eventually ask to it for every hour or some other arbitrary time interval. I know that languages such as Java or SQL have masks for defining dates. Well what about a way to define a time interval?
Let me ask it this way. If someone asked you to create a configurable piece of software how would you allow the user to specify the time intervals?
UPDATE
What I'm looking for is a textual representation. Imagine somethign that would be put into a config file.
Here's how Google App Engine's cron API is configured, it's a bit more user-friendly than cron:
http://code.google.com/appengine/docs/python/config/cron.html#The_Schedule_Format
Python (and Java?) source to implement it should be available in the SDK. Haven't looked to see how easy it would be to extract, but it should at least provide some ideas.
I think it'd be possible to add various things to the format as required - it's structured enough to be extensible. For example it's currently missing the ability to say "every hour at 4 minutes past", which is common in UNIX cron but not really relevant to GAE because although perhaps the engine could figure out which minutes are busy and which aren't, and balance load, the user certainly can't.
Obviously the major weakness of offering something that looks like natural language to the average user, is that they'll think your code is psychic, and expect it to also understand things like "every other Wednesday except the week after Easter", or "whenever the clocks change" ;-)
I'm not sure if I understand your question correctly. Are you asking for a way to input time intervals?
I don't know your environment, but most language frameworks offer some more or less sophisticated GUI components. Something like a calendar control may be what you are looking for?
Edit: Ah, command line (or config file) it is.
Can you parse an XML file? In this case, you could just serialize a timespan (most languages have a class like this). The use may edit the XML file, typically just replacing, say, the value of the <minutes> part. Deserializing this XML file to obtain a Timespan again is easy.
If you prefer plaintext or command line input, it is a bit less easy. However, many languages support some kind of Timespan.Parse (string text, string format). You should have a look if this concept is present in your environment.
Many environment offer some kind of sscanf(), that parses an input string. Sometimes there is a "time" format as well.
If the earlier ideas don't provide a solution, you can try to parse the date using regex. There should be many resources on this topic on this site as well as the web.
If you dislike regex, split the input string according to your own format rules. That's kind of an ugly solution though.
If you don't feel like splitting user input stringy by hand, use Random.NextInt(1000) and hope nobody notices. 0:-)