You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@drill.apache.org by Nayan Paul <na...@gmail.com> on 2015/06/18 13:17:35 UTC

Issues on querying hbase table on REST

Hi I have integrated drill on Cloudera cluster and  have a hbase table that
I have to access through REST from PHP.

I can query my hbase table from apache drill query editor , but when I use
Postman to test json response from the request then i get 415 internet error

response from Postman


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Error 415 Unsupported Media Type</title>
</head>
<body><h2>HTTP ERROR 415</h2>
<p>Problem accessing /query.json. Reason:
<pre>    Unsupported Media Type</pre></p><hr><i><small>Powered by
Jetty://</small></i><hr/>

</body>
</html>

Regards,

___________________________________________________________________________


Nayan Paul | Phone No: +91-9831814333 | email: nayan.j.paul@gmail.com

Re: Issues on querying hbase table on REST

Posted by Jim Bates <jb...@maprtech.com>.
Example that works for me using Drill 1.0...

curl -X POST -H "Authorization: Basic bWFwcjpyb290NG1hcHI=" -H
"Content-Type: application/json" -H "Cache-Control: no-cache" -d '{
  "queryType" : "SQL",
  "query" : "select * from cp.`employee.json`"
}
' http://maprdemo:8047/query.json


On Thu, Jun 18, 2015 at 6:17 AM, Nayan Paul <na...@gmail.com> wrote:

> Hi I have integrated drill on Cloudera cluster and  have a hbase table that
> I have to access through REST from PHP.
>
> I can query my hbase table from apache drill query editor , but when I use
> Postman to test json response from the request then i get 415 internet
> error
>
> response from Postman
>
>
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
> <title>Error 415 Unsupported Media Type</title>
> </head>
> <body><h2>HTTP ERROR 415</h2>
> <p>Problem accessing /query.json. Reason:
> <pre>    Unsupported Media Type</pre></p><hr><i><small>Powered by
> Jetty://</small></i><hr/>
>
> </body>
> </html>
>
> Regards,
>
> ___________________________________________________________________________
>
>
> Nayan Paul | Phone No: +91-9831814333 | email: nayan.j.paul@gmail.com
>

Re: Issues on querying hbase table on REST

Posted by Carol McDonald <cm...@maprtech.com>.
You need to send the request-header Content-Type: application/json.
Here is an example with curl

curl  \
  --header "Content-type: application/json" \
  --request POST \
  --data '{
    "queryType" : "SQL",
    "query" : "select * from  dfs.mydata.orderprodview limit 1"
 }' \
  http://192.168.110.133:8047/query.json
[ {
  "order_total" : 13,
  "category" : "Binders and Binder Accessories",
  "prod_id" : 909,
  "name" : "Wilson Jones Ledger-SizePiano-Hinge Binder2Blue",
  "state" : "ca",
  "month" : "June",
  "order_id" : 67212,
  "cust_id" : 10001
}]

Here is an example with a Chrome Rest plugin

https://www.mapr.com/blog/how-use-sql-hadoop-drill-rest-json-nosql-and-hbase-simple-rest-client#.VYMFvPlViko


On Thu, Jun 18, 2015 at 7:17 AM, Nayan Paul <na...@gmail.com> wrote:

> Hi I have integrated drill on Cloudera cluster and  have a hbase table that
> I have to access through REST from PHP.
>
> I can query my hbase table from apache drill query editor , but when I use
> Postman to test json response from the request then i get 415 internet
> error
>
> response from Postman
>
>
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
> <title>Error 415 Unsupported Media Type</title>
> </head>
> <body><h2>HTTP ERROR 415</h2>
> <p>Problem accessing /query.json. Reason:
> <pre>    Unsupported Media Type</pre></p><hr><i><small>Powered by
> Jetty://</small></i><hr/>
>
> </body>
> </html>
>
> Regards,
>
> ___________________________________________________________________________
>
>
> Nayan Paul | Phone No: +91-9831814333 | email: nayan.j.paul@gmail.com
>

Re: Issues on querying hbase table on REST

Posted by Sudheesh Katkam <sk...@maprtech.com>.
Hi,

Are you sending the correct Content-Type in the request header? Here’s a link that might help you: http://docs.brightcove.com/en/video-cloud/player-management/guides/postman.html <http://docs.brightcove.com/en/video-cloud/player-management/guides/postman.html> and the Drill REST API doc: https://docs.google.com/document/d/1mRsuWk4Dpt6ts-jQ6ke3bB30PIwanRiCPfGxRwZEQME/edit <https://docs.google.com/document/d/1mRsuWk4Dpt6ts-jQ6ke3bB30PIwanRiCPfGxRwZEQME/edit>

Thank you,
Sudheesh

> On Jun 18, 2015, at 4:17 AM, Nayan Paul <na...@gmail.com> wrote:
> 
> Hi I have integrated drill on Cloudera cluster and  have a hbase table that
> I have to access through REST from PHP.
> 
> I can query my hbase table from apache drill query editor , but when I use
> Postman to test json response from the request then i get 415 internet error
> 
> response from Postman
> 
> 
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
> <title>Error 415 Unsupported Media Type</title>
> </head>
> <body><h2>HTTP ERROR 415</h2>
> <p>Problem accessing /query.json. Reason:
> <pre>    Unsupported Media Type</pre></p><hr><i><small>Powered by
> Jetty://</small></i><hr/>
> 
> </body>
> </html>
> 
> Regards,
> 
> ___________________________________________________________________________
> 
> 
> Nayan Paul | Phone No: +91-9831814333 | email: nayan.j.paul@gmail.com