Closed cmtoomey closed 7 years ago
This is fully covered by API documentation, so the behavior should not come as a surprise: https://www.mapbox.com/api-documentation/#update-a-style
Requesting a style and then using the same content to update the style will fail: you'll need to remove the created and modified properties before updating a style. The name property, which is optional for style creation, is required when updating a style. Cross-version PATCH requests are rejected.
That's fair - but I'm curious as to the existence of the behavior in the first place. Based on the style-reference, created and modified aren't actually part of the spec - which is logical given the documentation and expected behavior.
However, the initial interaction with the Style JSON returns something that is off-spec. I get that parsing and deleting lines isn't a massive technical undertaking; but if we accept that creation and modification dates are useful properties (else they wouldn't be provided), wouldn't it be easier to simply adopt them into the spec?
This has been addressed with the metadata
property
I think this is still valid -- the Style API doesn't actually use metadata
for these properties, due to historical timing. We could decrease the API friction and eliminate the documentation caveat by adding them to the style spec, so that the Style API response validates.
This issue was moved to mapbox/mapbox-gl-js#4114
In testing PATCH requests against GL Styles, the Style JSON provided by GET /styles/v1/{username}/{style_id} is not valid for PATCH requests made via PATCH /styles/v1/{username}/{style_id}.
Actual request (with body) can be found here
HTTP Response code is 422 Unprocessable Entity
Postman output below
If "created" is deleted, the PATCH request fails again due to "modified"
Deleting "modified" allows the request to go through
Two requests for fix: