Answers.Body: <p>You probably want the <code>UFField</code> entity, not <code>Profile</code> ...  try:</p>
  <pre><code>entity=UFField&amp;action=get&amp;api_key=userkey&amp;key=sitekey&amp;json={&quot;sequential&quot;:1,&quot;profile_id&quot;:22}
  </code></pre>
  <p>Then you can chain <code>getfield</code>:</p>
  <pre><code>entity=UFField&amp;action=get&amp;api_key=userkey&amp;key=sitekey&amp;json={&quot;sequential&quot;:1,
  &quot;uf_group_id&quot;:22,
  &quot;api.Contact.getfield&quot;:{&quot;action&quot;:&quot;get&quot;,&quot;name&quot;:&quot;$value.field_name&quot;}}
  </code></pre>
  <p>That assumes the custom fields are for Contacts.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-13T19:37:50.343Z
Answers.LastActivityDate: 2020-11-17T14:08:53.130Z
Answers.LastEditDate: 2020-11-17T14:08:53.130Z
Answers.UserDisplayName: Aidan
Body: <p>I want to join the below api calls-</p>
  <p>API 1</p>
  <pre><code>http://ec2-3-6-40-236.ap-south-1.compute.amazonaws.com/civicrm/sites/all/modules/civicrm/extern/rest.php?entity=Profile&amp;action=get&amp;api_key=userkey&amp;key=sitekey&amp;json={&quot;sequential&quot;:1,&quot;profile_id&quot;:22}
  </code></pre>
  <p>RESULT 1</p>
  <pre><code>{
  
  &quot;is_error&quot;: 0,
  &quot;version&quot;: 3,
  &quot;count&quot;: 1,
  &quot;values&quot;: {
      &quot;custom_64&quot;: &quot;&quot;,
      &quot;custom_65&quot;: &quot;&quot;,
      &quot;custom_66&quot;: &quot;&quot;,
      &quot;custom_46&quot;: &quot;&quot;,
      &quot;custom_47&quot;: &quot;&quot;,
      &quot;custom_48&quot;: &quot;&quot;,
      &quot;custom_62&quot;: &quot;&quot;,
      &quot;custom_50&quot;: &quot;&quot;,
      &quot;custom_51&quot;: &quot;&quot;,
      &quot;custom_63&quot;: &quot;&quot;,
      &quot;custom_53&quot;: &quot;&quot;,
      &quot;custom_54&quot;: &quot;&quot;,
      &quot;custom_55&quot;: &quot;&quot;,
      &quot;custom_56&quot;: &quot;&quot;,
      &quot;custom_57&quot;: &quot;&quot;
    }
  }
  </code></pre>
  <p>API 2</p>
  <pre><code>http://ec2-3-6-40-236.ap-south-1.compute.amazonaws.com/civicrm/sites/all/modules/civicrm/extern/rest.php?entity=Contact&amp;action=getfield&amp;api_key=userkey&amp;key=sitekey&amp;json={&quot;name&quot;:&quot;custom_62&quot;,&quot;action&quot;:&quot;get&quot;}
  </code></pre>
  <p>RESULT 2</p>
  <pre><code>    {
  
      &quot;is_error&quot;: 0,
      &quot;version&quot;: 3,
      &quot;count&quot;: 31,
      &quot;values&quot;: {
          &quot;id&quot;: &quot;62&quot;,
          &quot;label&quot;: &quot;Relationship with Guardian&quot;,
          &quot;headerPattern&quot;: &quot;//&quot;,
          &quot;title&quot;: &quot;Relationship with Guardian&quot;,
          &quot;custom_field_id&quot;: &quot;62&quot;,
          &quot;groupTitle&quot;: &quot;Voter Details&quot;,
          &quot;data_type&quot;: &quot;String&quot;,
          &quot;name&quot;: &quot;custom_62&quot;,
          &quot;type&quot;: 2,
          &quot;html_type&quot;: &quot;Radio&quot;,
          &quot;default_value&quot;: null,
          &quot;text_length&quot;: &quot;255&quot;,
          &quot;options_per_line&quot;: &quot;2&quot;,
          &quot;custom_group_id&quot;: &quot;28&quot;,
          &quot;extends&quot;: &quot;Individual&quot;,
          &quot;is_search_range&quot;: &quot;0&quot;,
          &quot;extends_entity_column_value&quot;: [
              &quot;Voter&quot;
          ],
          &quot;extends_entity_column_id&quot;: null,
          &quot;is_view&quot;: null,
          &quot;is_multiple&quot;: &quot;0&quot;,
          &quot;option_group_id&quot;: &quot;121&quot;,
          &quot;date_format&quot;: null,
          &quot;time_format&quot;: null,
          &quot;is_required&quot;: null,
          &quot;table_name&quot;: &quot;civicrm_value_voter_details_28&quot;,
          &quot;column_name&quot;: &quot;relationship_with_guardian_62&quot;,
          &quot;serialize&quot;: null,
          &quot;where&quot;: &quot;civicrm_value_voter_details_28.relationship_with_guardian_62&quot;,
          &quot;extends_table&quot;: &quot;civicrm_contact&quot;,
          &quot;search_table&quot;: &quot;contact_a&quot;,
          &quot;pseudoconstant&quot;: {
              &quot;optionGroupName&quot;: &quot;relationship_with_guardian_20201110084841&quot;,
              &quot;optionEditPath&quot;: &quot;civicrm/admin/options/relationship_with_guardian_20201110084841&quot;
          }
      }
  }
  </code></pre>
  <p>I have tried with this api call-</p>
  <pre><code>http://ec2-3-6-40-236.ap-south-1.compute.amazonaws.com/civicrm/sites/all/modules/civicrm/extern/rest.php?entity=Profile&amp;action=get&amp;api_key=userkey&amp;key=sitekey&amp;json={&quot;sequential&quot;:1,&quot;profile_id&quot;:22,&quot;api.Contact.getfield&quot;:{&quot;name&quot;:&quot;$value&quot;,&quot;action&quot;:&quot;get&quot;}}
  </code></pre>
  <p>But I got this error :(</p>
  <pre><code>    {
  
      &quot;fields&quot;: [
          &quot;name&quot;
      ],
      &quot;error_code&quot;: &quot;mandatory_missing&quot;,
      &quot;entity&quot;: &quot;Profile&quot;,
      &quot;action&quot;: &quot;get&quot;,
      &quot;is_error&quot;: 1,
      &quot;error_message&quot;: &quot;Error in call to Contact_getfield : Mandatory key(s) missing from params array: name&quot;
  }
  </code></pre>
  <p>Please help.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-11T11:01:07.433Z
Comments.Text: can you hardcode the value `custom_62` in the chain api call? If yes, `http://ec2-3-6-40-236.ap-south-1.compute.amazonaws.com/civicrm/sites/all/modules/civicrm/extern/rest.php?entity=Profile&action=get&api_key=userkey&key=sitekey&json={"sequential":1,"profile_id":22,"api.Contact.getfield":{"name":"custom_62","action":"get"}}` should work. If not, i dont think it is possible in a single api call as the value you need to pass on the chained api is present in key and not value.
Comments.UserDisplayName: jitendra - fuzion
Tags: <contacts><custom-fields><profile>
Title: How to chain api calls i.e. GETFIELD contact for fieldID after doing GET profile on profileID?
ThreadText: # How to chain api calls i.e. GETFIELD contact for fieldID after doing GET profile on profileID?
  
  (Asked by: username_0 on 2020-11-10)
  
  I want to join the below api calls-
  API 1
  http://ec2-3-6-40-236.ap-south-1.compute.amazonaws.com/civicrm/sites/all/modules/civicrm/extern/rest.php?entity=Profile&action=get&api_key=userkey&key=sitekey&json={"sequential":1,"profile_id":22}
  
  RESULT 1
  {
  
  "is_error": 0,
  "version": 3,
  "count": 1,
  "values": {
      "custom_64": "",
      "custom_65": "",
      "custom_66": "",
      "custom_46": "",
      "custom_47": "",
      "custom_48": "",
      "custom_62": "",
      "custom_50": "",
      "custom_51": "",
      "custom_63": "",
      "custom_53": "",
      "custom_54": "",
      "custom_55": "",
      "custom_56": "",
      "custom_57": ""
    }
  }
  
  API 2
  http://ec2-3-6-40-236.ap-south-1.compute.amazonaws.com/civicrm/sites/all/modules/civicrm/extern/rest.php?entity=Contact&action=getfield&api_key=userkey&key=sitekey&json={"name":"custom_62","action":"get"}
  
  RESULT 2
      {
  
      "is_error": 0,
      "version": 3,
      "count": 31,
      "values": {
          "id": "62",
          "label": "Relationship with Guardian",
          "headerPattern": "//",
          "title": "Relationship with Guardian",
          "custom_field_id": "62",
          "groupTitle": "Voter Details",
          "data_type": "String",
          "name": "custom_62",
          "type": 2,
          "html_type": "Radio",
          "default_value": null,
          "text_length": "255",
          "options_per_line": "2",
          "custom_group_id": "28",
          "extends": "Individual",
          "is_search_range": "0",
          "extends_entity_column_value": [
              "Voter"
          ],
          "extends_entity_column_id": null,
          "is_view": null,
          "is_multiple": "0",
          "option_group_id": "121",
          "date_format": null,
          "time_format": null,
          "is_required": null,
          "table_name": "civicrm_value_voter_details_28",
          "column_name": "relationship_with_guardian_62",
          "serialize": null,
          "where": "civicrm_value_voter_details_28.relationship_with_guardian_62",
          "extends_table": "civicrm_contact",
          "search_table": "contact_a",
          "pseudoconstant": {
              "optionGroupName": "relationship_with_guardian_20201110084841",
              "optionEditPath": "civicrm/admin/options/relationship_with_guardian_20201110084841"
          }
      }
  }
  
  I have tried with this api call-
  http://ec2-3-6-40-236.ap-south-1.compute.amazonaws.com/civicrm/sites/all/modules/civicrm/extern/rest.php?entity=Profile&action=get&api_key=userkey&key=sitekey&json={"sequential":1,"profile_id":22,"api.Contact.getfield":{"name":"$value","action":"get"}}
  
  But I got this error :(
      {
  
      "fields": [
          "name"
      ],
      "error_code": "mandatory_missing",
      "entity": "Profile",
      "action": "get",
      "is_error": 1,
      "error_message": "Error in call to Contact_getfield : Mandatory key(s) missing from params array: name"
  }
  
  Please help.
  
  **Tags:** contacts, custom-fields, profile
  
  > **Comments:**
  > **username_1**: can you hardcode the value `custom_62` in the chain api call? If yes, `http://ec2-3-6-40-236.ap-south-1.compute.amazonaws.com/civicrm/sites/all/modules/civicrm/extern/rest.php?entity=Profile&action=get&api_key=userkey&key=sitekey&json={"sequential":1,"profile_id":22,"api.Contact.getfield":{"name":"custom_62","action":"get"}}` should work. If not, i dont think it is possible in a single api call as the value you need to pass on the chained api is present in key and not value.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-11-13. Score: 2
  
  You probably want the UFField entity, not Profile ...  try:
  entity=UFField&action=get&api_key=userkey&key=sitekey&json={"sequential":1,"profile_id":22}
  
  Then you can chain getfield:
  entity=UFField&action=get&api_key=userkey&key=sitekey&json={"sequential":1,
  "uf_group_id":22,
  "api.Contact.getfield":{"action":"get","name":"$value.field_name"}}
  
  That assumes the custom fields are for Contacts.
  
  
  ---
  
  