REST API How to get result with date > YYYY-mm-dd instead of date = YYYY-mm-dd - api

I'm trying to prepare request from REST API system which is administrated by government, so I have to use provided API methods without possibility to change it from server side.
The URL of this GET method is ...​/WasteRegister​/WasteTransferCard​/v1​/Kpo​/sendercards​/receiver
One of parameters is called "ReceiveConfirmationTime": string($date-time).
Because of limits (2 queries per second, max 50 records per page) and lots of records from previous years, I would like to get records only from current year. When I prepare request i.e. ​/WasteRegister​/WasteTransferCard​/v1​/Kpo​/sendercards​/receiver?ReceiveConfirmationTime=2023-01-18 it gives me results only from this specific day and it's correct. Unfortunately there is no parameter such a "Year" which would be solution for me.
So what I've tried so far:
limit value from this request to only year ReceiveConfirmationTime=2023 - it gives an error with incorrectly date-time formatted value and it's obvious
operator > instead of = it gives a result with all records including previous years
I've tested it in PHP (curl), Postman and online API test pages - all without success.
So, my question is: is there any way for preparing this request URL i.e. use operator a'la like in SQL? I will be grateful for any suggestions.

Related

How to correctly search (Real Estate Transaction Standard aka RETS) server?

I am trying to interact with a RETS (Real Estate Transaction Standard) server to find all listings where matrix_unique_id field is greater than or equal to 0.
After logging in, I tried the following URI
Search.ashx?SearchType=Property&Class=Listing&Limit=1000&Query=(matrix_unique_id=0+)&StandardNames=0
The above call returns
<RETS ReplyCode="20201" ReplyText="No Records Found."/>
But then I supplied a valid Matrix_Unique_Id value like this
Search.ashx?SearchType=Property&Class=Listing&Limit=1000&Query=(matrix_unique_id=59075770+)&StandardNames=0
Now that returns something but not what I am expecting. The returned value is as follow
Here is the documentation for RETS 1.7.2 and a PDF
Additionally, here is an example of how to search RETS server for a different server but both adhere to the same specification.
https://www.flexmls.com/developers/rets/tutorials/example-rets-session/
Additionally, I used RETS Connector to query the listing and I am able to download listings with no issues which indicated that my account is working and has permission to search.
Question: How can I correctly search up all properties where the field Matrix_Unique_Id is 0+?
For getting full result try the following logic,
(ModificationTimestamp=2000-01-01T00:00:00+)
This will return all the listings from the year 2000 onwards. If you need further old, give 1990 or older in the query.
Note: Your example query (matrix_unique_id=0+) is not working because
of its pattern may not be correct, say 8 digit number only will take
as input.

BigQuery-Java: difference between QueryResponse and GetQueryResultsResponse

In sample code provided by Google, 2 classes are used to fetch results. QueryResponse and GetQueryResultsResponse.
I am not able to understand purpose of these 2 classes and do we have to use these 2 classes?
We are getting data from both: queryResponse.getRows() and queryResults.getRows()
I have gone through docs but could not figure out. what is the difference between these 2 classes and which is better to use?
Those two results are virtually identical (in fact, they are identical in the raw HTTP request). The difference is how you get them.
QueryResponse is returned by jobs.query(). This method can be used to run a query, but has only limited configuration options. It is intended as a convenience function. For more query options (such as setting a destination table, allowing large results, etc), use jobs.insert(). Another limitation of jobs.query() is that it may time out before the query has completed. Partly, this is because many clients (such as in AppEngine) require all HTTP requests to finish within 30 seconds or so. If jobs.query() times out, it will still report a job id that can be used to fetch the results with jobs.get_query_results().
GetQueryResultsResponse is returned by jobs.get_query_results(). This can be used to get the results of a query started by either jobs.query() or jobs.insert(). Query results (if you don't specify a destination table) are available for 24 hours after the query completes. jobs.get_query_results() allows you to fetch these results at any time. jobs.query() only gives you the query results once.
There is a further difference between the two, which is that jobs.query() just returns the first page of results. jobs.get_query_results() can be used to get multiple pages of results.
Hopefully this clarifies things a bit.

Yammer API - Paging

I am trying to gather a range of messages through the rest API, and am aware that you can only retrieve 20 results at a time. I have tried incrementing a page variable, but this has no affect, and I am just getting the same results each time no matter the page number (https://www.yammer.com/api/v1/messages.json?page=6). I have proceeded to use the newer_than and older_than parameters to page through the results, and it works to some extent, but it appears to be excluding records. I am using the following approach below:
Since just setting a newer_than only results in the 20 most recent records as long as they are newer than the id that is sent in the newer_than parameter, I am also setting a dynamic older_than parameter.
Send request with only a newer than parameter. This returns the 20 most recent records. (eg. ww.yammer.com/api/v1/messages.json?newer_than=235560157)
Extract the ID of the 20th id in the JSON, and using this to populate the older_than parameter. The result is 20 different records. (eg.ww.yammer.com/api/v1/messages.json?newer_than=235560157&older_than=405598096)
Repeat step 2 until no results are returned since the newer_than and older_than parameters will eventually overlap.
The problem is that the set of records that is returned with this method is less than the number of records that is returned for messages from the data export API. I am working under the assumption that newer message IDs are always generated with a value greater than any older messages.
Could I possibly be misunderstanding how paging through results is supposed to be implemented with the REST API?
Any help would be much appreciated!
Thanks in advance!
First of all, the page parameter works only for the search API.
Secondly, the way you are trying to fetch messages will not return any comments on the messages or will return top 2 comments on any message based on the "extended" parameter. By default it returns 2 comments on every message. To get all the comments on the message you will have to get it individually message wise.
That must be causing the difference in the number of messages in the two methods mentioned.
I agree with Farhann - The rest API endpoint returns only top two comments for any message by default. To get all the comments for a post, you have to make a separate request.
With the use of the Data Export API, all the comments along with the message (public and private) are also exported which increases the count of the number of the messages. While, the API call returns only recent 2 comments on any message by default.
The data export includes private messages. Private messages will not be returned by that API call.
Check if the messages you are not seeing are private messages.

CouchDB API query with ?limit=0 returns one row - bug or feature?

I use CouchDB 1.5.0 and noticed a strange thing:
When I query some API action, for example:
curl -X GET "http://localhost:5984/mydb/_changes?limit=1"
I get the same result with limit=1 and with limit=0 and with limit=-55. In all cases is a one row from the start of list.
Although, PostgreSQL returns:
Zero rows when LIMIT 0
Message ERROR: LIMIT must not be negative when LIMIT -55
My question is mainly concerned with the API design. I would like to know your opinions.
It's a flaw or maybe it's good/acceptable practice?
This is how the _changes api is designed. If you do not specify the type of feed i.e long-poll, continuous etc the default is to return a list of all the changes in a single results array.
If you want a row by row result of the changes in the database specify the type of feed in the url like so
curl -X GET "http://localhost:5984/mydb/_changes?feed=continuous"
Another point to note that in the _changes api using 0 has the same effect as using 1 in limit parameter.

Magento API returns dates in what timezone

I have been trying to find the answer to this for several hours... what timezone does the Magento API use? I am assuming that the Magento API returns all date values as GMT time because they do not append the timezone string at the end of the data. Is this correct?
I am wanting to use filters and want to make sure that the dates are being correctly interpreted in my offsite client.
From my experience, all dates in Magento seem to be stored in GMT. You should be able to confirm this trivially in any particular case by adding a record at a known time and calculating the offset.