Answers.Body: <p>Contact API sends one result per contact. In case if you want to retrieve all custom field value(multiple) of a contact than you need to use CustomValue api. Snippet for reference</p>
  
  <p>REST:</p>
  
  <pre><code>http://localhost/drupal7/sites/all/modules/civicrm/extern/rest.php?entity=CustomValue&amp;action=get&amp;api_key=userkey&amp;key=sitekey&amp;json={"sequential":1,"return":"custom_81,custom_80","entity_id":296,"entityType":"contact"}
  </code></pre>
  
  <p>PHP</p>
  
  <pre><code>$result = civicrm_api3('CustomValue', 'get', [
    'sequential' =&gt; 1,
    'return' =&gt; ["custom_81", "custom_80"],
    'entity_id' =&gt; 296,
    'entityType' =&gt; "contact",
  ]);
  </code></pre>
  
  <p>entity_id = contact id</p>
  
  <p>return = custom fields</p>
  
  <p>HTH</p>
  
  <p>Pradeep</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-12T09:00:33.773Z
Answers.LastActivityDate: 2019-04-12T09:00:33.773Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>I have a custom field that can be inserted multiple times in a contact. I'm trying to get the right syntax for the API to display an array with the different results.</p>
  
  <p>Here what I'm trying: <code>civicrm/extern/rest.php?entity=Contact&amp;action=get&amp;api_key=userkey&amp;key=sitekey&amp;json={"sequential":1,"return":"custom_40","id":900}</code></p>
  
  <p>I thought that "sequential" would give multiple results but it's showing only one </p>
  
  <p>{</p>
  
  <pre><code>"is_error": 0,
  "version": 3,
  "count": 1,
  "id": 900,
  "values": [
      {
          "contact_id": "900",
          "civicrm_value_fellowships_3_id": "305",
          "custom_40": "2007-06-30 00:00:00",
          "id": "900"
      }
  ]
  </code></pre>
  
  <p>}</p>
  
Tags: <api>
Title: API v3 get multiple results for one field
ThreadText: # API v3 get multiple results for one field
  
  (Asked by: username_0 on 2019-04-12)
  
  I have a custom field that can be inserted multiple times in a contact. I'm trying to get the right syntax for the API to display an array with the different results.
  Here what I'm trying: civicrm/extern/rest.php?entity=Contact&action=get&api_key=userkey&key=sitekey&json={"sequential":1,"return":"custom_40","id":900}
  I thought that "sequential" would give multiple results but it's showing only one 
  {
  "is_error": 0,
  "version": 3,
  "count": 1,
  "id": 900,
  "values": [
      {
          "contact_id": "900",
          "civicrm_value_fellowships_3_id": "305",
          "custom_40": "2007-06-30 00:00:00",
          "id": "900"
      }
  ]
  
  }
  
  **Tags:** api
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-04-12. Score: 1 | Accepted answer
  
  Contact API sends one result per contact. In case if you want to retrieve all custom field value(multiple) of a contact than you need to use CustomValue api. Snippet for reference
  REST:
  http://localhost/drupal7/sites/all/modules/civicrm/extern/rest.php?entity=CustomValue&action=get&api_key=userkey&key=sitekey&json={"sequential":1,"return":"custom_81,custom_80","entity_id":296,"entityType":"contact"}
  
  PHP
  $result = civicrm_api3('CustomValue', 'get', [
    'sequential' => 1,
    'return' => ["custom_81", "custom_80"],
    'entity_id' => 296,
    'entityType' => "contact",
  ]);
  
  entity_id = contact id
  return = custom fields
  HTH
  Pradeep
  
  
  ---
  
  