API3
jimdowland at March 23rd, 2017 08:28 — #1
Hi,
I've been asked by our MD to write a script that emails him when a deal status changes from 'pending' to 'Won' or 'Lost'. I would like to be able to query the api to fetch a list of deals only returning the name of the deal and the status.
I've tried using this query deals.json?fields=status,name which returns all the field instead of just the ones that I want. I've tried this in my script and your api browser and get the same results. I was wondering if you could let me know what I'm doing wrong?
I'm also having trouble getting results from a specific timeframe. I would like to run my script once a day using Cron and keep a record of when it was last checked and query the api for deals that have changed status to lost between each cron run. I think that the query should be something like deals.json?status=lost&date_filter=close_date&since=14883264000&until=1490054400 but, again, this is just returning all of the deals.
Any help and advice you can give me would be very much appreciated. Many thanks
sfeek at April 5th, 2017 08:23 — #2
I have the exact same issue. If I try the following in the API Browser
contacts.json?owner_id=<my id#>&fields=first_name,last_name
I get all of the contact fields for each record.
liam at April 5th, 2017 10:13 — #3
Hello Jim, Shane,
Jim - I'm very sorry for the delay, we someone missed your question two weeks ago.
It looks like we have deprecated the option to limit the fields of a resource - but the documentation wasn't updated.
The fields
query param is no only used for selecting related resources (eg. notes, calls, deals, contacts) to return with other resources. I shall update the docs on this right away.
Regarding the filtering by a date field and range - this is a bug. It should be working. I'll keep you updated as we make any progress.
Once again, apologies for the long delay.
Please let me know if there is anything else I can help with
Liam
jimdowland at April 6th, 2017 09:55 — #4
Hi Liam,
Many thanks for getting back to me with the clarification about the fields option. Yes, please keep me updated about the progress in fixing the problem with the date filter.
Jim
jimdowland at May 8th, 2017 09:10 — #5
Hi Liam, Just wondering if you've made any progress with fixing this?
liam at May 9th, 2017 06:52 — #6
Hi Jim,
The API team has been busy with some other changes so the fix hasn't been started yet. The good news is that we received another report of this bug this week, so it has been bumped up the queue and will be started shortly. I couldn't give an ETA as I'm not sure how easy a fix it will be. I will update here once work has been started on the fix.
Apologies again for the delay.
Kind regards,
Liam
jimdowland at August 2nd, 2017 10:43 — #7
Hi Liam, just wondering if you've made any progress? We're very keen to get this finished.
Many thanks,
Jim
liam at August 3rd, 2017 05:40 — #8
Hello Jim,
We do finally have an update, but there is a slight change to the syntax
deals.json?date_filter=closed&since=2017-07-01&until=2017-08-01
The date_filter
for closed deals is closed
instead of close_date
. I will get close_date
added so it will work soon, but right now only closed
will work.
since
and until
can accept either dates (2017-07-01
) or timestamps (1498863600
)
I'm sorry for the delay once again,
Please let me know if everything is working for you as is, or if there are any other problems we can help you with
-Liam
nichollas at August 8th, 2017 06:43 — #9
Hi Jim,
date_filter
for closed deals was updated to accept both closed
and close_date
.
Please, let us know if everything is working for you. If you have any other problem, I'm here to help as well
Nichollas
Powered by Discourse, best viewed with JavaScript enabled