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 (Moderator: Donald Lobo) »
  • fetch a list of contact via soap, possible ?
Pages: [1]

Author Topic: fetch a list of contact via soap, possible ?  (Read 5142 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
fetch a list of contact via soap, possible ?
December 17, 2007, 12:06:23 pm
Hello,

I'm trying to display a list of contact (sub list, only some members) in an external site.

The idea was to use soap, but when I look at CRM/Utils/SoapServer.php I don't see any api that looks like a search query.

Am I missing something ?

I'm looking for something that queries crm_contact_search (most probably, looking at the code)

Any suggestion ?

Moreover, I'm looking at a way of querying a contact+ a specific relation (eg the individual contact + his/her organisation (ie. the first "Employees of" relation betwen the person and an organisation). Is there a way to get this join directly from the api ?

Still lost, but I'm getting closer and start to find my way in the code (mostly).

X+

P.S. I'm not specifically looking for soap, if there is a REST or JSON interface, that would do as well (or better).



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

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: fetch a list of contact via soap, possible ?
December 17, 2007, 12:30:28 pm
You might have to use 2 apis for this. First get contact information and then its relationships.
check :
http://fisheye.civicrm.org/browse/~raw,r=9110/CiviCRM/trunk/api/Search.php
http://fisheye.civicrm.org/browse/~raw,r=9110/CiviCRM/trunk/api/Relationship.php

HTH

kurund


Found this reply helpful? Support CiviCRM

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: fetch a list of contact via soap, possible ?
December 17, 2007, 03:42:40 pm
Thanks, that's a good option for one contact. However, as soon as they are several, it won't make it and I'll really have to have a join query. I'll see if there is something in the lower level for me (they are some query builders, have to dig)


As for my main question, is there any sop/rest/json interface build on the api you mention ?

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

geilhufe

  • I post frequently
  • ***
  • Posts: 293
  • Karma: 33
    • Social Source Software
Re: fetch a list of contact via soap, possible ?
December 17, 2007, 06:08:25 pm
This should help:
http://wiki.civicrm.org/confluence/display/CRMDOC/API+Overview
Drupal and CiviCRM consulting, strategy and configuration
http://www.social-source.com/

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: fetch a list of contact via soap, possible ?
December 18, 2007, 01:37:41 am
Thanks, got a clearer view on the api(s) and what they can do. Found several snippets about how to do what I want from a block in drupal too.

However, I didn't see these apis (well, one to get a list of contacts for instance) "wrapped" in a soap interface. Is this something each use case has to do or is there something generic ?

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

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: fetch a list of contact via soap, possible ?
December 18, 2007, 08:01:24 pm

we've only wrapped the mailer api's that we needed under SOAP. You can use the generic wrapper and add code (CRM/Utils/SoapServer.php) to do the needful

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

Denver Dave

  • Ask me questions
  • ****
  • Posts: 471
  • Karma: 9
Re: fetch a list of contact via soap, possible ?
December 30, 2007, 02:23:36 pm
Just curious why SOAP is required rather than using a php  program to generate an XML file?

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: fetch a list of contact via soap, possible ?
January 01, 2008, 10:59:15 pm
Hi,

Soap isn't required. The goal was to display a list of members into another CMS page (spip). I wanted the list fairly up to date, and with an idea of making it searchable later. The member database is on an intranet, the list is to be displayed on a public website on a different machine.

As spip has a cache system, it wouldn't be a problem to soap query directly, and let it do take care of caching and defining when it wants to pull the latest list.

Generating an xml would do, of course, but then you have to find a system to regenerate this file on a regular basis (cron).

Well basically, I used that need to see how civicrm could interface with external systems. My conclusion is the API is good and easy to use, that it's a 3 lines code to wrap the api into a soap call, but that wrapper has to be written on a ad-hoc basis (ie no complete soap API yet).

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

Denver Dave

  • Ask me questions
  • ****
  • Posts: 471
  • Karma: 9
Re: fetch a list of contact via soap, possible ?
January 02, 2008, 09:52:27 am
Thanks - I'm aware that SOAP is useful in some situations, so try to keep alert.  I have a somewhat similar situation for phpBB where website2 lists the latest topics from website1.  I wrote a .php script that is located on website1 that is requested by website 2 with a @read php statement.  So things are always up to date. 

I probably should have used XML for the above, but I just had the original website1 format the output for  website2.  It was simple, but not the most flexible.

Jakub Thomas

  • Guest
Re: fetch a list of contact via soap, possible ?
January 08, 2008, 01:42:14 am
Hi,

I had the similar problem. Our site shows a list of members from the specific area. So we didnt use CiviCRM SOAP but created our own one. Our 2 sites work on Drupal installation. SOAP server initialize Drupal first, then we use CiviCRM API. Other idea is to access directly to database, but then the knowledge of civicrm structure is necessary.

J

bob schmitt

  • I’m new here
  • *
  • Posts: 22
  • Karma: 1
    • Expeditionary Information Systems
Re: fetch a list of contact via soap, possible ?
January 08, 2008, 11:28:03 am
I'm curious why you just didn't setup a public profile to display on your second site?

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: fetch a list of contact via soap, possible ?
January 23, 2008, 12:52:58 am
Hi

For two reasons:

the bad one: I don't have any idea what a public profile is. I'll dig that more.

the good one: this other website is running a different CMS than drupal.

X+

P.S> Sorry for the delay, don't receive notifications on the updates
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Denver Dave

  • Ask me questions
  • ****
  • Posts: 471
  • Karma: 9
Re: fetch a list of contact via soap, possible ?
January 23, 2008, 09:06:33 am
Quote
For two reasons:
the bad one: I don't have any idea what a public profile is. I'll dig that more.
the good one: this other website is running a different CMS than drupal.

If by public profile, we are talking about the standalone profile - it is very easy to do and can be displayed on any website where you have access to add html code.  I use Drupal for the contacts, but the standalone form can be on any website.

When you go to Administer CiviCRM / CiviCRM Profile - create a profile where you have the Profile box checked.  Then when viewing the list of profiles just click on the standalone profile link to view the html code to place on any webpage.  Essentially a form that allows creation of a contact for a specified group.

Standalone forms are easy to do - in fact I have not yet figured out how to do a form that is not standalone (on a Drupal page).

However, there may be issues with standalone forms:

(1) Defending Standalone Forms - captcha may not be available for standalone forms depending where placed and what are the security issues with allowing the public to create records.

(2) Standalone Profile Hijacks Logged In User - I would really like to know if others have this issue.
http://forum.civicrm.org/index.php/topic,1811.0.html

(3) The Standalone forms work for creating new contacts, but don't seem to allow a contact to change their contact information themselves with a token or some other protection mechanism - few of my contacts are Drupal administrative users.   Strangely, the ability for contact to change their profile is a standard feature of every Phplist email - not sure why this feature does not seem to be included in CiviCRM - maybe a security issue or maybe I just haven't figured out how to do it yet.
« Last Edit: January 23, 2008, 09:09:54 am by Denver Dave »

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: fetch a list of contact via soap, possible ?
January 23, 2008, 01:35:33 pm
Check out my recent post on allowing contacts to edit their own data in a profile w/o requiring a Drupal account:

http://forum.civicrm.org/index.php/topic,2074.msg8970.html#msg8970
Protect your investment in CiviCRM by  becoming a Member!

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: fetch a list of contact via soap, possible ?
January 24, 2008, 01:37:58 am
@Denver

Thanks for the tips, That's going to come handy for sure. However, the goal wasn't to let someone registers, but to display a list of  contacts (members).

I'll for sure be spending some time on the profiles, I need to get a grip on that.

@ dave
That's great ! I'm following the discussion on the other tread.

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • fetch a list of contact via soap, possible ?

This forum was archived on 2017-11-26.