CMS API name fields in CMS Collections

Hello, @webflow team!

Has Webflow CMS an ability to rename cms fields in collection?
That’s really huge problem which I’ve found when I tried to use your API and faced cms fields with old names, which were set during the creation of the collection!!

In the process of creating a set of fields in collections in Webflow CMS I came to the need to unify the names and rename some fields.
But republishing my site also doesn’t rename such field which I see in json through API request to Webflow CMS. Despite the fact that in the visual interface of the collection there appear new renamed field names.

Suggest, please, a solution that would bring the field names obtained in the API-request and the current name to a single data value.

Btw, my project is https://www.capsbutik.ru
My test version for CMS-based site is http://capsbutik.webflow.io/

Thank you!

2 Likes

Hey Gregory!

I’m not 100% sure what you mean - when you update the name of a field in the designer, the API responses should return the updated values. Can you give me an example HTTP request where you are not seeing the updated values so I can look into the issue further?

Hello, @nathan

Look on such JSON.
Webflow cms field names which I receive in JSON differs from those names into your CMS web-interface.

Btw, there is also a strange behavior when renaming cms fields name. I mean that renaming name field doesn’t make any effect on field name from JSON, which I guess uses initially assigned name when creating a name field.

https://api.webflow.com/collections/5a0428779ea3b90001b797bc/items

Authorization:Bearer *
accept-version:1.0.0

{
    "items": [
        {
            "_archived": false,
            "enabled": true,
            "_draft": false,
            "in-stock": true,
            "old-price": 8990,
            "price": 2990,
            "capsule-system": "6ef9636b5efb3f68183fe2298c8a4fba",
            "sorting-number": 2,
            "weight": 2400,
            "country-of-origin": "Венгрия",
            "brand": "Delonghi",
            "productid": "71819456",
            "name": "Delonghi Nespresso Inissia EN 80",
            "h1-title": "Получите выгоду при покупке кофемашины Delonghi Nespresso Inissia EN 80",
            "warranty": "24",
            "description": "<p><strong>Скидка на кофемашину:</strong></p><ul><li>скидка&nbsp;<strong>6000р.&nbsp;</strong>при заказе от 450 кофе-капсул (на сумму не менее 12000р.);</li></ul><p><strong>Или</strong></p><p><strong>При покупке кофемашины по полной стоимости 8990 р.</strong></p><ul><li>100 кофе-капсул&nbsp;<strong>БЕСПЛАТНО</strong>!</li></ul><p><strong>Оформите заказ через корзину (или отправьте \"Обратный звонок\" в навигнационной панели в шапке сайта), и менеджер поможет с выбором кофе для кофемашины и активирует соответствующую скидку при подтверждении вашего заказа по телефону.</strong></p><p><strong><a href=\"https://www.capsbutik.ru/kofemashina-nespresso-inissia\" data-rt-link-type=\"external\">Подробнее о предложении на кофемашину Delonghi Nespresso Inissia.</a></strong></p><p>Вся экспертиза&nbsp;<em>Nespresso</em>&nbsp;в одной маленькой и умной кофемашине&nbsp;<strong><em>Inissia</em></strong>.</p><p>Компактная, легкая, удобная в переноске,&nbsp;<strong><em>Inissia</em></strong>&nbsp;прекрасно впишется в любой дизайн интерьера.</p><p>Технические характеристики:</p><ul><li>Вес: 2.4 кг.;</li><li>Программируемый объем чашки кофе: Эспрессо (40мл) и Лунго (110мл);</li><li>Автоотключение через 9 минут (возможность перепрограммирования до 30 минут);</li><li>Быстрый разогрев: 25 секунд;</li><li>Резервуар для воды: 0.7 л;</li><li>Регулируемый поддон для коктейльных стаканов;</li><li>Контейнер для 9-11 использованных капсул;</li><li>Размеры: 12 x 23 x 32.1 см;</li></ul><figure data-rt-type=\"video\" data-rt-align=\"center\" class=\"w-richtext-align-center\" data-rt-max-height=\"33.723653395784545%\" style=\"padding-bottom: 33.7237%; width: 60%; max-width: 60%;\" data-rt-dimensions=\"854:480\"><div><iframe src=\"https://www.youtube.com/embed/E07t4X1EH7E\" frameborder=\"0\" allowfullscreen scrolling=\"no\"></iframe></div></figure>",
            "slug": "delonghi-nespresso-inissia-en-80",
            "main-category-2": "5a0428779ea3b90001b79947",
            "all-categories-product-belongs-2": [
                "5a0428779ea3b90001b79947"
            ],
            "updated-on": "2017-11-25T18:57:50.676Z",
            "updated-by": "Person_55b720112f94dfa17f2c2476",
            "created-on": "2017-11-03T13:54:16.330Z",
            "created-by": "Person_55b720112f94dfa17f2c2476",
            "published-on": "2017-11-25T18:59:17.236Z",
            "published-by": "Person_55b720112f94dfa17f2c2476",
            "thumbnail-image": "5a0428779ea3b90001b79935",
            "lungo-yes": true,
            "espresso-yes": true,
            "water-tank-2": 0.7,
            "capsule-container": "9-11",
            "new": true,
            "is-latte-capuccino": true,
            "hit": true,
            "ristretto-yes": true,
            "capsules-per-pack": "100",
            "_cid": "5a0428779ea3b90001b797bc",
            "_id": "5a0428779ea3b90001b799fb"
        }
    ],
    "count": 1,
    "limit": 100,
    "offset": 0,
    "total": 1
}
1 Like

In that example JSON, which field is incorrect, and what is the expected value?

@nathan

We are coding custom converter to automate webflow cms items data filling. Custom Integration between Ecwid product attributes and Webflow CMS fields.
My current no CMS project is https://www.capsbutik.ru/
My testing with CMS project is http://capsbutik.webflow.io/

JSON in my previous post is pulled for Webflow Collection “Kapsulnye kofemashiny Nespresso”.
Сurrent webflow collections which should be filled with data (“Kapsulnye kofemashiny Nespresso”, “Kofe kapsuly Nespresso”, “Kofe zerno”) has their own set of fields.
Btw, some kind of cms fields should be same for all three item collections, some of them should differ and unique for this collection.

The problem which we’ve faced that fields has originally created names and don’t react on renaming when we’re trying to pull them with JSON.

Names of fields on an example of a collection “Kapsulnye kofemashiny Nespresso”. Names with JSON pulling shoud be the same with names in Web interface.

JSON pulls | Web interface
country-of-origin | country-origin
main-category-2 | main-category
all-categories-product-belongs-2 | all-categories-product-belongs
lungo-yes | is-lungo
espresso-yes | is-espresso
water-tank-2 | water-tank
new | is-new
hit | is-hit
ristretto-yes | is-ristretto
capsules-per-pack | items-per-pack

Waiting for your help.
Thank you.

Alright, I see what is happening now.

To explain things, if you pull the collection data (https://api.webflow.com/collections/5a0428779ea3b90001b797bc) you’ll see this for the country-origin field:

    {
      "validations": {
        "singleLine": true
      },
      "id": "b4e43ecbc8823f4386b7fc3cc4e57e1a",
      "helpText": "Страна производитель",
      "editable": true,
      "required": false,
      "type": "PlainText",
      "slug": "country-of-origin",
      "name": "country-origin"
    },

The UI always shows the user friendly name, which is editable. However, there is a non-editable field slug which is generated based on the the name field when the field is first created. This value cannot change, and it is always unique. (So, for example, if you created a field whose name was foo, deleted it, and then recreated it, the slug would be foo2 to ensure it is a slug that never has been used in that collection before.)

So ultimately, the API response is using the slug value which we can guarantee is actually unique.

1 Like

So just to clarify, we have to remove the collection field entirely and create a new one with the desirable slug?

So there’s no workaround for CMS fields that already has 200+ entries but to delete the whole thing and refill the entries again?

:confused:

@nathan

Can you advice a method to generate json based on “name”, not “slug”?

Btw, if i can’t do that, it means that I should recreate whole collections from scratch and make redesign on cms pages again.

And in future, if cms field will be recreates that means that my integration would break and I should recreat the whole cms-based project from scratch.

@nathan

still waiting for your answer. Thanks a lot!

Just a thought - create new field with desired slug and name and run an API call to read whatever your currently have, update in Sublime or any other IDE values of new field to be the same as in old field, call api to update new values.

For most of above I’d use Postman App → Sublime → Bash workflow in case of emergency like this.

Hope this helps!
Bart

1 Like

@bart

Thank you. That really helps! :slight_smile:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.