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.
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. – jitendra - fuzion Nov 11 '20 at 11:01