Closed joetsuihk closed 10 years ago
@joetsuihk - that looks correct. is it not working as expected?
Fatal error: Uncaught exception 'Guzzle\Http\Exception\ClientErrorResponseException' with message 'Client error response [status code] 400 [reason phrase] Bad Request [url] https://api.keen.io/3.0/projects/xxxxxx/events/checkin
This is the error I got.
Have you double checked that the variables you're passing in are valid / correct?
I used your example to add an event with Geo and it succeeded.
$client->addEvent('foo', array(
'checkin' => array(
'shop_id' => 123,
'user_id' => 456,
),
'shop' => 'Some Shop',
'keen' => array('location' => array(
'coordinates' => array(-88.21337, 40.11041)
))
));
I see this in my collection in Keen:
{
"shop": "Some Shop",
"keen": {
"timestamp": "2014-08-14T04:09:30.420Z",
"created_at": "2014-08-14T04:09:30.420Z",
"id": "53ec367a05cd662ff0dc5514",
"location": {
"coordinates": [
-88.21337,
40.11041
]
}
},
"checkin": {
"shop_id": 123,
"user_id": 456
}
}
Thanks! data type
$this->keenio->addEvent('checkin', array(
'checkin' => array(
'shop_id' => $shop_id,
'user_id' => $user_id,
),
'shop' => $shop,
'keen' => array('location' => array(
'coordinates' => array((double)$this->input->post('lng'), (double)$this->input->post('lat'))
))
));
Is this the correct method to send coordinates?