• Ken

    (@orangewebapps)


    Getresponse returns an error if name is in the API call but empty; however it does not return error if name is not submitted at all. Often times a subscription form does not ask user for name. So I would suggest to change the code below so not send “name” field if it is empty.

    File: /lib/functions.php
    Line: 292-300

    if(strlen($name)){
    $body = '{
                       "name": "'.$name.'",
                       "email": "'.$email.'",
                       "dayOfCycle": "10",
                       "campaign": {
                           "campaignId":  "'.$list.'"
                        },
                        "customFieldValues":' . $cadarray . ' ' .
                    '}';
    
    }else{
           $body = '{
                       "email": "'.$email.'",
                       "dayOfCycle": "10",
                       "campaign": {
                           "campaignId":  "'.$list.'"
                        },
                        "customFieldValues":' . $cadarray . ' ' .
                    '}';
    }
    • This topic was modified 5 years, 1 month ago by Ken.

The topic ‘Code suggestion – make name optional in api call’ is closed to new replies.