manticoresearch icon indicating copy to clipboard operation
manticoresearch copied to clipboard

Support different request formats to the '/sql' endpoint

Open Nick-S-2018 opened this issue 1 year ago • 1 comments

To provide compatibility with our auto-generated OpenAPI clients, we should support an alternative format for the /sql POST request.

The format we currently require is:

POST /sql -d "query={URL_ENCODED_QUERY}"

The alternative format would be:

POST /sql -d "{NOT_URL_ENCODED_QUERY}"

Daemon should check if the request body starts with the query= prefix to detect if it's URL-encoded or not.

Also, since the meaning of the mode=raw query string parameter can be not clear enough for the users of our clients, we should introduce an alias raw_response=true for it. I.e, the following request:

POST /sql?raw_response=true -d "query={QUERY}"

should be handled as equal to:

POST /sql?mode=raw -d "query={QUERY}"

The documentation should be updated (and proofread) accordingly.

Nick-S-2018 avatar Feb 08 '24 12:02 Nick-S-2018

This issue blocks https://github.com/manticoresoftware/openapi/issues/16

sanikolaev avatar Apr 01 '24 09:04 sanikolaev

@Nick-S-2018 pls review https://github.com/manticoresoftware/manticoresearch/pull/2158

sanikolaev avatar May 13 '24 04:05 sanikolaev

Done

Nick-S-2018 avatar May 14 '24 08:05 Nick-S-2018