You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Jared Katz <ja...@jet.com> on 2016/04/04 19:54:42 UTC

Phoenix Query Server - proper POST body format

I'm guessing this will be a pretty easy question for someone to answer...

I've had success making POST requests to the Query Server by putting the payload in the request header, like so:
                Key: "request"
                Value: "{"request": "prepareAndExecute", "sql": "SELECT* FROM table", "maxRowCount": -1, "connectionId": "12345"}"

How do I properly format the payload for the request body? I tried using the same key and value in the form-data for the request body, but I'm getting a 500 error with the following message:

"Problem accessing /. Reason: java.lang.NullPointerException"

Thanks,
Jared

RE: Phoenix Query Server - proper POST body format

Posted by Jared Katz <ja...@jet.com>.
Thanks Josh. Got it working.

-----Original Message-----
From: Josh Elser [mailto:josh.elser@gmail.com] 
Sent: Wednesday, April 6, 2016 6:10 PM
To: user@phoenix.apache.org
Subject: Re: Phoenix Query Server - proper POST body format

Hi Jared,

This is just a bad error message on PQS' part. Sorry about that. IIRC, it was something obtuse like not finding the server-endpoint for the JSON message you sent.

If you want to do a POST and use the body, you can just put the bytes for your JSON blob in there and that should be sufficient. Nothing fancy should be necessary.

If you need some more direction than that, let me know what version you're running and perhaps an example of your client request.

Thanks and good luck!

- Josh

Jared Katz wrote:
> I'm guessing this will be a pretty easy question for someone to 
> answer...
>
> I've had success making POST requests to the Query Server by putting 
> the payload in the request header, like so:
>
> Key: "request"
>
> Value: "{"request": "prepareAndExecute", "sql": "SELECT* FROM table",
> "maxRowCount": -1, "connectionId": "12345"}"
>
> How do I properly format the payload for the request /body/? I tried 
> using the same key and value in the form-data for the request body, 
> but I'm getting a 500 error with the following message:
>
> "Problem accessing /. Reason: java.lang.NullPointerException"
>
> Thanks,
>
> Jared
>

Re: Phoenix Query Server - proper POST body format

Posted by Josh Elser <jo...@gmail.com>.
Hi Jared,

This is just a bad error message on PQS' part. Sorry about that. IIRC, 
it was something obtuse like not finding the server-endpoint for the 
JSON message you sent.

If you want to do a POST and use the body, you can just put the bytes 
for your JSON blob in there and that should be sufficient. Nothing fancy 
should be necessary.

If you need some more direction than that, let me know what version 
you're running and perhaps an example of your client request.

Thanks and good luck!

- Josh

Jared Katz wrote:
> I’m guessing this will be a pretty easy question for someone to answer…
>
> I’ve had success making POST requests to the Query Server by putting the
> payload in the request header, like so:
>
> Key: “request”
>
> Value: “{"request": "prepareAndExecute", "sql": "SELECT* FROM table",
> "maxRowCount": -1, "connectionId": "12345"}”
>
> How do I properly format the payload for the request /body/? I tried
> using the same key and value in the form-data for the request body, but
> I’m getting a 500 error with the following message:
>
> “Problem accessing /. Reason: java.lang.NullPointerException”
>
> Thanks,
>
> Jared
>