I am using rest API /api/v3/sql to fetch dremio JOBs but it is returning HTML Page with 200 response code.
import requests
import json
import time
host = 'your_host'
port = '9047'
uid = 'your_user'
pwd = 'your_pass'
headers = {'content-type': 'application/json'}
response = requests.post('http://'+host+':'+port+'/apiv2/login', headers=headers, data = json.dumps({"userName":uid,"password":pwd}))
headers={'content-type':'application/json', 'authorization':'_dremio'+response.json()['token']}
#Query
sql = 'select * from sys.options limit 3'
job_id = requests.post('http://'+host+':'+port+'/api/v3/sql', headers=headers, data = json.dumps({"sql":sql}))
print(job_id.text)
The print statement returns this below HTML Code,
<!--
Copyright (C) 2017 Dremio Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html>
<html>
<head>
<title>Dremio</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">
<script type="text/javascript">
window.dremioConfig = {
serverEnvironment: "PRODUCTION",
serverStatus: "OK",
environment: "PRODUCTION",
commit: "27f36e19b9c97f6e0da9de58baa9cefec6498535\nWith uncommitted changes:\nM dac/ui/npm-shrinkwrap.json",
ts: "Wed Jul 19 2017 08:21:36 GMT+0000 (UTC)",
language: undefined,
useRunTimeLanguage: undefined,
intercomAppId: "gdcxa2zo",
shouldEnableBugFiling: false,
shouldEnableRSOD: false,
supportEmailTo: "",
supportEmailSubjectForJobs: "",
outsideCommunicationDisabled: false
};
</script>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="/manifest.json">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#55bfce">
<meta name="theme-color" content="#2b3a4b">
<link href="/style.45b736e736ded57c7d60156a62efd9ab.css" rel="stylesheet"></head>
<body>
<div id="root">
</div>
<script type="text/javascript" src="/vendor.4f9b93ca2e53d2a94faa.js"></script><script type="text/javascript" src="/bundle.4f9b93ca2e53d2a94faa.js"></script></body>
</html>
I am not sure why this is happening, as the above mentioned /apiv2/login is returning proper response, but /api/v3/sql is not returning proper data. Any help would me much appreciated.
Thanks