500 Error on /api/customers/search/

markguertinmarkguertin Posts: 59Member
edited November 2018 in Development
I tried to file this through the regular support options and was told that they no longer handle any API support and that I must post in the forums to get API support...

I can reproduce this one on demand, 2019-1.0.0

From my application logs:

Filters: lsserver.search.filters.company CONTAINS 'bridge'
We received a 500 error
URL: /api/customers/search/

Response Body: 

<error class="lscore.errors.lightspeed_errors.LightSpeedError" type="server.lightspeederror">
<localizable_message type="server.lightspeederror">
<fields/>
<plain_message>An unexpected error occurred.</plain_message>
</localizable_message>
<traceback>Traceback (most recent call last):

...

DatabaseError: (DatabaseError) error \'ERROR: operator does not exist: boolean ~~ unknown
LINE 4: ...EN (customer.type = \'c\') THEN True ELSE False END LIKE \'%bri...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
\' in \'SELECT count(*) AS count_1
FROM (SELECT ...


</traceback>
</error>

Post edited by jamesratcliffe on

2 comments

  • jamesratcliffejamesratcliffe Posts: 160Administrator, Lightspeed Staff moderator
    I've edited some of the error out because it was very long. It's not clear at all from the message, but the issue is that the lsserver.search.filters.company filter is boolean, so 'CONTAINS' isn't a valid operator.

    The filter 'lsserver.search.filters.company == true' will give customers that are companies (as opposed to individuals).

    If the customer is a company, you can search the company name with lsserver.search.filters.name.
    James Ratcliffe
    Lightspeed HQ
  • markguertinmarkguertin Posts: 59Member
    Thanks James I will give that a try.  Now that I look closer your are right that it's boolean (the return type is string so I probably saw that and got confused).

    It's very unclear from the documentation that the name field will return company name (as opposed to contact name).
Sign In or Register to comment.