Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-17361

Contact API country fields not functioning properly anymore

    Details

    • Documentation Required?:
      None
    • Funding Source:
      Core Team Funds

      Description

      I have a bit of custom code on one site that pulls contacts based on 'Primary Address country' as follows (example):

      $contactcount=civicrm_api("Contact","getcount", array ('version' =>'3', 'contact_type' =>'Organization', 'country' =>'United States');

      When I try this on the API Explorer on the demo site, I get this error:

      "error_message":"A fatal error was triggered: United States is not of the type Positive"
      

      It seems to have stopped working with an upgrade from 4.6.7 to 4.6.9. Did something change in the API call?

      Update:

      I was trying to rough in some temporary code to make this functional by using the Country ID instead of the Country Name, and there seems to be a problem there, too. The country ID field in the API seems to be essentially ignored.

      $contactcount=civicrm_api("Contact","getcount", array ('version' =>'3', 'contact_type' =>'Organization', 'country_id' => 1228);

      I verified this on the demo site, too.

        Attachments

          Activity

            People

            • Assignee:
              monish.deb Monish Deb
              Reporter:
              lpkb Laryn - CEDC.org
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: