function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sun ShuaiShuaiSun ShuaiShuai 

Rest API execute soql from multiple object that has a relationship

I know how to execute soql to get data from one object.
But I don't know how to execute soql to get data from multiple object that has a relationship like 
select Name,Phone,Website,Type,(Select Name, Title, Email From Contacts) from Account
so can you tell me how to execute the above soql by rest api?
Thank you very much.
 
Nagarjuna ParalaNagarjuna Parala
Hi @Sun ShuaiShuai, FYI
Could you follow this format for your query:
curl https://yourInstance.salesforce.com/services/data/v20.0/query/?q=SELECT+name+from+Account -H "Authorization: Bearer token".
For reference you can also check the following links.
1.https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_query.htm
2. https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_query.htm

Please feel free to let me know if you have any further issues.

Thanks and Regards
Nagarjuna
Khan AnasKhan Anas (Salesforce Developers) 
Hi Sun ShuaiShuai,

Greetings to you!

Please refer to the below link which might help you further with the above requirement.

https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_relationship_traversal.htm

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas