3

Not much doc on API and joined table fields... Any special reason I can't get the contact's primary address in a membership query... Basically this

$result = civicrm_api3('Membership', 'get', array(
  'debug' => 1,
  'sequential' => 1,
  'return' => array("contact_id.display_name", "contact_id.street_address"),
));

Only returns contact_id.display_name

1 Answer 1

4

Membership doesn't have a contact details(apart from id) in its API call. To get the address and display name, I think you need to call a chain API -

$result = civicrm_api3('Membership', 'get', array(
  'sequential' => 1,
  'api.Contact.get' => array('return' => "display_name, street_address"),
));

More about chaining - https://wiki.civicrm.org/confluence/display/CRMDOC/Chaining

1
  • Ah, I see now... Thanks... That API needs work...
    – Serge
    Commented Jun 4, 2017 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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