Answers.Body: <p>Not 100% sure but I think it's a limitation in the current REST api. If you set the json param, the result is json formatted. 
  Can you try to not set json param by doing :</p>
  
  <pre><code>entity=Contact&amp;action=get&amp;contact_id=1234&amp;api.Phone.get=1
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-10T15:44:41.087Z
Answers.Text: That pulls in the contact record in xml format, but not the related phone records.  The issue seems to be how to get the chained api call recognized outside of setting the json parameter.
Answers.UserDisplayName: swandog
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-10T16:42:11.657Z
Answers.Text: I think you need a value, by setting api.phone.get=1, it should work. Still, it's far from perfect as you will be limited by this syntax at some point.
Answers.UserDisplayName: samuelsov
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-10T18:14:58.323Z
Answers.Text: Changing it to api.phone.get=1 still didn't pull in related phone records. You're right though, I will be limited by this syntax, and it seems as if I already am!
Answers.UserDisplayName: swandog
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-10T14:57:58.293Z
Answers.LastActivityDate: 2015-04-10T16:40:55.763Z
Answers.LastEditDate: 2015-04-10T16:40:55.763Z
Answers.UserDisplayName: samuelsov
Answers.Body: <p>@samuelsov got me going in the right direction, along with trial and error from the <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/REST+interface#RESTinterface-Chainingparameters" rel="nofollow">documentation</a>:</p>
  
  <p>This returns all related phone records for the given contact_id:</p>
  
  <pre><code>entity=Contact&amp;action=get&amp;contact_id=1234&amp;api.Phone.get[values]
  </code></pre>
  
  <p>And you can filter the chained API call too, for example all related phone records with a phone_type_id of 2:</p>
  
  <pre><code>entity=Contact&amp;action=get&amp;contact_id=1234&amp;api.Phone.get[phone_type_id]=2
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-10T18:52:51.277Z
Answers.LastActivityDate: 2015-04-10T18:52:51.277Z
Answers.UserDisplayName: swandog
Body: <p>This query string will return a contact record and related phone records for Contact ID 1234 in json format:</p>
  
  <pre><code>entity=Contact&amp;action=get&amp;json={"contact_id":"1234","api.Phone.get":{}}
  </code></pre>
  
  <p>How do I construct a query string that will return the results in xml format?  It seems as if the API Explorer only returns json.</p>
  
Tags: <api><rest>
Title: How do I get a chained restful API call to return xml?
ThreadText: # How do I get a chained restful API call to return xml?
  
  (Asked by: username_0 on 2015-04-09)
  
  This query string will return a contact record and related phone records for Contact ID 1234 in json format:
  entity=Contact&action=get&json={"contact_id":"1234","api.Phone.get":{}}
  
  How do I construct a query string that will return the results in xml format?  It seems as if the API Explorer only returns json.
  
  **Tags:** api, rest
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2015-04-10. Score: 3 | Accepted answer
  
  @username_1 got me going in the right direction, along with trial and error from the documentation:
  This returns all related phone records for the given contact_id:
  entity=Contact&action=get&contact_id=1234&api.Phone.get[values]
  
  And you can filter the chained API call too, for example all related phone records with a phone_type_id of 2:
  entity=Contact&action=get&contact_id=1234&api.Phone.get[phone_type_id]=2
  
  
  ---
  
  ### Answer by username_1 on 2015-04-10. Score: 1
  
  Not 100% sure but I think it's a limitation in the current REST api. If you set the json param, the result is json formatted. 
  Can you try to not set json param by doing :
  entity=Contact&action=get&contact_id=1234&api.Phone.get=1
  
  > **Comments:**
  > **username_0**: That pulls in the contact record in xml format, but not the related phone records.  The issue seems to be how to get the chained api call recognized outside of setting the json parameter.  
  > **username_1**: I think you need a value, by setting api.phone.get=1, it should work. Still, it's far from perfect as you will be limited by this syntax at some point.  
  > **username_0**: Changing it to api.phone.get=1 still didn't pull in related phone records. You're right though, I will be limited by this syntax, and it seems as if I already am!  
  
  ---
  
  