From 3a788c4d13d5e98c2e973fb6ea5b648510cb1dac Mon Sep 17 00:00:00 2001 From: terence1988 Date: Thu, 22 Aug 2024 08:05:22 +1000 Subject: [PATCH 1/2] remove duplicate content from http api source page --- .../sources/catalog/libraries/server/http-api/index.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/connections/sources/catalog/libraries/server/http-api/index.md b/src/connections/sources/catalog/libraries/server/http-api/index.md index c3c04e4aac..5baca0fb4d 100644 --- a/src/connections/sources/catalog/libraries/server/http-api/index.md +++ b/src/connections/sources/catalog/libraries/server/http-api/index.md @@ -481,5 +481,3 @@ When sending a HTTP call from a user's device, you can collect the IP address by 1. Double check that you've set up the library correctly. 2. Make sure that you're calling a Segment API method after the library is successfully installed—[Identify](#identify), [Track](#track), and so on. - -{% include content/server-side-troubleshooting.md %} From 48ab8745355b4b87c5dd9f27946059057b7ca877 Mon Sep 17 00:00:00 2001 From: stayseesong Date: Thu, 22 Aug 2024 11:09:11 -0700 Subject: [PATCH 2/2] edits --- .../libraries/server/http-api/index.md | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/connections/sources/catalog/libraries/server/http-api/index.md b/src/connections/sources/catalog/libraries/server/http-api/index.md index 5baca0fb4d..fa6cca8ceb 100644 --- a/src/connections/sources/catalog/libraries/server/http-api/index.md +++ b/src/connections/sources/catalog/libraries/server/http-api/index.md @@ -74,19 +74,6 @@ You can reuse the access token until the expiry period specified on the OAuth ap To send data to Segment's HTTP API, a content-type header must be set to `'application/json'`. -## Errors - -Segment returns a `200` response for all API requests except errors caused by large payloads and JSON errors (which return `400` responses.) To debug events that return `200` responses but aren't accepted by Segment, use the Segment Debugger. - -Common reasons events are not accepted by Segment include: - - **Payload is too large:** The HTTP API can handle API requests that are 32KB or smaller. The batch API endpoint accepts a maximum of 500KB per request, with a limit of 32KB per event in the batch. If these limits are exceeded, Segment returns a 400 Bad Request error. - - **Identifier is not present**: The HTTP API requires that each payload has a userId and/or anonymousId. - - **Track event is missing name**: All Track events sent to Segment must have an `event` field. - - **Deduplication**: Segment deduplicates events using the `messageId` field, which is automatically added to all payloads coming into Segment. If you're setting up the HTTP API yourself, ensure all events have unique messageId values with fewer than 100 characters. - - **Invalid JSON**: If you send an event with invalid JSON, Segment returns a 400 Bad Request error. - -Segment welcomes feedback on API responses and error messages. [Reach out to support](https://segment.com/help/contact/){:target="_blank"} with any requests or suggestions you may have. - ## Rate limits For each workspace, Segment recommends you to not exceed 1,000 requests per second with the HTTP API. If you exceed this, Segment reserves the right to queue any additional events and process those at a rate that doesn't exceed the limit. Requests that exceed acceptable limits may be rejected with HTTP Status Code 429. When Segment rejects the requests, the response header contains `Retry-After` and `X-RateLimit-Reset` headers, which contains the number of seconds after which you can retry the request. @@ -470,11 +457,23 @@ Destination flags are **case sensitive** and match [the destination's name in th When sending a HTTP call from a user's device, you can collect the IP address by setting `context.direct` to `true`. -## Troubleshooting +## Errors + +Segment returns a `200` response for all API requests except errors caused by large payloads and JSON errors (which return `400` responses.) To debug events that return `200` responses but aren't accepted by Segment, use the Segment Debugger. + +Common reasons events are not accepted by Segment include: + - **Payload is too large:** The HTTP API can handle API requests that are 32KB or smaller. The batch API endpoint accepts a maximum of 500KB per request, with a limit of 32KB per event in the batch. If these limits are exceeded, Segment returns a 400 Bad Request error. + - **Identifier is not present**: The HTTP API requires that each payload has a userId and/or anonymousId. If you send events without either the userId or anonymousId, Segment’s tracking API responds with an no_user_anon_id error. Check the event payload and client instrumentation for more details. + - **Track event is missing name**: All Track events sent to Segment must have an `event` field. + - **Deduplication**: Segment deduplicates events using the `messageId` field, which is automatically added to all payloads coming into Segment. If you're setting up the HTTP API yourself, ensure all events have unique messageId values with fewer than 100 characters. + - **Invalid JSON**: If you send an event with invalid JSON, Segment returns a 400 Bad Request error. + - **Incorrect credentials**: Double check your credentials for your downstream destinations. + - **Destination incompatibility**: Make sure that the destination you are troubleshooting can accept server-side API calls. You can see compatibility information on the [Destination comparison by category](/docs/connections/destinations/category-compare/) page and in the documentation for your specific destination. + - **Destination-specific requirements**: Check the documentation specific to the destination to see if there are other requirements for using the method and destination that you're trying to get working. -{% include content/troubleshooting-intro.md %} +Segment welcomes feedback on API responses and error messages. [Reach out to support](https://segment.com/help/contact/){:target="_blank"} with any requests or suggestions you may have. - +## Troubleshooting ### No events in my debugger