Skip to content
Snippets Groups Projects

Apiv4 documentation

Merged homotechsual requested to merge github/fork/seamuslee001/apiv4_documentation into master

Created by: seamuslee001

This incoporates https://github.com/civicrm/civicrm-dev-docs/pull/689/files

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • homotechsual
  • homotechsual
  • homotechsual
  • homotechsual
  • homotechsual
  • homotechsual
  • homotechsual
    homotechsual @homotechsual started a thread on commit 16bc31f8
  • 173 Using the CRM.api3 method you can pass multiple requests through at once e.g.
    174
    175 ```javascript
    176 var params = [
    177 ['email', 'get', {contact_id: 123}],
    178 ['phone', 'get', {phone: '555-5555'}]
    179 ];
    180 CRM.api3(params).done(function(result) {
    181 console.log('email result is:', result[0]);
    182 console.log('phone result is:', result[1]);
    183 });
    184 ```
    185
    186 You can also use associative objects in your API call as follows:
    187
    188 ```
  • homotechsual
  • homotechsual
  • homotechsual
  • homotechsual
  • homotechsual
  • homotechsual
  • homotechsual
  • homotechsual
  • homotechsual
    homotechsual @homotechsual started a thread on commit 16bc31f8
  • 67 ]);
    68 }
    69 catch (\API_Exception $e) {
    70 $error = $e->getMessage();
    71 }
    72 printf("Found %d item(s)\n", count($contacts));
    73 ```
    74
    75 This format matches canonical format almost exactly, with a few improvements for usability:
    76
    77 The `version => 4` parameter is not required.
    78 Errors are reported as PHP exceptions. You may catch the exceptions or (by default) allow them to bubble up.
    79 You can immediately iterate over the contacts returned
    80
    81 *Note*: If you're writing a Drupal module, a Joomla extension, a WordPress plugin, or a standalone script, then you may need to **bootstrap** CiviCRM before using the API. See the examples in [Bootstrap Reference].
    82
  • homotechsual
  • homotechsual
  • homotechsual
  • homotechsual
  • Created by: seamuslee001

    @MikeyMJCO changes made and have pushed a change to be more accurate on the interfaces

  • Please register or sign in to reply
    Loading