0

How can I make a REST API call to Civi that creates a CSV file with all the Contacts details (name, email, telephone...) from an specified Smart Group?

Thanks.

1
  • The REST api isn't capable of making a CSV, it can easily get you the members from the group but formatting those into a CSV is coding you would have to undertake in your code/system and is beyond the scope of CiviCRM. I'll post an answer with an example API call. EDIT The "review" screen helpfully doesn't show the comment which basically says what I said :-) Mar 23 at 15:51
1

You can't create a csv directly from an API call. But it would be a very simple task to make an API call and then format the results as a csv. One simple option might be to use Google Apps Script to call the API then put the results into a spreadsheet, if you don't want to run this as a standalone script. Or any scripting language you might want to use will have plenty of Google results for creating a csv from an array, which is what the API will return.

1
  • That's great idea, thanks!
    – Rucc
    Mar 17 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.