fix(write-api): Partial writes now return a 400 response code in serverless

This updates some of the other wording around the troubleshooting table
to reflect the product's current state more closely.
pull/5585/head
Fraser Savage 2024-09-02 17:25:05 +01:00
parent e448b6a223
commit 8305b7cde4
No known key found for this signature in database
GPG Key ID: DE47C33CE8C5C446
2 changed files with 15 additions and 23 deletions

View File

@ -7639,27 +7639,14 @@ paths:
- [Best practices for optimizing writes](/influxdb/cloud-serverless/write-data/best-practices/optimize-writes/)
required: true
responses:
'201':
description: |
Success ("Created"). Some points in the batch are written and queryable, and some points are rejected. The response body contains details about the [rejected points](/influxdb/cloud-serverless/write-data/troubleshoot/#troubleshoot-rejected-points), up to 100 points.
content:
application/json:
examples:
partialWriteErrorWithRejectedPoints:
summary: Partial write rejects points with syntax errors
value:
code: invalid
line: 2
message: 'failed to parse line protocol: errors encountered on line(s): error message for first rejected point</n> error message for second rejected point</n> error message for Nth rejected point (up to 100 rejected points)'
schema:
$ref: '#/components/schemas/LineProtocolError'
'204':
description: Success ("No Content"). All data in the batch is written and queryable.
'400':
description: |
All data in the batch was rejected and not written.
Data from the batch was rejected and not written. The response body indicates if a partial write occurred or all data was rejected.
If a partial write occurred then some points from the batch are written and queryable.
The response body contains details about the [rejected points](/influxdb/cloud-serverless/write-data/troubleshoot/#troubleshoot-rejected-points).
The response body contains details about the [rejected points](/influxdb/cloud-serverless/write-data/troubleshoot/#troubleshoot-rejected-points), up to 100 points.
content:
application/json:
examples:
@ -7668,7 +7655,13 @@ paths:
value:
code: invalid
line: 2
message: 'failed to parse line protocol: errors encountered on line(s): error message for first rejected point</n> error message for second rejected point</n> error message for Nth rejected point (up to 100 rejected points)'
message: 'no data written, errors encountered on line(s): error message for first rejected point</n> error message for second rejected point</n> error message for Nth rejected point (up to 100 rejected points)'
partialWriteErrorWithRejectedPoints:
summary: Partial write rejects some points
value:
code: invalid
line: 2
message: 'partial write has occurred, errors encountered on line(s): error message for first rejected point</n> error message for second rejected point</n> error message for Nth rejected point (up to 100 rejected points)'
schema:
$ref: '#/components/schemas/LineProtocolError'
'401':

View File

@ -31,12 +31,12 @@ Learn how to avoid unexpected results and recover from errors when writing to {{
1. Validates the request.
2. If successful, attempts to [ingest data](/influxdb/cloud-serverless/reference/internals/durability/#data-ingest) from the request body; otherwise, responds with an [error status](#review-http-status-codes).
3. Ingests or rejects the entire batch and returns one of the following HTTP status codes:
3. Ingests or rejects data from the batch and returns one of the following HTTP status codes:
- `204 No Content`: some or all of the data is ingested and queryable
- `400 Bad Request`: all data is rejected
- `204 No Content`: all of the data is ingested and queryable
- `400 Bad Request`: some or all of the data has been rejected. data which has not been rejected is ingested and queryable
If points are rejected, the `204` or `400` response body contains error details about [rejected points](#troubleshoot-rejected-points), up to 100 points.
The response body contains error details about [rejected points](#troubleshoot-rejected-points), up to 100 points.
Writes are synchronous--the response status indicates the final status of the write and all ingested data is queryable.
@ -51,9 +51,8 @@ The `message` property of the response body may contain additional details about
| HTTP response code | Response body | Description |
| :-------------------------------| :--------------------------------------------------------------- | :------------- |
| `201 "Created"` | error details about rejected points, up to 100 points, `line` contains the first rejected line, `message` describes rejections | If some of the data is ingested and some of the data is rejected |
| `204 "No Content"` | no response body | If InfluxDB ingested all of the data in the batch |
| `400 "Bad request"` | `line` contains the first malformed line, `message` describes rejected points | If request data isn't allowed (for example, is malformed or falls outside of the bucket's retention period) |
| `400 "Bad request"` | error details about rejected points, up to 100 points: `line` contains the first rejected line, `message` describes rejections | If some or all request data isn't allowed (for example, is malformed or falls outside of the bucket's retention period). The response body indicates if a partial write has occurred or all data has been rejected |
| `401 "Unauthorized"` | | If the `Authorization` header is missing or malformed or if the [token](/influxdb/cloud-serverless/admin/tokens/) doesn't have [permission](/influxdb/cloud-serverless/admin/tokens/create-token/) to write to the bucket. See [examples using credentials](/influxdb/cloud-serverless/get-started/write/#write-line-protocol-to-influxdb) in write requests. |
| `404 "Not found"` | requested **resource type** (for example, "organization" or "bucket"), and **resource name** | If a requested resource (for example, organization or bucket) wasn't found |
| `413 “Request too large”` | cannot read data: points in batch is too large | If a request exceeds the maximum [global limit](/influxdb/cloud-serverless/admin/billing/limits/) |