kennym / cf7-to-api

LOOKING FOR MAINTAINER. Wordpress plugin to transmit contact form 7 entries to remote API using POST or GET
https://wordpress.org/plugins/cf7-to-api-basic-auth/
52 stars 30 forks source link

Error with post json #33

Closed drbelt27 closed 3 years ago

drbelt27 commented 3 years ago

i ha tried this plugin, but i have the problem i call with basic auth my crm and i setup the json in the plugin but i have returned this error.

error: Array ( [0] => WP_Error Object ( [errors] => Array ( [json-error] => Array ( [0] => 4 )

            )

        [error_data] => Array
            (
            )

        [additional_data:protected] => Array
            (
            )

    )

)


json: {"elementType":"Leads", "element": "{\"company\":\"[text-301]\",\"firstname\":\"[text-302]\",\"lastname\":\"[text-303]\",\"email\":\"[email-497]\",\"phone\":\"[tel-497]\",\"accounttype\":\"[menu-429]\",\"cf_mke_1055\":\"[menu-874]\",\"gdpr_privacypolicy\":\"[acceptance-5]\",\"leadsource\":\"[lead_source]\",\"cf_mke_1056\":\"[language]\"}"}

kennym commented 3 years ago

What are the payloads you are providing?

drbelt27 commented 3 years ago

what is the payload ? sorry :(

drbelt27 commented 3 years ago

sorry in my first message i have paste the incorrect json. you find the correct json below (i use the escape caracter)

{"elementType":"Leads", 
    "element": "{\"company\":\"[text-301]\",\"firstname\":\"[text-302]\",\"lastname\":\"[text-303]\",\"email\":\"[email-497]\",\"phone\":\"[tel-497]\",\"accounttype\":\"[menu-429]\",\"cf_mke_1055\":\"[menu-874]\",\"gdpr_privacypolicy\":\"[acceptance-5]\",\"leadsource\":\"[lead_source]\",\"cf_mke_1056\":\"[language]\"}"
    }
jhaeger commented 3 years ago

I've got the same error.

jhaeger commented 3 years ago

@drbelt27

Try the below: {"elementType":"Leads","element":{"company":"[text-301]","firstname":"[text-302]","lastname":"[text-303]","email":"[email-497]","phone":"[tel-497]","accounttype":"[menu-429]","cf_mke_1055":"[menu-874]","gdpr_privacypolicy":"[acceptance-5]","leadsource":"[lead_source]","cf_mke_1056":"[language]"}}

My issue was improperly formatted JSON. Yours is as well.