ActiveCampaign / activecampaign-api-php

MIT License
115 stars 76 forks source link

Path contact/view/email not working #27

Closed danielbitzer closed 7 years ago

danielbitzer commented 8 years ago

I've tried a few different paths and I'm fairly sure this is a bug.

$contact = $ac->api('contact/view/email', array(
     'email'=>'hello@example.com'
));

To fix I'm adding the following method to class AC_Contact

function view_email($params, $post_data) {
    $request_url = "{$this->url}&api_action=contact_view_email&api_output={$this->output}&{$params}";
    $response = $this->curl($request_url, $post_data);
    return $response;
}
mthommes commented 8 years ago

Since this is a GET method, it would just be:

$contact = $ac->api("contact/view?email=hello@example.com");

We have a task open to improve this, as it would make sense to be able to pass GET parameters as the second parameter of $ac->api(), but for now that's limited to POST data.

danielbitzer commented 8 years ago

Fair enough. I did try that too, but for some reason $params was coming through as an empty string in the view() method.

mthommes commented 8 years ago

Hi, I tested this on one of my own accounts, and it seemed to work fine, so to continue troubleshooting, please submit a support ticket and mention this thread so it gets directed to me. I will need to see your full API request. Thanks! :+1: