Required Data
When required data fields are missing from the request sent to the API, an error response may be returned indicating which fields were not provided.
In these cases, the API typically returns a status code indicating that validation has failed, along with specific details about the missing fields.
This type of error is identified by the MISSING_FIELD error type.
This helps developers identify and resolve issues related to required data fields effectively.
Handling Errors of the Track Endpoint
The example below explains how to handle errors related to missing required data fields when leveraging the track endpoint of the Reserhub Data Lake API.
Request Body
{ "event_name": "purchase_complete", "event_data": { "passenger_count": 2, "payment_type": "credit_card", "trips_count": 1, "tickets": 2, "total": 31.00, "product": "web", "distinct_id": "1234567890", "email": "john.doe@example.com", "phone": "+12154567890", "trips": [ { "departure_arrival": "2025-04-25T10:30:00-05:00", "departure_destination": "Boston", "departure_destination_terminal": "South Station", "departure_line": "Coastal Express", "departure_origin": "New York", "departure_origin_terminal": "Port Authority", "departure_price": 15.50, "departure_route": "NY-BOS", "departure_stop_cities": "New Haven", "departure_stops": 1, "departure_time": "2025-04-25T15:30:00-05:00", "departure_transporter": "East Coast Bus Company", "departure_transport_type": "bus" } ] }}Response
{ "errors": [ { "error_type": "MISSING_FIELD", "field": "bus_categories", "message": "The field bus_categories was not sent.", "suggestion": "Make sure to send the field bus_categories." } ], "message": "Validation failed. See details for more information.", "status": "error"}Solution
The solution involves adding the missing bus_categories field to the trip object within the event_data.
{ "event_name": "purchase_complete", "event_data": { "passenger_count": 2, "payment_type": "credit_card", "trips_count": 1, "tickets": 2, "total": 31.00, "product": "web", "distinct_id": "1234567890", "email": "john.doe@example.com", "phone": "+12154567890", "trips": [ { "departure_arrival": "2025-04-25T10:30:00-05:00", "departure_destination": "Boston", "departure_destination_terminal": "South Station", "departure_line": "Coastal Express", "departure_origin": "New York", "departure_origin_terminal": "Port Authority", "departure_price": 15.50, "departure_route": "NY-BOS", "departure_stop_cities": "New Haven", "departure_stops": 1, "departure_time": "2025-04-25T15:30:00-05:00", "departure_transporter": "East Coast Bus Company", "departure_transport_type": "bus", "bus_categories": "general" } ] }}Handling Errors of the Identify Endpoint
The following example illustrates how to handle errors when using the identify endpoint of the Reserhub Data Lake API, specifically when a required field is missing.
Request Body
{ "profile_params": { "first_name": "John", "last_name": "Doe", "name": "John Doe", "email": "john.doe@example.com", "phone": "+12154567890", "birthdate": "1990-01-01", "country_code": "US", "city": "New York" }, "product": "web-mobile"}Response
{ "message": "The distinct_id parameter of the user profile is not present or is blank.", "status": "error"}Solution
The solution requires adding the mandatory distinct_id field to the profile_params object.
{ "profile_params": { "distinct_id": "1234567890",, "first_name": "John", "last_name": "Doe", "name": "John Doe", "email": "john.doe@example.com", "phone": "+12154567890", "birthdate": "1990-01-01", "country_code": "US", "city": "New York" }, "product": "web-mobile"}