Repeated Form Fields in the payload

  • 22 February 2018
  • 2 replies
  • 6 views

We have an integration for unbounce, one of our customer’s /pages/<page_id>/fom_fields endpoint, return repeated set of same form fields , with same ids, which is causing an issue while mapping fields during webhook creation, as the /pages/<page_id>/integrations/<integration_id>/field_map , returns a 400 due to repeated field ids, can you please suggest a solution to this issue, and also let us know why this is happening , so that we can inform our customers to avoid it in future. Below is the Data from customer’s /form_fields endpoint for reference ->

{
    "metadata": {
        "documentation": "https://api.unbounce.com/doc/form_fields?secure=true",
        "location": "https://api.unbounce.com/pages/1bd98ba5-b355-4fe6-84f6-7a8fe057986c/form_fields?secure=true",
        "count": 30,
        "related": {
            "page": "https://api.unbounce.com/pages/1bd98ba5-b355-4fe6-84f6-7a8fe057986c?secure=true"
        }
    },
    "formFields": [
        {
            "name": "Nombre",
            "id": "nombre",
            "type": "text",
            "validations": {
                "required": false
            }
        },
        {
            "name": "Apellidos",
            "id": "apellidos",
            "type": "text",
            "validations": {
                "required": false
            }
        },
        {
            "name": "Email",
            "id": "email",
            "type": "text",
            "validations": {
                "required": false,
                "email": true
            }
        },
        {
            "name": "Celular",
            "id": "celular",
            "type": "text",
            "validations": {
                "required": true,
                "phone": true
            }
        },
        {
            "name": "utm_source",
            "id": "utm_source",
            "type": "hidden"
        },
        {
            "name": "utm_medium",
            "id": "utm_medium",
            "type": "hidden"
        },
        {
            "name": "utm_content",
            "id": "utm_content",
            "type": "hidden"
        },
        {
            "name": "utm_campaign",
            "id": "utm_campaign",
            "type": "hidden"
        },
        {
            "name": "gclid",
            "id": "gclid",
            "type": "hidden"
        },
        {
            "name": "destinos",
            "id": "destinos",
            "type": "hidden"
        },
        {
            "name": "Nombre",
            "id": "nombre",
            "type": "text",
            "validations": {
                "required": false
            }
        },
        {
            "name": "Apellidos",
            "id": "apellidos",
            "type": "text",
            "validations": {
                "required": false
            }
        },
        {
            "name": "Email",
            "id": "email",
            "type": "text",
            "validations": {
                "required": false,
                "email": true
            }
        },
        {
            "name": "Celular",
            "id": "celular",
            "type": "text",
            "validations": {
                "required": true,
                "phone": true
            }
        },
        {
            "name": "utm_source",
            "id": "utm_source",
            "type": "hidden"
        },
        {
            "name": "utm_medium",
            "id": "utm_medium",
            "type": "hidden"
        },
        {
            "name": "utm_content",
            "id": "utm_content",
            "type": "hidden"
        },
        {
            "name": "utm_campaign",
            "id": "utm_campaign",
            "type": "hidden"
        },
        {
            "name": "gclid",
            "id": "gclid",
            "type": "hidden"
        },
        {
            "name": "destinos",
            "id": "destinos",
            "type": "hidden"
        },
        {
            "name": "Nombre",
            "id": "nombre",
            "type": "text",
            "validations": {
                "required": false
            }
        },
        {
            "name": "Apellidos",
            "id": "apellidos",
            "type": "text",
            "validations": {
                "required": false
            }
        },
        {
            "name": "Email",
            "id": "email",
            "type": "text",
            "validations": {
                "required": false,
                "email": true
            }
        },
        {
            "name": "Celular",
            "id": "celular",
            "type": "text",
            "validations": {
                "required": true,
                "phone": true
            }
        },
        {
            "name": "utm_source",
            "id": "utm_source",
            "type": "hidden"
        },
        {
            "name": "utm_medium",
            "id": "utm_medium",
            "type": "hidden"
        },
        {
            "name": "utm_content",
            "id": "utm_content",
            "type": "hidden"
        },
        {
            "name": "utm_campaign",
            "id": "utm_campaign",
            "type": "hidden"
        },
        {
            "name": "gclid",
            "id": "gclid",
            "type": "hidden"
        },
        {
            "name": "destinos",
            "id": "destinos",
            "type": "hidden"
        }
    ]
}

as you will observe above, same set of field ids i.e. nombre,apellidos,email,celular,utm_source,utm_medium,utm_content,utm_campaign,gclid,destinos are repeated thrice


2 replies

Hey there,
Yeah, there’s definitely something going wrong on that API response. Lemme take a look into it and get back to you. In the meantime, do you have a workaround or are you blocked by this?

Thanks,
H.

Hey @Aditya_Jawade The API response returns all the form fields of all your page variants. You may have several variants with the same form fields which will cause it show up repeatedly. The API currently does not de-duplicate field names, so you’ll have to do so client-side.

Reply