5

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.

2 Answers 2

3

@samuelsov 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
0
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
3
  • 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.
    – swandog
    Apr 10, 2015 at 15:44
  • 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.
    – samuelsov
    Apr 10, 2015 at 16:42
  • 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!
    – swandog
    Apr 10, 2015 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.