-
Notifications
You must be signed in to change notification settings - Fork 30
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
How do you query LastUpdated as being greater than or equal to? #10
Comments
You would need to pull the results, and then parse them after you have them on your machine. This is what I would use. You will notice that I remove the UTC offset part of your date, as it does not play well with sftrp. I then convert it to a date time object, so that it can easily be used for evaluation. I then pull every contact record in the account, 1000 at a time. After I have all of the records, I use a list comprehension to find and return the records which match the criteria. I hope that this helps! import datetime
def getContactsUpdatedAfter(updatedDate="2015-06-19T12:12:12"):
oldesttime=datetime.datetime.strptime(updatedDate, "%Y-%m-%dT%H:%M:%S")
table = 'Contact'
returnFields = ['Id', 'FirstName', 'LastName', 'Email', 'Phone1', "LastUpdated"]
limit = 1000
page = 0
allreturnedcontacts=[]
while True:
thissetofcontacts = infusionsoft.DataService('query', table, limit, page, {}, returnFields)
allreturnedcontacts += thissetofcontacts
page+=1
if len(thissetofcontacts)<1000:
break
return [c for c in allreturnedcontacts if c["LastUpdated"]>oldesttime] |
So if the purpose here is to sync the contacts for example and sync them every so often for changes I just end up syncing all contacts every time? These seems like a large limitation in the API, otherwise why have it as a query able field if you can't query it properly? |
I an not saying that this is the only way, it is just the way that I would do it. I imagine that you could order by lastupdated, and then only pull the groups of records that meet your criteria. It would be more work, imo, but you could do it. |
This should work.
|
I am trying to run this query:
table = 'Contact'
returnFields = ['Id', 'FirstName', 'LastName', 'Email', 'Phone1']
query = {"LastUpdated": "2015-06-19T12:12:12+00:00"}
limit = 1000
page = 0
contacts = infusionsoft.DataService('query', table, limit, page, query, returnFields)
but as a greater than or equal to, how do I do that? Thanks!
The text was updated successfully, but these errors were encountered: