I'm trying to use https://data.stackexchange.com/stackoverflow/atom to get stackoverflow data. But I have some problems.
One of my request is to get the posts with specific tags, for example odata. (I want posts with tags contains odata, not just posts just with tags odata). And I tried the odata official url request:
https://data.stackexchange.com/stackoverflow/atom/Posts?$filter=contains(Tags, 'odata')
Then I got this error:
Unknown function 'Contains' at position 0.
So my question is: Is there an easy way to query the data using stackoverflow odata endpoint?
1 Answer 1
Data Explorer only supports up to OData version 2, but the contains
function was added sometime after that (either version 3 or 4). You can view the list of supported $filter
functions on the OData website.
Note that the OData endpoints have generally been deprecated in favour of the Stack Exchange API, which offers a more convenient and reliable way to get at the data, so it's unlikely that support for later OData versions will be added to Data Explorer.
That said, for your particular query, you can just use the indexof
function instead. For example:
/Posts?$filter=indexof(Tags,'odata') gt -1
-
Thanks for clarify. One more question on odata endpoint for stackoverflow. Is there a limit on records returned from a request? When I run /Posts/$count, I got 18942008, but when I run /Posts, I got definitely less than 18942008 records. Is that due to some paging in OData or limit on the service?QianLi– QianLi2014年03月11日 01:49:02 +00:00Commented Mar 11, 2014 at 1:49
-
Yeah, I believe the default page size is 50.Tim Stone– Tim Stone2014年03月11日 03:18:14 +00:00Commented Mar 11, 2014 at 3:18
-
3@TimStone Are the odata links dead now? Following the links from data.stackexchange.com gives Page Not Found responses.Daniel Ballinger– Daniel Ballinger2014年10月22日 01:21:03 +00:00Commented Oct 22, 2014 at 1:21
-
@DanielBallinger: a late reply, but the answer appears to be yes.halfer– halfer2015年09月02日 18:53:14 +00:00Commented Sep 2, 2015 at 18:53