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) »
  • Discussion (deprecated) »
  • Documentation, Book and Training Resources (Moderator: Michał Mach) »
  • REST API documentation
Pages: [1]

Author Topic: REST API documentation  (Read 11322 times)

acrosman

  • Guest
REST API documentation
April 17, 2008, 02:30:41 pm
Is there documentation on the REST interface that's present in 2.0?  I've been looking at its code a little, and I'd like to try to use it to link together a couple of our systems, but I can't find any docs in the Wiki.  Am I missing something or is the wiki?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: REST API documentation
April 17, 2008, 10:32:03 pm

We have not really released / tested any REST based api's either officially or unofficially. I do think we need to figure out and detail a better web services plan and avoid making it comprehensive initially (its a worthy goal, but too big of a bite to tackle). Can you document your use cases for what api functionality you are looking for.

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

acrosman

  • Guest
Re: REST API documentation
April 18, 2008, 12:46:21 pm
Happily (unlike last time we talked about this, I actually know some of what I want).  Where should I do that?

Aaron

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: REST API documentation
April 18, 2008, 01:19:22 pm

How about here: http://wiki.civicrm.org/confluence/display/CRM/CiviCRM+Web+Services+API+use+cases

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

acrosman

  • Guest
Re: REST API documentation
April 21, 2008, 12:12:29 pm
I finally got something up here, sorry it took so long to get so little done.

Aaron

acrosman

  • Guest
Re: REST API documentation
April 26, 2008, 06:29:09 pm
Given that I'd like to start using these API's in the next few months, I'd be willing to put some of my own personal time into creating the code.  However, I'd like to make sure I'm building around a standard that will be helpful to the project over time.  What would be the best way to move forward?

Aaron

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: REST API documentation
April 26, 2008, 08:20:26 pm
sorry for the non-response. we've been a bit busy with some trainings and our current NZ meetup hack-a-thon :)

I think the next step would be to flush out in a more detail the API's you'd like. Given that, we can start building our web services API layer.

Initially i think, our web services layer will be a small group of api's that create/update top level contact data. We'd like the functions to be small and granular and hopefully can construct the web services layer to directly use the BAO functions (which is moving towards being the default API)

We'd also like to use this opportunity to do TDD (test driven development) and build the unit tests before we actually write code for the web services layer. We've been using SimpleTest so far, and would like to continue doing so, and potentially use some of drupal's improvements to it

lobo
« Last Edit: April 26, 2008, 08:22:10 pm by Donald Lobo »
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

acrosman

  • Guest
Re: REST API documentation
April 28, 2008, 07:47:35 am
I pulled out a little about what functions would be required to make the scenarios I listed the other day actually possible, but some guidance on what else would be helpful here.  I'm happy to help, I'm just not sure what the best way to do it is. ???

As for TDD, I think it's a create idea, although I only have very basic experience with it, and none with SimpleTest (although its name is promising).

Aaron

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: REST API documentation
May 01, 2008, 03:35:26 am

apologies for the delay, the NZ meetup is proving to be quite productive and time consuming.

I looked through your use case scenario and looks like we cover a most of your needs with regard to the current version of the api. API documentation is here: http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs

There are a few things which we still need to do:

1. build a REST wrapper around it. I experimented with it in v1.x and the code is at extern/rest.php. You should take a look at it and see if you can get it up and running. I'm a bit hosed till may 10th, but can help out a bit

2. write a few unit tests and experiment with what the api does and whether it meets your needs. Contact is a pretty deep object and we've moved away from retrieving ALL information about a contact in one call (contribution, membership, participant etc). Not sure what information you are looking to extract from it, but would be good to confirm we do retrieve that information

lobo


lobo

A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

acrosman

  • Guest
Re: REST API documentation
May 13, 2008, 01:05:26 pm
I'm finally getting back to working on this today.

The existing REST wrapper seems to work well for the Contact creation and editing, but it appears to have no way to search/create/delete groups.  You can place users into groups, but I can't find a way to handle the groups themselves.  Am I missing something or is do I need to extend the wrapper to handle the groups?

Based on the existing code it looks like it wouldn't be too hard to do.

Aaron

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: REST API documentation
May 13, 2008, 02:15:42 pm

u should be able to extend the REST.php function to include the group api also

ideally we should tweak the whole protocol and automatically call a function by creating a string like civicrm_OBJNAME_OPERATION and following that convention, rather than a switch statement. All functions are supposed to take one parameter (an array) and hence this should be relatively easy

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

acrosman

  • Guest
Re: REST API documentation
May 14, 2008, 08:31:22 am
I've done the basic step of adding the group functions, and they seem to work fine.  I've attached the patch file, and I'll submit it to the Issue tracker shortly per the contribution guidelines.

I'll work on the more general case a little later.  My instincts have me a little nervous about the security of such a simple scheme. The advantage of the switch statements is that they nicely verify the the command in on the list of safe commands before executing it, seems like a more general command would bring a bit more risk with it.  Maybe I'm just over thinking the issue.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Documentation, Book and Training Resources (Moderator: Michał Mach) »
  • REST API documentation

This forum was archived on 2017-11-26.