CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Contributions and REST Api
Pages: [1]

Author Topic: Contributions and REST Api  (Read 840 times)

rednival

  • Guest
Contributions and REST Api
May 13, 2010, 09:07:12 am
I was having an issue accessing the contributions funcitons from the REST API.  I kept getting errors that functions could not be found using the following:

http://localhost/civicrm/extern/rest.php?q=civicrm/contribute/search

From error message and looking at the code in REST.php, I decided to make a copy of api/v2/Contribute.php and name it Contribution.php.  Then my contribution calls started working.

Is this a bug, or do I need to change how I am calling the function so it works without the new file?  The file that exposes the API for contributions is called "Contribute.php", yet the functions are prefixed with civicrm_contributions_.  The REST handler seems to expect the functions to be prefixed with civicrm_contribute.  This sure seems like bug. 

Here is the call that did not work until I copied the Contribute.php file.

http://localhost/civicrm/extern/rest.php?q=civicrm/contribution/search
« Last Edit: May 13, 2010, 09:13:08 am by rednival »

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Contributions and REST Api
May 13, 2010, 09:16:19 am
Hi,

Had a quick look, and you seems to have found a bug indeed, the file should be renamed to Contribution.php to follow the convention.

Could you fill an issue and modify tests/phpunit/api/v2/ContributionTest.php so the unit tests works ?
Did you read the wiki, i'd be great if you could update if needed.

If you could do these steps quickly, I'll try to push them before the 3.2 code freeze.

Thanks to have spotted it! Out of curiosity, could you tell us how do you use the rest api ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

rednival

  • Guest
Re: Contributions and REST Api
May 13, 2010, 09:23:59 am
I actually work for a company that provides database services to non-profits called Data Management Inc. (http://www.data-management.com).

We have a client using CiviCRM and we are writing calls to retrieve their contributions and import then into another database that we host for them here.


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Contributions and REST Api

This forum was archived on 2017-11-26.