Response Format¶
All Madevo API endpoints follow a consistent JSON response structure.
Understanding this format helps you correctly handle both successful responses and errors.
Standard response structure¶
All secure endpoints return responses in the following format:
Fields¶
-
error
Indicates whether the request failed or succeeded -
message
Human-readable description of the result -
...endpoint_specific_fields
Additional data specific to the endpoint
Success response¶
Example:
Error response¶
Example:
Common error messages¶
unauthorized - invalid tokeninvalid request bodyinvalid inputforbiddensession expired
Partial success behavior¶
Some endpoints, especially data ingestion, may return an error even when part of the operation succeeded.
Example¶
Important¶
- Some data may still be processed successfully
- Always inspect the
messagefield
Empty responses¶
Some endpoints may return empty results:
Dynamic fields¶
Some response fields vary depending on context:
- Datasource query results
- Metadata fields
- Assistant responses
Example¶
{
"error": false,
"message": "assistant response retrieved",
"response": {
"response": "Temperature increased after 11:55",
"query": "What caused the spike?",
"dbquery": "generated query",
"visualization": "chart.png"
}
}
HTTP status vs API error¶
The API may return HTTP 200 even when:
Important¶
- Always check the
errorfield - Do not rely only on HTTP status codes
Best practices¶
- Check
errorbefore processing response - Log the
messagefor debugging - Handle partial success cases explicitly
- Do not assume fixed schemas for dynamic fields