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

Normalize incoming api entity & action names

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.5
    • Fix Version/s: 4.6
    • Component/s: None
    • Labels:
      None
    • Documentation Required?:
      None

      Description

      Subtle bugs have arisen over the years (and still continue to be a problem) due to the api's support of multiple naming conventions for each entity and action. Currently the api supports:

      ActionSchedule
      actionSchedule
      action_schedule
      Action_Schedule
      action_Schedule
      action schedule

      The list could go on, nearly any combination of upper and lowercase letters and underscores works. This wouldn't be so bad if the civicrm_api wrapper immediately converted all incoming entity strings into a standardized format, but it doesn't, so it's left up to lower-down functions to fend for themselves, and sometimes (for example the permission system) they can't recognize the format. Here's my proposal:

      • For the remainder of the v3 lifecycle, we continue to support all of the above formats.
      • Internally, we settle on a standard and the civicrm_api wrapper will immediately convert incoming entity and action names to that format.
      • We consider dropping support for nonstandard formats in future versions of the api.

      My proposed standard is CamelCase for entities (with first letter capitalized) and lowercase for actions. These are the formats currently returned by api.Entity.get and api.getactions, respectively, so they are the formats presented in the api explorer.

        Attachments

          Activity

            People

            • Assignee:
              colemanw Coleman Watts
              Reporter:
              colemanw Coleman Watts
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: