CQL errors with PHP SDK and API

pevpev
edited August 2012 in Developers
We're having problems trying to use Checkfront's example code (see https://github.com/Checkfront/PHP-SDK/blob/master/examples/db-query-cql.php) and the PHP SDK to access Checkfront using the API. As Checkfront support have just told us that they do not provide any ticket support for use of the API, we'd be very grateful if anyone could throw any light on the problem.

Checkfront's supplied example code executes the CQL statement $Checkfront->cql('select * from status') and we have this working as advertised. However, simply changing the CQL statement in the example code to execute any of the other CQL statements listed on the Checkfront CQL Query Reference Guide (see http://www.checkfront.com/developers/api-cql/) just generate errors. Here are a couple of examples:

Example 1:  print_r($Checkfront->cql('SHOW TABLES')) ;
Result:
Array
(
[version] => 2
[host_id] => oursite.checkfront.co.uk
[name] => Our Name
[request] => Array
(
[obj] => cql/
[status] => OK
)

[query] => Array
(
[status] => FAIL
[results] => 0
[pages] => 1
[error] => CQL syntax error.
)

)
Example 2:  print_r($Checkfront->cql('DESCRIBE TABLE booking')) ;

Result:
Error:
array (
'curl' => '',
)



We've tried a range of upper and lower case, including back quotes and so on without success. We're very likely missing something obvious - can anyone see what it is?! :-)

Thanks in advance

Peter

Comments

  • JasonJason CEO Checkfront
    edited August 2012
    Hey Peter,

    CQL doesn't support all of the standard SQL commands (describe, explain etc).  In fact it supports only a few of them.  And there is currently no direct access to the booking table.  You should use the /api/2/booking interface for you calls.

    What is it you are trying to achieve?
  • Hi Jason

    Thanks for the explanation about CQL. All we're aiming to do is retrieve details for all bookings for a particular date range to generate some custom reports. I'd assumed from the docs that we should do this with a CQL query, if you were able to give an example of how we're supposed to do this, that would be great.

    Many thanks,

    Peter
  • I am also looking to have the same type of information returned. A list of bookings for a specific day. I am knocking my head against the wall when the documentation says the CQL queries will work when they do not. :(
  • Hi,
    in light of the revelations by Jason, would it not be wise to update/remove the page
    http://www.checkfront.com/developers/api-cql/
    Ive just wasted an hour of my life on this, its all well and good not supporting the API but publishing misleading/incorrect information is not helpful.
    Do you think you could enlighten us with the calls you do actually support?
  • JasonJason CEO Checkfront
    Please make sure to review our updated API (v2.1) docs: http://checkfront.github.com/API/
  • edited February 2013
    I've been trying to achieve exactly the same thing for a while now with the new API, I can return a booking when i supply the customer_id but trying to get the bookings over a specific date range (for which obviously you will not know the customer_id in advance) seems impossible. The API docs(v2.1) is somewhat contradictory here as it states at the beginning that booking can only be queried by customer_id or booking_id but then suggests later on that they can be filtered (queried?) by date range as well.

    If I find anything I'll update here.

  • Any more information on retrieving a list of ALL bookings using the API?
  • Has CQL been removed entirely now? Just removing a page without any explanation is very unhelpful, especially as it is referenced in several of the code examples.
This discussion has been closed.