{"error":"invalid_request_body","message":"The request body is not a valid JSON object.","code":"400"}
This is popping up randomly when pushing custom metrics from a Data Action to our DogStatsD collector. The payload looks clean in the logs, but the API just rejects it every few hundred calls. Is it a character encoding issue? Probably!! The data is coming from a variety of sources and some might have weird trailing spaces.
Option A: Sanitize the strings in the Architect flow before the Data Action. It’s a safe bet but adds a ton of overhead to every flow. Option B: Update the Data Action configuration to strictly cast the input variables. This would be cleaner but it’s a pain to republish across fifty different actions.
Is the PAYLOAD_SIZE increasing during these spikes? If the JSON object is too large, it can increase EXECUTION TIME and cause the API to fail. Check if the memory overhead on the Data Action side is hitting a limit before the POST to /api/v2/employeeperformance/externalmetrics/data completes.
the “invalid_request_body” error is just… wonderful. the API is basically guessing what’s wrong. it’s almost always a hidden character or a null value sneaking into the JSON body of the POST to /api/v2/employeeperformance/externalmetrics/data.
try wrapping the variable in a JSON_STRING or using a DATA_ACTION to explicitly cast the fields. if you’ve got any weird symbols in those custom metrics, the API just gives up lol.