1

I'm trying to create contact fields in mautic via api and using oauth 2 for authentication. Here is the response I'm getting

{
    "errors": [
        {
            "code": 400,
            "message": "order: This value is not valid.",
            "details": {
                "order": [
                    "This value is not valid."
                ]
            }
        }
    ],
    "error": {
        "message": "order: This value is not valid. (`error` is deprecated as of 2.6.0 and will be removed in 3.0. Use the `errors` array instead.)",
        "code": 400,
        "details": {
            "order": [
                "This value is not valid."
            ]
        }
    }
}

I've worked with mautic api before and the order parameter was never required. Also when I tried to pass parameter order as an int value it was not accepting that as well.

Mohit
  • 113
  • 1
  • 12

2 Answers2

0

Not sure if this is the cause of your issue but I had the same response from using /fields/contacts/new and the path actually needs to be /fields/contact/new.

Also, I noticed that you need to flatten out some of the keys for example using the properties attribute you need to submit the key as properties[key] - see below:

requests.post(url=self.url + '/fields/contact/new', headers=self.header, 
        data={
              'label': 'somelabel',
              'type': 'mautic data type',
              'properties[key]': 'value'
        })
Noah
  • 101
  • 1
  • 2
  • 7
0

I'm using Mautic 3.1 and have the same issue with the PHP mautic/api-library. Unsetting or not passing the order property fixes the issue. Although, I'm not sure why it's not accepting the value for order because I'm using the same value returned from the API to get the field definition (not changing the value).

andyg5000
  • 106
  • 1
  • 4