|
1 | 1 | ---
|
2 | 2 | title: "Query data using the Web API (Microsoft Dataverse)| Microsoft Docs"
|
3 | 3 | description: "Read about the various ways to query Microsoft Dataverse table data using the Web API and the various system query options that can be applied in these queries."
|
4 |
| -ms.date: 04/06/2022 |
| 4 | +ms.date: 04/08/2022 |
5 | 5 | author: divka78
|
6 | 6 | ms.author: dikamath
|
7 | 7 | ms.reviewer: jdaly
|
@@ -698,162 +698,7 @@ Preference-Applied: odata.include-annotations="*"
|
698 | 698 | }
|
699 | 699 | }
|
700 | 700 | ```
|
701 |
| - |
702 |
| -<a name="bkmk_expandRelated"></a> |
703 |
| - |
704 |
| -## Retrieve related tables by expanding navigation properties |
705 |
| - |
706 |
| -<a name="bkmk_retrieverelatedentityexpandcollectionnavprop"></a> |
707 |
| - |
708 |
| -### Retrieve related tables by expanding collection-valued navigation properties |
709 |
| - |
710 |
| -If you expand on collection-valued navigation parameters to retrieve related entities for entity sets, an `@odata.nextLink` property will be returned for the related entities. You should use the value of the `@odata.nextLink` property with a new `GET` request to return the required data. |
711 |
| - |
712 |
| -The following example retrieves the tasks assigned to the top 5 account records. |
713 |
| - |
714 |
| -**Request** |
715 |
| - |
716 |
| -```http |
717 |
| -GET [Organization URI]/api/data/v9.1/accounts?$top=5 |
718 |
| -&$select=name |
719 |
| -&$expand=Account_Tasks($select=subject,scheduledstart) HTTP/1.1 |
720 |
| -Accept: application/json |
721 |
| -OData-MaxVersion: 4.0 |
722 |
| -OData-Version: 4.0 |
723 |
| -``` |
724 |
| - |
725 |
| -**Response** |
726 |
| - |
727 |
| -```http |
728 |
| -HTTP/1.1 200 OK |
729 |
| -Content-Type: application/json; odata.metadata=minimal |
730 |
| -OData-Version: 4.0 |
731 |
| - |
732 |
| -{ |
733 |
| - "@odata.context":"[Organization URI]/api/data/v9.1/$metadata#accounts(name,Account_Tasks,Account_Tasks(subject,scheduledstart))", |
734 |
| - "value":[ |
735 |
| - { |
736 |
| - "@odata.etag":"W/\"513475\"", |
737 |
| - "name":"Fourth Coffee (sample)", |
738 |
| - "accountid":"36dbf27c-8efb-e511-80d2-00155db07c77", |
739 |
| - "Account_Tasks":[ |
740 |
| -
|
741 |
| - ], |
742 |
| - "[email protected]":"[Organization URI]/api/data/v9.1/accounts(36dbf27c-8efb-e511-80d2-00155db07c77)/Account_Tasks?$select=subject,scheduledstart" |
743 |
| - }, |
744 |
| - { |
745 |
| - "@odata.etag":"W/\"513477\"", |
746 |
| - "name":"Litware, Inc. (sample)", |
747 |
| - "accountid":"38dbf27c-8efb-e511-80d2-00155db07c77", |
748 |
| - "Account_Tasks":[ |
749 |
| -
|
750 |
| - ], |
751 |
| - "[email protected]":"[Organization URI]/api/data/v9.1/accounts(38dbf27c-8efb-e511-80d2-00155db07c77)/Account_Tasks?$select=subject,scheduledstart" |
752 |
| - }, |
753 |
| - { |
754 |
| - "@odata.etag":"W/\"514074\"", |
755 |
| - "name":"Adventure Works (sample)", |
756 |
| - "accountid":"3adbf27c-8efb-e511-80d2-00155db07c77", |
757 |
| - "Account_Tasks":[ |
758 |
| -
|
759 |
| - ], |
760 |
| - "[email protected]":"[Organization URI]/api/data/v9.1/accounts(3adbf27c-8efb-e511-80d2-00155db07c77)/Account_Tasks?$select=subject,scheduledstart" |
761 |
| - }, |
762 |
| - { |
763 |
| - "@odata.etag":"W/\"513481\"", |
764 |
| - "name":"Fabrikam, Inc. (sample)", |
765 |
| - "accountid":"3cdbf27c-8efb-e511-80d2-00155db07c77", |
766 |
| - "Account_Tasks":[ |
767 |
| -
|
768 |
| - ], |
769 |
| - "[email protected]":"[Organization URI]/api/data/v9.1/accounts(3cdbf27c-8efb-e511-80d2-00155db07c77)/Account_Tasks?$select=subject,scheduledstart" |
770 |
| - }, |
771 |
| - { |
772 |
| - "@odata.etag":"W/\"514057\"", |
773 |
| - "name":"Blue Yonder Airlines (sample)", |
774 |
| - "accountid":"3edbf27c-8efb-e511-80d2-00155db07c77", |
775 |
| - "Account_Tasks":[ |
776 |
| -
|
777 |
| - ], |
778 |
| - "[email protected]":"[Organization URI]/api/data/v9.1/accounts(3edbf27c-8efb-e511-80d2-00155db07c77)/Account_Tasks?$select=subject,scheduledstart" |
779 |
| - } |
780 |
| - ] |
781 |
| - } |
782 |
| - |
783 |
| -``` |
784 |
| - |
785 |
| -<a name="bkmk_retrieverelatedentitysingleandcollectionnavprop"></a> |
786 |
| - |
787 |
| -### Retrieve related rows (records) by expanding both single-valued and collection-valued navigation properties |
788 |
| - |
789 |
| -The following example demonstrates how you can expand related rows (records) for entity sets using both single and collection-valued navigation properties. As explained earlier, expanding on collection-valued navigation properties to retrieve related entities for entity sets returns an `@odata.nextLink` property for the related entities. You should use the value of the `@odata.nextLink` property with a new `GET` request to return the required data. |
790 |
| - |
791 |
| -In this example, we are retrieving the contact and tasks assigned to the top 3 accounts. |
792 |
| - |
793 |
| -**Request** |
794 | 701 |
|
795 |
| -```http |
796 |
| -GET [Organization URI]/api/data/v9.1/accounts?$top=3 |
797 |
| -&$select=name |
798 |
| -&$expand=primarycontactid($select=contactid,fullname),Account_Tasks($select=subject,scheduledstart) HTTP/1.1 |
799 |
| -Accept: application/json |
800 |
| -OData-MaxVersion: 4.0 |
801 |
| -OData-Version: 4.0 |
802 |
| -``` |
803 |
| - |
804 |
| -**Response** |
805 |
| - |
806 |
| -```http |
807 |
| -HTTP/1.1 200 OK |
808 |
| -Content-Type: application/json; odata.metadata=minimal |
809 |
| -OData-Version: 4.0 |
810 |
| - |
811 |
| -{ |
812 |
| - "@odata.context":"[Organization URI]/api/data/v9.1/$metadata#accounts(name,primarycontactid,Account_Tasks,primarycontactid(contactid,fullname),Account_Tasks(subject,scheduledstart))", |
813 |
| - "value":[ |
814 |
| - { |
815 |
| - "@odata.etag":"W/\"550614\"", |
816 |
| - "name":"Fourth Coffee (sample)", |
817 |
| - "accountid":"5b9648c3-68f7-e511-80d3-00155db53318", |
818 |
| - "primarycontactid":{ |
819 |
| - "contactid":"c19648c3-68f7-e511-80d3-00155db53318", |
820 |
| - "fullname":"Yvonne McKay (sample)" |
821 |
| - }, |
822 |
| - "Account_Tasks":[ |
823 |
| -
|
824 |
| - ], |
825 |
| - "[email protected]":"[Organization URI]/api/data/v9.1/accounts(5b9648c3-68f7-e511-80d3-00155db53318)/Account_Tasks?$select=subject,scheduledstart" |
826 |
| - }, |
827 |
| - { |
828 |
| - "@odata.etag":"W/\"550615\"", |
829 |
| - "name":"Litware, Inc. (sample)", |
830 |
| - "accountid":"5d9648c3-68f7-e511-80d3-00155db53318", |
831 |
| - "primarycontactid":{ |
832 |
| - "contactid":"c39648c3-68f7-e511-80d3-00155db53318", |
833 |
| - "fullname":"Susanna Stubberod (sample)" |
834 |
| - }, |
835 |
| - "Account_Tasks":[ |
836 |
| -
|
837 |
| - ], |
838 |
| - "[email protected]":"[Organization URI]/api/data/v9.1/accounts(5d9648c3-68f7-e511-80d3-00155db53318)/Account_Tasks?$select=subject,scheduledstart" |
839 |
| - }, |
840 |
| - { |
841 |
| - "@odata.etag":"W/\"550616\"", |
842 |
| - "name":"Adventure Works (sample)", |
843 |
| - "accountid":"5f9648c3-68f7-e511-80d3-00155db53318", |
844 |
| - "primarycontactid":{ |
845 |
| - "contactid":"c59648c3-68f7-e511-80d3-00155db53318", |
846 |
| - "fullname":"Nancy Anderson (sample)" |
847 |
| - }, |
848 |
| - "Account_Tasks":[ |
849 |
| -
|
850 |
| - ], |
851 |
| - "[email protected]":"[Organization URI]/api/data/v9.1/accounts(5f9648c3-68f7-e511-80d3-00155db53318)/Account_Tasks?$select=subject,scheduledstart" |
852 |
| - } |
853 |
| - ] |
854 |
| -} |
855 |
| - |
856 |
| -``` |
857 | 702 | <a name="BKMK_changetracking"></a>
|
858 | 703 |
|
859 | 704 | ## Use change tracking to synchronize data with external systems
|
|
0 commit comments