You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: support/power-platform/dataverse/dataverse-web-api-and-sdk/web-api-client-errors.md
+55-13Lines changed: 55 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Troubleshoot Web API client errors
3
3
description: Provides resolutions for the common client errors that occur when you use the Dataverse Web API.
4
-
ms.date: 06/12/2024
4
+
ms.date: 01/24/2024
5
5
ms.custom: sap:Dataverse Web API and SDK\Odata endpoint errors
6
6
author: divkamath
7
7
ms.author: dikamath
@@ -45,13 +45,13 @@ HTTP/1.1 404 Not Found
45
45
46
46
### Cause
47
47
48
-
This error occurs when you use the incorrect name for a resource. That resource might be the name of an entity set, a function or an action. These resource names are case sensitive. In the preceding example, there is an entity set called `accounts`, but not one named `Account`.
48
+
This error occurs when you use the incorrect name for a resource. That resource might be the name of an entity set, a function, or an action. These resource names are case sensitive. In the preceding example, there's an entity set called `accounts`, but not one named `Account`.
49
49
50
50
If the resource is an action defined as a [custom process action](/power-apps/developer/data-platform/workflow-custom-actions), this error can also happen if the custom process action is inactive.
51
51
52
52
### How to avoid
53
53
54
-
- If the resource is an entity type, query the Web API [Service document](/power-apps/developer/data-platform/webapi/web-api-service-documents#service-document) which will provide a list of all the known entity set names.
54
+
- If the resource is an entity type, query the Web API [Service document](/power-apps/developer/data-platform/webapi/web-api-service-documents#service-document) which provides a list of all the known entity set names.
55
55
- If the resource is a function or action, verify that the name you use exists in the [CSDL $metadata document](/power-apps/developer/data-platform/webapi/web-api-service-documents#csdl-metadata-document).
56
56
- If the action doesn't exist in the [CSDL $metadata document](/power-apps/developer/data-platform/webapi/web-api-service-documents#csdl-metadata-document), it might be an inactive [custom process action](/power-apps/developer/data-platform/workflow-custom-actions). You should verify that it's active.
57
57
@@ -82,7 +82,7 @@ HTTP/1.1 400 Bad Request
82
82
83
83
This error occurs when you use the incorrect name for a property. Property names are case sensitive.
84
84
85
-
In the preceding example, there is a property called `name`, but not one named `Name`.
85
+
In the preceding example, there's a property called `name`, but not one named `Name`.
86
86
87
87
### How to avoid
88
88
@@ -113,11 +113,11 @@ HTTP/1.1 404 Not Found
113
113
114
114
### Cause
115
115
116
-
This error occurs when the incorrect HTTP method is applied to a function or action. In this case, <xref:Microsoft.Dynamics.CRM.WhoAmI?text=WhoAmI Function> requires the use of `GET` but `POST`was used.
116
+
This error occurs when the incorrect HTTP method is applied to a function or action. In this case, the [WhoAmI function](xref:Microsoft.Dynamics.CRM.WhoAmI)requires the use of `GET` but `POST`is used.
117
117
118
118
### How to avoid
119
119
120
-
Be aware of what kind of OData operation you are using and the correct HTTP method to use. For more information, see:
120
+
Be aware of what kind of OData operation you're using and the correct HTTP method to use. For more information, see:
121
121
122
122
-[Web API Actions](/power-apps/developer/data-platform/webapi/web-api-actions)
123
123
-[Use Web API actions](/power-apps/developer/data-platform/webapi/use-web-api-actions)
@@ -177,7 +177,7 @@ This error occurs when an invalid navigation property name is sent with a reques
177
177
**Request**
178
178
179
179
```http
180
-
POST [Organization URI]/api/data/v9.0/contacts HTTP/1.1
180
+
POST [Organization URI]/api/data/v9.2/contacts HTTP/1.1
181
181
182
182
{
183
183
"firstname":"test",
@@ -205,9 +205,9 @@ HTTP/1.1 400 Bad Request
205
205
206
206
#### Cause
207
207
208
-
This error occurs because there is no single-valued navigation property in the contact entity type named `parentcustomerid`. For more information, see [contact EntityType > Single-valued navigation properties](/power-apps/developer/data-platform/webapi/reference/contact#single-valued-navigation-properties).
208
+
This error occurs because there's no single-valued navigation property in the contact entity type named `parentcustomerid`. For more information, see [Single-valued navigation properties](/power-apps/developer/data-platform/webapi/reference/contact#single-valued-navigation-properties).
209
209
210
-
`parentcustomerid` is the logical name of a lookup column in the contact table. All lookups are represented by single-valued navigation properties in OData. The names of the lookup properties don't always match the corresponding single-valued navigation property name.
210
+
`parentcustomerid` is the logical name of a lookup column in the contact table. All lookups have one or more single-valued navigation properties in OData. The names of the lookup properties don't always match the corresponding single-valued navigation property name.
211
211
212
212
In this case, the `parentcustomerid` column is a customer lookup type, a kind of [multi-table lookup](/power-apps/developer/data-platform/webapi/web-api-navigation-properties#multi-table-lookups) that might link to either the account or contact tables. To support this customer lookup, there are two separate relationships and each has a different single-valued navigation property. The correct single-valued navigation property in this case is `parentcustomerid_account`.
213
213
@@ -253,15 +253,15 @@ at System.Web.OData.Formatter.ODataMediaTypeFormatter.ReadFromStream(Type type,
253
253
254
254
#### Cause
255
255
256
-
This deserialization error is caused by the use of line endings other than [CRLF](https://developer.mozilla.org/docs/Glossary/CRLF) in the batch request body.
256
+
The use of line endings other than [CRLF](https://developer.mozilla.org/docs/Glossary/CRLF) in the batch request body causes this deserialization error.
257
257
258
-
Depending on the editor you use, these non-printing characters can be difficult to see. If you use [Notepad++](https://notepad-plus-plus.org/), you can use the **Show all characters** option to make these characters visible.
258
+
Depending on the editor you use, these nonprinting characters can be difficult to see. If you use [Notepad++](https://notepad-plus-plus.org/), you can use the **Show all characters** option to make these characters visible.
259
259
260
-
This payload will work:
260
+
This payload works:
261
261
262
262
:::image type="content" source="media/web-api-client-errors/batch-request-body-with-crlf-endings-for-all-lines.png" alt-text="Screenshot that shows a batch request body with CRLF endings for all lines.":::
263
263
264
-
This payload will fail because the last line doesn't end with `CRLF`.
264
+
This payload fails because the last line doesn't end with `CRLF`.
265
265
266
266
:::image type="content" source="media/web-api-client-errors/batch-request-body-with-crlf-missing-last-line.png" alt-text="Screenshot that shows a batch request body with CRLF missing on the last line.":::
267
267
@@ -271,6 +271,48 @@ In this case, just adding a carriage return at the end of the last line is enoug
271
271
272
272
Ensure all line endings in the `$batch` request body are `CRLF`. If you can't use `CRLF`, add two non-`CRLF` line endings at the end of the batch request body to resolve this deserialization error. For more information, see [Batch requests](/power-apps/developer/data-platform/webapi/execute-batch-operations-using-web-api#batch-requests).
273
273
274
+
## Error identified on the 'odata.include-annotations' value inside the 'Prefer' header
275
+
276
+
### Symptoms
277
+
278
+
The error occurs when the [Dataverse Web API](/power-apps/developer/data-platform/webapi/overview) receives a request with an invalid `odata.include-annotations` value in the `Prefer` request header value. This issue occurs when the request is sent using the `POST`, `PATCH`, `PUT`, or `GET` HTTP methods with a `Prefer` request header that contains an invalid or improperly formatted value.
279
+
280
+
In the following example, the `odata.include-annotations` value incorrectly includes backslashes (\\) to escape the quote characters.
281
+
282
+
**Request**
283
+
284
+
```http
285
+
POST [Organization URI]/api/data/v9.2/contacts HTTP/1.1
286
+
287
+
Prefer: odata.include-annotations=\"*\"
288
+
289
+
{
290
+
"firstname":"test",
291
+
"lastname":"contact"
292
+
}
293
+
```
294
+
295
+
**Response**
296
+
297
+
```http
298
+
HTTP/1.1 400 Bad Request
299
+
300
+
{
301
+
"Message": "Error identified on the 'odata.include-annotations' value inside the 'Prefer' header.
302
+
Refer to the following link for more details: https://go.microsoft.com/fwlink/?linkid=2300109.
303
+
See exception message for more details 'An error occurred when parsing the HTTP header 'Prefer'. The header value 'odata.include-annotations=\\\"*\\\"' is incorrect at position '26' because the escape character '\\' is not inside a quoted-string.'.",
304
+
"ErrorCode": "0x80097303"
305
+
}
306
+
```
307
+
308
+
### Cause
309
+
310
+
To provide a more secure service, we fix an issue where invalid `Prefer` request header values are processed without validation when using the `POST`, `PATCH`, or `PUT` HTTP methods. Now, validation is enforced for all HTTP methods. This error occurs starting with Dataverse version 9.2.2412.3 that begins deployment in January 2025 and will be deployed to all regions by February 2025.
311
+
312
+
### How to avoid
313
+
314
+
Review the guidance about how to properly set [Prefer headers in the Dataverse Web API](/power-apps/developer/data-platform/webapi/compose-http-requests-handle-errors#prefer-headers).
315
+
274
316
## See also
275
317
276
318
-[Web API types and operations](/power-apps/developer/data-platform/webapi/web-api-types-operations)
0 commit comments