Flags
Flags denote options that should be applied to the entire request.
Both POST and PATCH requests to the Wunderite API support flags.
Available flags are defined for each endpoint.
Globally available flags
The following flags are available for PATCH requests across the Wunderite API:
- Name
flags.hydrate
- Type
- boolean
- Description
If set to
true
, the request will hydrate the resulting objects with their full data, rather than just what was updated.This is useful when you want to retrieve the full object after updating it, rather than just the fields that were changed.
Specifying flags in a request
To specify a flag in a request, you can either provide a query parameter with the flag name and value, or you can include it in the JSON request body.
Via query parameter:
?flags[flag_name]=flag_value&flags[another_flag]=1
Via JSON request body:
{
"flags": {
"flag_name": "flag_value",
"another_flag": true
},
"data": [...]
}
Example
In this example, we want to fill VIN data in for vehicles as we create them. The POST and PATCH requests to the Vehicles endpoint support the vin_data
flag.
Via query parameter:
curl -X POST https://app.wunderite.com/api/v1/risks/{risk}/data/vehicles?flags[vin_data][fill]=1&flags[vin_data][overwrite]=1&flags[vin_data][only][]=make&flags[vin_data][only][]=model \
-H "Authorization: Bearer {token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d {"data": [...]}
Via JSON request body:
curl -X POST https://app.wunderite.com/api/v1/risks/{risk}/data/vehicles \
-H "Authorization: Bearer {token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"flags": {"vin_data": {"fill": true, "overwrite": true, "only": ["make", "model"]}},
"data": [...]
}'