CRM-3832 rest API: no more key needed

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.2.0
    • Component/s: CiviCRM API
    • Labels:
      None

      Description

      Hi,

      Two changes to make it easier:

      1) Now you don't need a key. As soon as you are authenticated, you can run (example)

      http://example.com/sites/all/modules/civicrm/extern/rest.php?q=civicrm/contact/search
      or with more param (only the individuals, and return the name, mail and country)
      http://example.com/sites/all/modules/civicrm/extern/rest.php?q=civicrm/contact/search&contactType=Individual&return[email]=1&return[sort_name]=1&return[country]=1

      on every case you can have it as a json format:
      http://example.com/sites/all/modules/civicrm/extern/rest.php?q=civicrm/contact/search&json=1

      2) Now the authentication returns the session ID

      http://example.com/sites/all/modules/civicrm/extern/rest.php?q=civicrm/login&user=xx&pwd=yy
      returns a PHPSESSID that you can uses as a get param on the other queries

      eg:
      http://example.com/sites/all/modules/civicrm/extern/rest.php?q=civicrm/contact/search&PHPSESSID=a956745e3d0056377adaa63a1c9dbb95

        Attachments

        1. REST.php
          9 kB
          xavier dutoit
        2. REST.php.diff
          4 kB
          xavier dutoit

          Activity

          [CRM-3832] rest API: no more key needed
          xavier dutoit added a comment -

          That's what your file should look like after the patch applied (you can replace your CRM/Utils/REST.php with this attachment).

          Sunil Pawar added a comment -

          Verified in r18956

          Chris Ivens added a comment -

          I made the changes from the patch into my v2.1 file. Should I submit a further patch for 2.1 users?

          Kurund Jalmi added a comment -

          Batch move to verification

          Amiteshwar Prasad added a comment -

          Verified with r23536

            People

            • Assignee:
              Amiteshwar Prasad
              Reporter:
              xavier dutoit

              Dates

              • Created:
                Updated:
                Resolved: