Quickbooks- "Query" API Call with CreateDate - quickbooks

I want to retrieve vendors from Quickbooks Which have been created before a specific date. The API has provided the method "query" to retrieve date using a SQL statement.
How can i use the "CreateTime" in the where clause to filter date by a specific data.
Regards,
Sarindu.

SELECT * FROM Vendor WHERE MetaData.CreateTime >= '2009-10-14T04:05:05-07:00' AND MetaData.CreateTime <= '2012-10-14T04:05:05-07:00'
Of course, it must be encoded in the request e.g.
https://quickbooks.api.intuit.com/v3/company/1234/query?query=SELECT%20FROM%20Customer%20WHERE%20Metadata.LastUpdatedTime%20%3E+%272011-08-10T10%3A20%3A30-0700%27
Docs: https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/020_key_concepts/00300_query_operations

Related

Mule 4 - Set Start Date & End Date as QueryParams

I'm having trouble defining both start and end dates as a query parameters. When the data gets pulled, it needs to return as a range of dates based on the query parameters. The GET URL would look like http://localhost:8081/test?FileType=Sales&StartDate=2022-10-01&EndDate=2022-10-26. This should return a date range of data from 10/1/2022-10/26/2022.
In my query, my where clause is set to:
where dp.Nid = 405 and fs.DDate=:DDate
**dp and fs are used in my joins and 405 is an ID that i'll need to unique identify a product.
My input Parameters:
{ DDate : attributes.queryParams.StartDate, DDate : attributes.queryParams.EndDate }
What do i need to set to make a range of dates? Do i need to set startdate to > and enddate to < ? Also, is it possible to define query parameters when using a stored procedure instead of select database method in anypoint studio?
Operations in Mule 4 (ie the boxes inside a flow) can have several inputs (payload, variables, attributes) and 1 output, but they are expected to be independent from each other. The Database query operation doesn't care if its inputs come the query params or from somewhere else. You need to map inputs explicitly to parameters in the query.
Once you have the arguments you need to use them in the SQL query. Usually that means adding a greater than and a lesser than comparison, to ensure that the value is in range. Or the same including also equals, if the business logic requires it.
Depending on the data types and the SQL dialect you may need to convert the inputs to a date format that is compatible with the database type of the column. The inputs here are strings, because that's what query params always are parsed to. The column type is something that you will need to understand and see how to transform, in DataWeave or in the SQL query.
As an example:
<db:select config-ref="dbConfig">
<db:sql>SELECT ... WHERE dp.Nid = 405 AND fs.DDate >= :StartDate AND fs.DDate <= :StartDate</db:sql>
<db:input-parameters>
#[{
StartDate : attributes.queryParams.StartDate,
EndDate : attributes.queryParams.EndDate
}]
</db:input-parameters>
</db:select>

How to receive messages in ascending by received date order in graph api

I am trying to receive email messages via Microsoft Graph API:
requestBuilder
.Delta()
.Request()
.Expand("attachments")
.GetAsync(ChildCancellationToken.Token);
but messages come in descending order by ReceivedDateTime. For example we have 15 new messages with ReceivedDateTime = n, where n represents date time.
In first part will come:
[15,14,13,12,11,10,9,8,7,6 (deltaHash="someValue")]
in second:
[5,4,3,2,1 (deltaHash=NULL)]
So, the oldest email will come the latest (LIFO, not FIFO).
But I expect to get:
[1,2,3,4,5,6,7,8,9,10 (deltaHash="someValue")]
[11,23,13,14,15 (deltaHash=NULL)]
What I tried: I tried OrderBy(string value).
For these two I get exceptions:
.OrderBy("ReceivedDateTime asc")
.OrderBy("ReceivedDateTime")
This is working fine:
.OrderBy("ReceivedDateTime desc")
but this is the same as default behavior and I think this is a bug actually. So there is no way to sort emails in ASC order.
How to solve on first look very simple and common requirement?
Looks like this is a known issue as specified in the documentation.
The only supported $orderby expression is
$orderby=receivedDateTime+desc. If you do not include an $orderby
expression, the return order is not guaranteed.
So for now you need to sort them on your end by writing your own code.
I can confirm that .OrderBy("ReceivedDateTime asc") is now working as of the version of the microsoft-graph API I am using which is 5.36.0

How to filter for a object wiith a "value" and "name" in QBO api?

It seems like its the api won't permit a query filter of the form:
select * from purchaseorder where APAccountRef.value='33'
In the case of purchase orders it seems to mean that I need to bring down every purchase order to my server and scan for the account I need which is highly suboptimal. Is there some other syntax for querying against the many attributes which have been encoded like
"APAccountRef": {
"value": "33",
"name": "Accounts Payable (A/P)"
}
with just a name and value attribute?
If you refer to the documentation:
https://developer.intuit.com/docs/api/accounting/purchaseorder
It gives you a list of all fields, and a list of fields that are filterable. Your query is using a field that does not exist as part of Purchase Orders:
AccountRef.value='39'
The correct field is:
APAccountRef:
required
ReferenceType, filterable
Specifies to which AP account the bill is credited.
So your query should be:
SELECT * FROM purchaseorder WHERE APAccountRef = '39'
Try this in python-
"select * from purchaseorder where APAccountRef in ('33')"

Writing data over Influx HTTP API returns OK, but table is empty

I'm writing batched data over HTTP API like this
demo,state=idle
max=100.0,mean=20.0,event_type=0,probability=0.6,min=0.0 1529087114083
demo,state=idle
max=100.0,mean=80.0,event_type=1,probability=0.6,min=0.0 1529087114083
demo,state=idle
max=100.0,mean=20.0,event_type=2,probability=0.6,min=0.0 1529087114083
demo,state=idle
max=100.0,mean=80.0,event_type=3,probability=0.6,min=0.0 1529087114083
And the request returns 204 which is "ok" according to Influx API docs.
Still, when I want to check my data in admin
SELECT median("mean") AS "median_mean", mean("mean") AS "mean_mean"
FROM "sfb"."autogen"."demo" WHERE time > now() - 1h GROUP BY
:interval: FILL(null)
I get
Your query is syntactically correct but returned no results
Solved: need to specify proper timestamp precision - otherwise it calculates wrong data and data is not visible

OData query filter for dateTime range

I have a DateTime property in the data returned by a service that looks like
"SDateTime":"2014-06-29T03:30:00.000".
I need to write a query to get a collection which has the date less than "2014-06-26T03:30:00.000" and greater than "2014-06-23T03:30:00.000"
How to write a filter for the dateTime?
Thanks.
In OData V4 date filtering format has changed, the correct filter will be
$filter=SDateTime gt 2014-06-23T03:30:00.000Z and SDateTime lt 2014-06-26T03:30:00.000Z
For example
http://services.odata.org/V4/OData/OData.svc/Products?%24filter=ReleaseDate%20gt%201995-09-01T00:00:00Z%20and%20ReleaseDate%20lt%201995-12-01T00:00:00Z
For previous versions of OData see previous answer
$filter=SDateTime gt datetime'2014-06-26T03:30:00.000' and SDateTime lt datetime'2014-06-23T03:30:00.000'
It works in this service: http://services.odata.org/V3/OData/OData.svc/Products?$filter=ReleaseDate%20gt%20datetime%271995-09-01T00:00:00%27%20and%20ReleaseDate%20lt%20datetime%271995-12-01T00:00:00%27
Breeze will automatically construct an OData filter under the covers for any query. So to query for a date will look something like this in Breeze.
var query = new EntityQuery("Orders")
.where("orderDate", ">", new Date(1998, 3, 1));

Resources