Getting a 400 error on creating custom fields via API - order: This value is not valid

Anyone able to help me out with an issue I am bumping up against when testing this PR: https://github.com/mautic/mautic/pull/9761

When I try to create the field I am using a POST to https://mautic4.ddev.site/api/fields/contact/new per the docs

I am getting a 400 response with vanilla Mautic (no PR applied, features branch):

“code”: 400,
            “message”: “order: This value is not valid.“,

I have made sure I am using an int, tried setting to higher values, tried not including order - nothing seems to work - also tried getting first and literally copy/pasting.

Also reported on Stack Overflow: symfony - Mautic Contact Field Api request returning 400 in response - Stack Overflow with no response.

Not sure if this is a bug or a user error! :blush:

Here’s the body I am using to test in Postman:

{
        "label": "Added by API",
        "alias": "addedbyapi",
        "type": "text",
        "group": "core",
        "object": "contact",
        "order": 150,
        "defaultValue": null,
        "isRequired": false,
        "isPubliclyUpdatable": false,
        "isUniqueIdentifier": false,
        "properties": {}
}
1 Like

Solution: Field needs to be called field_order - also something was saved or cached someplace in Postman which was using the fieldname order! :woman_facepalming: thanks @kuzmany for the tip off!