Giter Site home page Giter Site logo

Comments (10)

 avatar commented on August 22, 2024 1

BTW, this is what I'm trying to accomplish:

  1. Get all contacts the first time.
  2. Every few hours, get newly updated or created contact and company data.

from rest-api.

dedupely avatar dedupely commented on August 22, 2024 1

Hi thanks, I saw this waay too late. Any idea on how I can do an "OR" condition between (updated between x and y) OR (created between x and y)

BTW, I used the Chrome inspector to see the post data in Agile CRM's filtering in the UI. This should be documented much better than it is. There are a lot of rules and ways to fetch data I didn't even know existed.

from rest-api.

ranjanagilecrm avatar ranjanagilecrm commented on August 22, 2024 1

Hi @dedupely ,

Sorry for late reply !
Currently we don't have any option to fetch contacts data using "OR" condition between (updated between x and y) OR (created between x and y).

from rest-api.

prem-tammina avatar prem-tammina commented on August 22, 2024 1

Hi @Adam81
I appreciate your efforts in sharing this information with us. This would help all the existing customers and the future customers who will be a part of Agile CRM family. We will continue to come up with more updates in the near future.

https://github.com/agilecrm/rest-api/blob/master/README.md#12-dynamic-filters-on-contacts--deals

from rest-api.

graut avatar graut commented on August 22, 2024

Hi @clintonskakun ,

We have API to fetch list of contacts sort by created time but not by updated time. Please check below API explained how to get list of contacts using paging technique sort by created time.

https://www.youtube.com/watch?v=jJAAZKqybQ4

reference : https://github.com/agilecrm/rest-api#devapicontacts

In case you need more depth filter you can use dynamic filter :

https://github.com/agilecrm/rest-api#121-get-contacts-by-dynamic-filter

dynamic filter options : https://snag.gy/ngz7wh.jpg

from rest-api.

 avatar commented on August 22, 2024

Damn. updated_time would be a giant resource saver. I need to fetch everything at once everytime then. Makes things a lot slower. Is it at all simple to add that feature? That'd be a giant life saver and resource saver on all 3 ends (client, Agile API and my integration end)

Can I use the cursor with the dynamic filter to pull pages of contacts changed(updated or created) after a certain time?

from rest-api.

graut avatar graut commented on August 22, 2024

Hi @clintonskakun ,

Sorry for late reply yes you can use dynamic filter for updating by or creating time -

curl https://{your_domain}.agilecrm.com/dev/api/filters/filter/dynamic-filter -H "Accept: application/json"
-H "Content-Type :application/x-www-form-urlencoded"
-d 'page_size=25&global_sort_key=-updated_time&filterJson={"rules":[{"LHS":"updated_time","CONDITION":"ON","RHS":1486924200000}],"contact_type":"PERSON"}'
-v -u [email protected]:123fghfhf******* -X POST

Note : global_sort_key (possible value)
-created_time -> sort by descending time [latest first]
created_time -> sort by ascending time

-updated_time -> sort by descending time [latest updated first]
updated_time -> sort by ascending time

"CONDITION" (possible value)

ON -- Your time zone: some date, 12:00:00 AM GMT+5:30

{"rules":[{"LHS":"updated_time","CONDITION":"ON","RHS":1486924200000}],"contact_type":"PERSON"}

https://snag.gy/hMx5nb.jpg

BETWEEN

{"rules":[{"LHS":"updated_time","CONDITION":"BETWEEN","RHS":1486837800000,"RHS_NEW":1487010599999}],"contact_type":"PERSON"}

https://snag.gy/iUxuMe.jpg

Note : you can use paging with dynamic filter also

from rest-api.

nasirsher avatar nasirsher commented on August 22, 2024

How can I get total number of contacts so in the pagination i can show number of contact are being display e.g showing 500 of 1400?

from rest-api.

jqn avatar jqn commented on August 22, 2024

Just in case someone is looking for a way to sort contacts by descending and ascending order I'm documenting it here. This API could use better documentation.

// Descending order ( note -created_time vs created_time)
contacts?page_size=1&cursor&global_sort_key=-created_time
// Ascending order
contacts?page_size=1&cursor&global_sort_key=created_time

from rest-api.

Adam81 avatar Adam81 commented on August 22, 2024

Hi all, guess what... It's possible to run the dynamic filter on contacts and also deals, I will include examples below.

@ghost Thanks for opening this post, you should now be able to accomplish what you wish.

Big thanks to @dedupely, using his inspector technique I was able to identify many of these filters and also find the hidden endpoint for "deals". To start, I will return the favor and answer his question correctly.

@dedupely asked...

Hi thanks, I saw this waay too late. Any idea on how I can do an "OR" condition between (updated between x and y) OR (created between x and y)

@ranjanagilecrm said its not possible but he's now incorrect, perhaps this functionality was added after his comment. It's possible to filter using an OR if you move the rules to the "or_rules" section of the dynamic filter request. Here's how you filter with an "OR" condition for (updated BETWEEN 11/18/19 and 11/19/19) OR (created BETWEEN 11/18/19 and 11/19/19)...

page_size=25&global_sort_key=-created_time&filterJson={"rules":[],"or_rules":[{"LHS":"updated_time","CONDITION":"BETWEEN","RHS":1574053200000,"RHS_NEW":1574312399999}, {"LHS":"created_time","CONDITION":"BETWEEN","RHS":1574053200000,"RHS_NEW":1574312399999}],"contact_type":"PERSON"

Endpoints

Contacts: /dev/api/filters/filter/dynamic-filter
Deals: /dev/api/deal/filters/filter/dynamic-filter

Examples:

Contacts updated within the last day
page_size=25&global_sort_key=-created_time&filterJson={"rules":[{"LHS":"updated_time","CONDITION":"LAST","RHS":"1"}],"or_rules":[],"contact_type":"PERSON"}

Contacts updated after Nov 1st, 2019
page_size=25&global_sort_key=-created_time&filterJson={"rules":[{"LHS":"updated_time","CONDITION":"AFTER","RHS":1572580800000}],"or_rules":[],"contact_type":"PERSON"}

Contacts updated on Nov 1st, 2019 with a "paid" tag
page_size=25&global_sort_key=-created_time&filterJson={"rules":[{"LHS":"tags","CONDITION":"EQUALS","RHS":"paid"},{"LHS":"updated_time","CONDITION":"ON","RHS":1572580800000}],"or_rules":[],"contact_type":"PERSON"}

Contacts with VIP tag OR paid tag
page_size=10&global_sort_key=-updated_time&filterJson={"rules":[],"or_rules":[{"LHS":"tags","CONDITION":"EQUALS","RHS":"VIP"},{"LHS":"tags","CONDITION":"EQUALS","RHS":"paid"}],"contact_type":"PERSON"}

Deals updated on Nov 1st, 2019
Note: use the deals endpoint and change "contact_type" to "OPPORTUNITY"
page_size=25&filterJson={"rules":[{"LHS":"updated_time","CONDITION":"ON","RHS":1572580800000}],"or_rules":[],"contact_type":"OPPORTUNITY"}

I hope this brings value to someone, it will save us lots of processing time.

from rest-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.