js-webflow-api
js-webflow-api copied to clipboard
API returning different name for fields
My collection has a field named Summary:
The API is returning the field as 'description-3':
summary
isn't found in GET or PATCH or POST calls. Is this the best repo to submit bugs to the Webflow API as a whole?
This is not a bug. That field name on the API is set when you create the field, and never changes, even if you change it through the Webflow CMS. Once the field was created with the name X, it will always have that name.
Also, if you delete a field and create a new one with the same name, the new field will not be able to have the original name, say "summary". Webflow will always increment a number to the end of the field name so field names never repeat in the back-end.
What you can do to improve the work on your end is to create a helper function that gets the field slug from the field name. For that you will need to fetch the collection schema from the CMS API.
Is there any way to deeply delete a field so that the field name is available again? It's especially inconvenient to work with dashes as object field names and makes types dirty with arbitrary numbers...