austinkregel/tamber-php-sdk

API requests 400's with missing information

Closed this issue · 1 comments

After making the change in #1 the request fails with an error similar to

Client error: `POST https://api.tamber.com/v1/event/track` resulted in a `400 Bad Request` response: {"error":"No user given; No behavior given","success":false,"time":0.003888753} 

Changing the POST type from JSON to a standard POST with form_params and changing the Content-Type (or removing it) allows the API call to work as expected.

$res = $this->_client->request($method, $url, [
            'headers' => [
                'Authorization' => 'Basic ' . base64_encode(Tamber::getApiToken().':'),
                'Accept' => 'application/json',
                'Content-Type' => 'application/x-www-form-urlencoded',
            ],
            'form_params' => $params,
        ]);

I'll reboot my account and take a look through the docs tonight to try and see what has changed