Enables or disables map views for a profile and sets its monthly map-view threshold. Both fields are optional; an omitted field keeps its stored value.
While the server has a cap (server_mapview_limit 0 or more), threshold cannot be below 0, and map views can be enabled only with a threshold above 0. A request that raises the threshold or turns map views on must fit the cap: every other profile's threshold plus this one cannot exceed server_mapview_limit. Lowering the threshold or disabling map views is never refused by the cap.
The first time map views are enabled for a profile without a token, a Mapbox token is created for it. If that fails, nothing is saved, map views stay off, and the response is 502.
Authorization
Internal API clients only, and SERVER users only, whatever the server's ZWS mode.
Responses
-
OK - the settings were saved. The body is the updated settings, in the same shape as
GET. -
Bad Request - the body is not a JSON object,
enabledis not a boolean,thresholdis not an integer, or, whileserver_mapview_limitis 0 or more,thresholdis below 0 or map views would be enabled with a threshold of 0. -
Unauthorized - missing or invalid bearer token.
-
Forbidden - the client is not internal, or the user is not a SERVER user.
-
Not Found - the profile does not exist or has no company info.
-
Conflict - Mapbox is not enabled on this server, or the threshold does not fit in the server's unallocated map views.
-
Bad Gateway - map views were being enabled and Mapbox did not create a token for the profile. Nothing was saved.
-
Service Unavailable - map views were being enabled, the profile has no token yet, and the Mapbox user or key is not configured on this server. Nothing was saved.
curl \
--request PUT 'https://api.iformbuilder.com/exzact/api/v80/[servername]/mapbox/profiles/123456' \
--header "Content-Type: application/json" \
--header "Authorization: Bearer {access_token}" \
--data '{
"enabled": true,
"threshold": 300
}'
{
"enabled": true,
"threshold": 300
}
{
"profile_id": 123456,
"enabled": true,
"threshold": 300,
"has_token": true,
"server_mapview_limit": 2000,
"allocated": 1300,
"unallocated": 700
}