Lightspeed not processing "&" as "&" in URL

petertpetert Member Posts: 9

I'm working on a PBX integration that loads the customer details when a call is received from a matching phone number.

Since my integration is written in XML, I'm adding the "&" in the URL as "&". When the URL is generated it comes out as:

us.merchantos.com/?name=customer.views.customer&form_name=view&id=1&tab=details

which loads a blank page.

If I navigate to the customer details the URL is:

us.merchantos.com/?name=customer.views.customer&form_name=view&id=1&tab=details

So LS Retail isn't recognizing "&" as "&" which is causing the page not to load.

Does anyone have a solution to get LS to recognize an encoded "&" in the URL?

An even better solution would be an API response I could send that would open the customer details within the already open browser window in case anyone has a solution for that as well.

4 comments

  • gregaricangregarican Member Posts: 907 

    If you are talking about how the web browser handles the URL it's being passed, that's not a Lightspeed thing as much as a web browser thing. The ampersand character doesn't have to be URL encoded in order for a web browser to handle it. Usually the ampersand is a query parameter delimiter and is handled as-is.

    Easiest thing to do would be to conditionally replace any instance of & with & and then pass that to the web browser. Since you are controlling the integration code it's just a quick regex or the like.

  • petertpetert Member Posts: 9

    The PBX will only accept a XML document for the integration which is why I'm having to use & instead of &.

    From what I've read the browser and site should recognize both as the same but in this case, it isn't happening.

  • gregaricangregarican Member Posts: 907 

    Try this and see how things would get split out --> https://www.freecodeformat.com/query-string-splitter.php. You can see where the & character is the query delimiter, but all of the names after that character are pre-pended with amp; It's not just the Lightspeed Retail website. Any website that is parsing query parameters would choke.

    Too bad that the PBX integration doesn't support JSON as well as XML. That would be an ideal solution.

  • petertpetert Member Posts: 9

    Thank you for pointing that out. I'll continue to work with the PBX to get it to send the correctly formatted URL.

Sign In or Register to comment.