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

HTTP api returns invalid result if wrong api key is provided

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.7
    • Fix Version/s: 4.7.7
    • Component/s: CiviCRM API
    • Labels:
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      (This is probably Drupal specific)

      If I use the HTTP-API e.g. with curl, and you provide an invalid key, e.g.

      curl 'http://localhost/~johanv/civi-upstream/sites/all/modules/civicrm/extern/rest.php?entity=Address&action=get&api_key=WRONGAPIKEY&key=MYSITEKEY&json=%7b"sequential":1,"id":186%7d'

      I get an invalid result. On my dev-machine, this is a html page, containing this information:

         ( ! ) Fatal error: Call to undefined function drupal_add_http_header() in /home/johanv/dev/civi-upstream/sites/all/modules/civicrm/CRM/Utils/System/Drupal.php on line 789
         Call Stack
         # Time Memory Function Location
         1 0.0002 238312 {main}( ) ../rest.php:0
         2 0.0551 11588912 CRM_Utils_REST->bootAndRun( ) ../rest.php:42
         3 0.0555 11596848 CRM_Utils_REST::output( ) ../REST.php:114
         4 0.0555 11597960 setHttpHeader ( ) ../REST.php:151
         5 0.0555 11598456 CRM_Utils_System::__callStatic( ) ../REST.php:151
         6 0.0555 11598896 call_user_func_array:{/home/johanv/dev/civi-upstream/sites/all/modules/civicrm/CRM/Utils/System.php:74} ( ) ../System.php:74
         7 0.0555 11599352 CRM_Utils_System_Drupal->setHttpHeader( ) ../System.php:74
      

      This error message is similar to the one in CRM-17965. Pull request https://github.com/civicrm/civicrm-core/pull/8069 works around this problem, but it is ugly, and will probably not be merged.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              johanv Johan Vervloet
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: