Skip to content

Commit 1a4f39f

Browse files
committed
retrieve raw property value
1 parent 79f019d commit 1a4f39f

File tree

1 file changed

+50
-26
lines changed

1 file changed

+50
-26
lines changed

powerapps-docs/developer/data-platform/webapi/retrieve-entity-using-web-api.md

Lines changed: 50 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
---
22
title: "Retrieve a table row using the Web API (Microsoft Dataverse)| Microsoft Docs"
33
description: "Read how to form a GET request using the Microsoft Dataverse Web API to retrieve table data specified as the resource with a unique identifier"
4-
ms.date: 09/29/2022
4+
ms.date: 01/29/2023
55
author: divkamath
66
ms.author: dikamath
77
ms.reviewer: jdaly
8-
manager: sunilg
98
search.audienceType:
109
- developer
1110
search.app:
@@ -31,7 +30,7 @@ Use a `GET` request to retrieve data for a record specified as the resource with
3130
This example returns data for an account entity record with the primary key value equal to 00000000-0000-0000-0000-000000000001.
3231

3332
```http
34-
GET [Organization URI]/api/data/v9.0/accounts(00000000-0000-0000-0000-000000000001)
33+
GET [Organization URI]/api/data/v9.2/accounts(00000000-0000-0000-0000-000000000001)
3534
```
3635

3736
To retrieve more than one entity record at a time, see [Basic query example](query-data-web-api.md#bkmk_basicQuery) in the [Query Data using the Web API](query-data-web-api.md) topic.
@@ -51,7 +50,7 @@ The following example retrieves `name` and `revenue` properties for the account
5150

5251
**Request**
5352
```http
54-
GET [Organization URI]/api/data/v9.0/accounts(00000000-0000-0000-0000-000000000001)?$select=name,revenue HTTP/1.1
53+
GET [Organization URI]/api/data/v9.2/accounts(00000000-0000-0000-0000-000000000001)?$select=name,revenue HTTP/1.1
5554
Accept: application/json
5655
Content-Type: application/json; charset=utf-8
5756
OData-MaxVersion: 4.0
@@ -65,7 +64,7 @@ Content-Type: application/json; odata.metadata=minimal
6564
OData-Version: 4.0
6665
6766
{
68-
"@odata.context": "[Organization URI]/api/data/v9.0/$metadata#accounts(name,revenue)/$entity",
67+
"@odata.context": "[Organization URI]/api/data/v9.2/$metadata#accounts(name,revenue)/$entity",
6968
"@odata.etag": "W/\"502186\"",
7069
"name": "A. Datum Corporation (sample)",
7170
"revenue": 10000,
@@ -88,13 +87,13 @@ If you request a property that is part of a composite attribute for an address,
8887
If an entity has an alternate key defined, you can also use the alternate key to retrieve the entity instead of the unique identifier for the entity. For example, if the `Contact` entity has an alternate key definition that includes both the `firstname` and `emailaddress1` properties, you can retrieve the contact using a query with data provided for those keys as shown here.
8988

9089
```http
91-
GET [Organization URI]/api/data/v9.0/contacts(firstname='Joe',emailaddress1='[email protected]')
90+
GET [Organization URI]/api/data/v9.2/contacts(firstname='Joe',emailaddress1='[email protected]')
9291
```
9392

9493
If the alternate key definition contains lookup type field (for example, the `primarycontactid` property for the `account` entity), you can retrieve the `account` using the [Lookup properties](web-api-properties.md#lookup-properties) as shown here.
9594

9695
```http
97-
GET [Organization URI]/api/data/v9.0/accounts(_primarycontactid_value=00000000-0000-0000-0000-000000000001)
96+
GET [Organization URI]/api/data/v9.2/accounts(_primarycontactid_value=00000000-0000-0000-0000-000000000001)
9897
```
9998

10099
Any time you need to uniquely identify an entity to retrieve, update, or delete, you can use alternate keys configured for the entity. By default, there are no alternate keys configured for entities. Alternate keys will only be available if the organization or a solution adds them.
@@ -116,7 +115,7 @@ This example returns only the value of the `name` property for an `account` enti
116115
**Request**
117116

118117
```http
119-
GET [Organization URI]/api/data/v9.0/accounts(00000000-0000-0000-0000-000000000001)/name HTTP/1.1
118+
GET [Organization URI]/api/data/v9.2/accounts(00000000-0000-0000-0000-000000000001)/name HTTP/1.1
120119
Accept: application/json
121120
OData-MaxVersion: 4.0
122121
OData-Version: 4.0
@@ -129,11 +128,36 @@ Content-Type: application/json; odata.metadata=minimal
129128
OData-Version: 4.0
130129
131130
{
132-
"@odata.context":"[Organization URI]/api/data/v9.0/$metadata#accounts(00000000-0000-0000-0000-000000000001)/name",
131+
"@odata.context":"[Organization URI]/api/data/v9.2/$metadata#accounts(00000000-0000-0000-0000-000000000001)/name",
133132
"value":"Adventure Works (sample)"
134133
}
135134
```
136135

136+
### Retrieve the raw value of a property
137+
138+
To retrieve the raw value of a primitive property rather than JSON, append `/$value` to the url.
139+
140+
**Request**
141+
142+
```http
143+
GET [Organization URI]/api/data/v9.2/accounts(00000000-0000-0000-0000-000000000001)/name/$value HTTP/1.1
144+
Accept: application/json
145+
OData-MaxVersion: 4.0
146+
OData-Version: 4.0
147+
```
148+
**Response**
149+
150+
```http
151+
HTTP/1.1 200 OK
152+
Content-Type: text/plain
153+
OData-Version: 4.0
154+
155+
Adventure Works (sample)
156+
```
157+
158+
> [!NOTE]
159+
> Using the raw value is not common unless you are working with file or image data. More information: [Download a file in a single request using Web API](../file-column-data.md#download-a-file-in-a-single-request-using-web-api).
160+
137161
<a name="bkmk_retrieveNavigationPropertyValues"></a>
138162

139163
## Retrieve navigation property values
@@ -145,7 +169,7 @@ The following example returns the `fullname` of the primary `contact` of an `acc
145169
**Request**
146170

147171
```http
148-
GET [Organization URI]/api/data/v9.0/accounts(00000000-0000-0000-0000-000000000001)/primarycontactid?$select=fullname HTTP/1.1
172+
GET [Organization URI]/api/data/v9.2/accounts(00000000-0000-0000-0000-000000000001)/primarycontactid?$select=fullname HTTP/1.1
149173
Accept: application/json
150174
OData-MaxVersion: 4.0
151175
OData-Version: 4.0
@@ -158,7 +182,7 @@ Content-Type: application/json; odata.metadata=minimal
158182
OData-Version: 4.0
159183
160184
{
161-
"@odata.context": "[Organization URI]/api/data/v9.0/$metadata#contacts(fullname)/$entity",
185+
"@odata.context": "[Organization URI]/api/data/v9.2/$metadata#contacts(fullname)/$entity",
162186
"@odata.etag": "W/\"500128\"",
163187
"fullname": "Rene Valdes (sample)",
164188
"contactid": "ff390c24-9c72-e511-80d4-00155d2a68d1"
@@ -172,7 +196,7 @@ The following example will just return references to tasks related to a specific
172196
**Request**
173197

174198
```http
175-
GET [Organization URI]/api/data/v9.0/accounts(00000000-0000-0000-0000-000000000001)/AccountTasks/$ref HTTP/1.1
199+
GET [Organization URI]/api/data/v9.2/accounts(00000000-0000-0000-0000-000000000001)/AccountTasks/$ref HTTP/1.1
176200
Accept: application/json
177201
OData-MaxVersion: 4.0
178202
OData-Version: 4.0
@@ -186,11 +210,11 @@ Content-Type: application/json; odata.metadata=minimal
186210
OData-Version: 4.0
187211
188212
{
189-
"@odata.context": "[Organization URI]/api/data/v9.0/$metadata#Collection($ref)",
213+
"@odata.context": "[Organization URI]/api/data/v9.2/$metadata#Collection($ref)",
190214
"value":
191215
[
192-
{ "@odata.id": "[Organization URI]/api/data/v9.0/tasks(6b5941dd-d175-e511-80d4-00155d2a68d1)" },
193-
{ "@odata.id": "[Organization URI]/api/data/v9.0/tasks(fcbb60ed-d175-e511-80d4-00155d2a68d1)" }
216+
{ "@odata.id": "[Organization URI]/api/data/v9.2/tasks(6b5941dd-d175-e511-80d4-00155d2a68d1)" },
217+
{ "@odata.id": "[Organization URI]/api/data/v9.2/tasks(fcbb60ed-d175-e511-80d4-00155d2a68d1)" }
194218
]
195219
}
196220
```
@@ -200,7 +224,7 @@ The following example returns the number of tasks related to a specific account
200224
**Request**
201225

202226
```http
203-
GET [Organization URI]/api/data/v9.0/accounts(00000000-0000-0000-0000-000000000001)/Account_Tasks/$count HTTP/1.1
227+
GET [Organization URI]/api/data/v9.2/accounts(00000000-0000-0000-0000-000000000001)/Account_Tasks/$count HTTP/1.1
204228
Accept: application/json
205229
OData-MaxVersion: 4.0
206230
OData-Version: 4.0
@@ -237,7 +261,7 @@ The following example demonstrates how to retrieve the contact for an account en
237261
**Request**
238262

239263
```http
240-
GET [Organization URI]/api/data/v9.0/accounts(00000000-0000-0000-0000-000000000001)?$select=name&$expand=primarycontactid($select=contactid,fullname) HTTP/1.1
264+
GET [Organization URI]/api/data/v9.2/accounts(00000000-0000-0000-0000-000000000001)?$select=name&$expand=primarycontactid($select=contactid,fullname) HTTP/1.1
241265
Accept: application/json
242266
OData-MaxVersion: 4.0
243267
OData-Version: 4.0
@@ -251,7 +275,7 @@ Content-Type: application/json; odata.metadata=minimal
251275
OData-Version: 4.0
252276
253277
{
254-
"@odata.context":"[Organization URI]/api/data/v9.0/$metadata#accounts(name,primarycontactid,primarycontactid(contactid,fullname))/$entity",
278+
"@odata.context":"[Organization URI]/api/data/v9.2/$metadata#accounts(name,primarycontactid,primarycontactid(contactid,fullname))/$entity",
255279
"@odata.etag":"W/\"550616\"",
256280
"name":"Adventure Works (sample)",
257281
"accountid":"00000000-0000-0000-0000-000000000001",
@@ -269,7 +293,7 @@ Instead of returning the related entities for entity records, you can also retur
269293
**Request**
270294

271295
```http
272-
GET [Organization URI]/api/data/v9.0/accounts(00000000-0000-0000-0000-000000000001)?$select=name&$expand=primarycontactid/$ref HTTP/1.1
296+
GET [Organization URI]/api/data/v9.2/accounts(00000000-0000-0000-0000-000000000001)?$select=name&$expand=primarycontactid/$ref HTTP/1.1
273297
Accept: application/json
274298
OData-MaxVersion: 4.0
275299
OData-Version: 4.0
@@ -283,12 +307,12 @@ Content-Type: application/json; odata.metadata=minimal
283307
OData-Version: 4.0
284308
285309
{
286-
"@odata.context":"[Organization URI]/api/data/v9.0/$metadata#accounts(name,primarycontactid)/$entity",
310+
"@odata.context":"[Organization URI]/api/data/v9.2/$metadata#accounts(name,primarycontactid)/$entity",
287311
"@odata.etag":"W/\"550616\"",
288312
"name":"Adventure Works (sample)",
289313
"accountid":"00000000-0000-0000-0000-000000000001",
290314
"_primarycontactid_value":"c59648c3-68f7-e511-80d3-00155db53318",
291-
"primarycontactid": { "@odata.id":"[Organization URI]/api/data/v9.0/contacts(c59648c3-68f7-e511-80d3-00155db53318)" }
315+
"primarycontactid": { "@odata.id":"[Organization URI]/api/data/v9.2/contacts(c59648c3-68f7-e511-80d3-00155db53318)" }
292316
}
293317
```
294318

@@ -299,7 +323,7 @@ The following example demonstrates how you can retrieve all the tasks assigned t
299323
**Request**
300324

301325
```http
302-
GET [Organization URI]/api/data/v9.0/accounts(915e89f5-29fc-e511-80d2-00155db07c77)?$select=name
326+
GET [Organization URI]/api/data/v9.2/accounts(915e89f5-29fc-e511-80d2-00155db07c77)?$select=name
303327
&$expand=Account_Tasks($select=subject,scheduledstart)
304328
Accept: application/json
305329
OData-MaxVersion: 4.0
@@ -314,7 +338,7 @@ Content-Type: application/json; odata.metadata=minimal
314338
OData-Version: 4.0
315339
316340
{
317-
"@odata.context": "[Organization URI]/api/data/v9.0/$metadata#accounts(name,Account_Tasks,Account_Tasks(subject,scheduledstart))/$entity",
341+
"@odata.context": "[Organization URI]/api/data/v9.2/$metadata#accounts(name,Account_Tasks,Account_Tasks(subject,scheduledstart))/$entity",
318342
"@odata.etag": "W/\"514069\"",
319343
"name": "Sample Child Account 1",
320344
"accountid": "915e89f5-29fc-e511-80d2-00155db07c77",
@@ -340,7 +364,7 @@ OData-Version: 4.0
340364
> Paging is not available for rows returned using `$expand` on collection-valued navigation properties. The maximum number of records returned is 5000. If you need paging, alter your query to return the collection you are expanding. For example, with the example above you could use the following URL with paging:
341365
>
342366
> ```http
343-
> GET [Organization URI]/api/data/v9.0/accounts(915e89f5-29fc-e511-80d2-00155db07c77)/Account_Tasks?$select=subject,scheduledstart
367+
> GET [Organization URI]/api/data/v9.2/accounts(915e89f5-29fc-e511-80d2-00155db07c77)/Account_Tasks?$select=subject,scheduledstart
344368
> ```
345369
>
346370
> If you use nested `$expand` on collection-valued navigation properties, only the first level of data will be returned. Data for the second level will return an empty array. For example the following query:
@@ -386,7 +410,7 @@ The following example demonstrates how you can expand related entities for an en
386410
**Request**
387411
388412
```http
389-
GET [Organization URI]/api/data/v9.0/accounts(99390c24-9c72-e511-80d4-00155d2a68d1)?$select=accountid
413+
GET [Organization URI]/api/data/v9.2/accounts(99390c24-9c72-e511-80d4-00155d2a68d1)?$select=accountid
390414
&$expand=parentaccountid($select%20=%20createdon,%20name),Account_Tasks($select%20=%20subject,%20scheduledstart) HTTP/1.1
391415
Accept: application/json
392416
OData-MaxVersion: 4.0
@@ -401,7 +425,7 @@ Content-Type: application/json; odata.metadata=minimal
401425
OData-Version: 4.0
402426
403427
{
404-
"@odata.context": "[Organization URI]/api/data/v9.0/$metadata#accounts(accountid,parentaccountid,Account_Tasks,parentaccountid(createdon,name),Account_Tasks(subject,scheduledstart))/$entity",
428+
"@odata.context": "[Organization URI]/api/data/v9.2/$metadata#accounts(accountid,parentaccountid,Account_Tasks,parentaccountid(createdon,name),Account_Tasks(subject,scheduledstart))/$entity",
405429
"@odata.etag": "W/\"514069\"",
406430
"accountid": "915e89f5-29fc-e511-80d2-00155db07c77",
407431
"parentaccountid":

0 commit comments

Comments
 (0)