Dynamics crm 在通过 api 获取时删除重复数据
Dynamics crm remove the repeated data while fetching via api
正在尝试检索某个特定国家/地区下的所有州。
URL:
api/data/v9.1/leadaddresses?$select=stateorprovince&$filter=stateorprovince ne null and country eq 'US'&$count=true&$orderby=stateorprovince
问题出在这里returns这样的数据
"value": [
{
"@odata.etag": "W/"166729382"",
"stateorprovince": "AK",
"leadaddressid": "691de670-aa45-426b-8fee-00b3a7f7e469"
},
{
"@odata.etag": "W/"166729369"",
"stateorprovince": "AK",
"leadaddressid": "12db5897-dc53-44ae-b4aa-03c5486ad6ac"
},
{
"@odata.etag": "W/"166729416"",
"stateorprovince": "AK",
"leadaddressid": "f64ccf06-fa67-421a-aa5f-0469302be1c2"
},
{
"@odata.etag": "W/"166729206"",
"stateorprovince": "AK",
"leadaddressid": "b1f9ce4a-a06b-4d7d-befc-04bea0d41a4e"
},
{
"@odata.etag": "W/"166729323"",
"stateorprovince": "AK",
"leadaddressid": "a4b9ff56-2d24-4957-b09b-04ef6ce56304"
},
任何删除重复数据的方法。
您必须使用 fetchxml 来获取不同的值,这是唯一的选择。
<fetch top="50" distinct="true" >
<entity name="leadaddress" >
<attribute name="stateorprovince" />
<filter type="and" >
<condition attribute="stateorprovince" operator="not-null" />
</filter>
</entity>
</fetch>
您可以使用网络 api 端点并使用上面的 fetchxml,如下所示:
https://crmdev.crm.dynamics.com/api/data/v9.1/leadaddresses?fetchXml=<fetch top="50" distinct="true" > <entity name="leadaddress" > <attribute name="stateorprovince" /> <filter type="and" > <condition attribute="stateorprovince" operator="not-null" /> </filter> </entity> </fetch>
正在尝试检索某个特定国家/地区下的所有州。
URL:
api/data/v9.1/leadaddresses?$select=stateorprovince&$filter=stateorprovince ne null and country eq 'US'&$count=true&$orderby=stateorprovince
问题出在这里returns这样的数据
"value": [
{
"@odata.etag": "W/"166729382"",
"stateorprovince": "AK",
"leadaddressid": "691de670-aa45-426b-8fee-00b3a7f7e469"
},
{
"@odata.etag": "W/"166729369"",
"stateorprovince": "AK",
"leadaddressid": "12db5897-dc53-44ae-b4aa-03c5486ad6ac"
},
{
"@odata.etag": "W/"166729416"",
"stateorprovince": "AK",
"leadaddressid": "f64ccf06-fa67-421a-aa5f-0469302be1c2"
},
{
"@odata.etag": "W/"166729206"",
"stateorprovince": "AK",
"leadaddressid": "b1f9ce4a-a06b-4d7d-befc-04bea0d41a4e"
},
{
"@odata.etag": "W/"166729323"",
"stateorprovince": "AK",
"leadaddressid": "a4b9ff56-2d24-4957-b09b-04ef6ce56304"
},
任何删除重复数据的方法。
您必须使用 fetchxml 来获取不同的值,这是唯一的选择。
<fetch top="50" distinct="true" >
<entity name="leadaddress" >
<attribute name="stateorprovince" />
<filter type="and" >
<condition attribute="stateorprovince" operator="not-null" />
</filter>
</entity>
</fetch>
您可以使用网络 api 端点并使用上面的 fetchxml,如下所示:
https://crmdev.crm.dynamics.com/api/data/v9.1/leadaddresses?fetchXml=<fetch top="50" distinct="true" > <entity name="leadaddress" > <attribute name="stateorprovince" /> <filter type="and" > <condition attribute="stateorprovince" operator="not-null" /> </filter> </entity> </fetch>