Docs / SynthEvents / Errors / body-malformed
body-malformed
The body of the request is not a JSON object of the expected shape.
- Status:
400 Bad Request - Routes:
POST /api/v1/generate-events,QUERY /api/v1/read-data-set,QUERY /api/v1/read-domains - Description:
- for
generate-events:body is malformed: expected a JSON object with domain, scenario, range, eventCount, seed, and format - for
read-data-set:body is malformed: expected a JSON object with name and format - for
read-domains:body is malformed: expected an empty JSON object
- for
- Details: Empty, or
field, the field to blame, by its path from the root of the body, such aseventTypePrefixorrange.until.
Why It Happens#
- The body is not JSON, or not a single JSON object, such as an array,
null, or two objects in a row. - The body has a field that SynthEvents does not know. Field names are case-sensitive, so
eventcountis unknown. A request names no event type prefix, soeventTypePrefixis unknown, too. If there are several unknown fields,fieldnames one of them. - A value has the wrong type, such as
eventCountgiven as the string"5000"rather than as a number, orrangegiven as a string rather than as an object.fieldnames it. - For
read-data-set, the body has a field other thannameandformat, such asseed: a ready-made data set has its seed already. - For
read-domains, the body has any field at all. It has to be exactly{}.
How to Fix It#
For generate-events, send a single JSON object with exactly the fields domain, scenario, range with from and to, eventCount, seed, and format, each of them with a value of its type (see API). For read-data-set, send a JSON object with exactly the fields name and format, both strings (see API). For read-domains, send {}.
Example#
For a request to generate-events with the field eventTypePrefix, SynthEvents answers:
{
"type": "error",
"data": {
"code": "https://docs.synthevents.io/errors/body-malformed",
"description": "body is malformed: expected a JSON object with domain, scenario, range, eventCount, seed, and format",
"details": {
"field": "eventTypePrefix"
}
}
}