Answers.Body: <p>Not natively, you would need to write a custom extension to do the relatively simple task of converting array output from the api to csv output.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-19T09:36:38.943Z
Answers.Text: After converting to CSV, how would the extension send that format back to the client?  Won't anything from the REST interface be XML or JSON?  Would it make sense to add a "&csv=1" like "&json=1" to CRM_Utils_REST?
Answers.UserDisplayName: Aidan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-19T16:38:55.167Z
Answers.Text: My suggestion was for the extension to define a different path and not use the same rest url as core.
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-18T19:03:25.047Z
Answers.LastActivityDate: 2016-01-18T19:03:25.047Z
Answers.UserDisplayName: Coleman
Answers.Body: <p>In Drupal, you can do this using existing plugins and no custom code.</p>
  
  <ul>
  <li>Build a Drupal View of your CiviCRM data (using <a href="https://www.drupal.org/project/views" rel="nofollow">Views module for Drupal</a> + CiviCRM's <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Views3+Integration" rel="nofollow">Views CiviCRM</a> module, part of the CiviCRM download for Drupal).</li>
  <li>Use filters in the View to correctly show the data you want to export to external service.</li>
  <li>Use <a href="https://www.drupal.org/project/views_data_export" rel="nofollow">Views Data Export</a> to provide a CSV output format of this view.</li>
  <li>Check the View display(s) have appropriate access restrictions (edit settings in View).</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-20T20:15:55.700Z
Answers.LastActivityDate: 2016-01-20T20:15:55.700Z
Answers.UserDisplayName: Chris Burgess
Body: <p>Is there a way to get CSV-formatted output via a REST call?  </p>
  
  <p>We have a 3rd-party app that can import data periodically from a URL pointing to a CSV file, so the aim is to provide it with a Civi URL (probably going to a custom api function) that returns selected data as if it were just a plain CSV file.</p>
  
  <p>EDIT: Civi 4.6.10 currently on WP moving to Drupal</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-01-18T17:41:34.343Z
Comments.Text: What CMS and Civi version are you using?
Comments.UserDisplayName: Allen Hutchison
Tags: <api><export><rest>
Title: Get CSV via REST?
ThreadText: # Get CSV via REST?
  
  (Asked by: username_0 on 2016-01-18)
  
  Is there a way to get CSV-formatted output via a REST call?
  
  We have a 3rd-party app that can import data periodically from a URL pointing to a CSV file, so the aim is to provide it with a Civi URL (probably going to a custom api function) that returns selected data as if it were just a plain CSV file.
  
  EDIT: Civi 4.6.10 currently on WP moving to Drupal
  
  **Tags:** api, export, rest
  
  > **Comments:**
  > **username_1**: What CMS and Civi version are you using?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2016-01-18. Score: 2
  
  Not natively, you would need to write a custom extension to do the relatively simple task of converting array output from the api to csv output.
  
  > **Comments:**
  > **username_0**: After converting to CSV, how would the extension send that format back to the client?  Won't anything from the REST interface be XML or JSON?  Would it make sense to add a "&csv=1" like "&json=1" to CRM_Utils_REST?  
  > **username_2**: My suggestion was for the extension to define a different path and not use the same rest url as core.  
  
  ---
  
  ### Answer by username_3 on 2016-01-20. Score: 1
  
  In Drupal, you can do this using existing plugins and no custom code.
  
  * Build a Drupal View of your CiviCRM data (using [Views module for Drupal](https://www.drupal.org/project/views) + CiviCRM's [Views CiviCRM](http://wiki.civicrm.org/confluence/display/CRMDOC/Views3+Integration) module, part of the CiviCRM download for Drupal).
  * Use filters in the View to correctly show the data you want to export to external service.
  * Use [Views Data Export](https://www.drupal.org/project/views_data_export) to provide a CSV output format of this view.
  * Check the View display(s) have appropriate access restrictions (edit settings in View).
  
  
  ---
  
  