How to create datasources and tables using curl ?
Make sure these boxes are checked before submitting your issue - thank you!
- [ ] I have checked the superset logs for python stacktraces and included it here as text if any
- [ ] I have reproduced the issue with at least the latest released version of superset
- [ ] I have checked the issue tracker for the same issue and I haven't found one similar
Superset version
0.20.6
Expected results
Creating datasources and tables using curl.
Actual results
I have tried with the following. What are the datas to be passed here? curl -H "Content-Type: application/json" -X POST -d '{ ? }' http://localhost:8088/tablemodelview/api/create
I got this error: { "message": "Access is Denied", "severity": "danger" }
Also in logs: "POST /tablemodelview/api/create HTTP/1.1" 401 -
Steps to reproduce
What is the api endpoint for creating datasources and tables?? What are the datas to be passed along with curl?
Also I am using REMOTE_USER authentication type. So there is no password for the users. Can remote user access this endpoint ?? - /tablemodelview/api/create I have tried with the following curl also: curl -i -H 'Authorization: Basic XXX' -H "Content-type: application/json" -X POST --data '{"database_id" : "2" , "schema" : "public" , "table_name" : "aa"}' http://localhost:8088/tablemodelview/api/create
Error: < HTTP/1.0 401 UNAUTHORIZED { "message": "Access is Denied", "severity": "danger" }
REMOTE_USER assumes you have headers added by a proxy. So from behind the proxy you would spoof these headers, just find the CURL feature to set headers on the request. Of course you have to be behind the proxy to do this, the proxy shouldn't let you spoof or that would be a security hole.
Thanks.. Will try with that headers..
I hereby understood this. Please correct it if I am wrong.
In config.py file, we can add static headers like HTTP_HEADERS = {'X-Frame-Options': 'SAMEORIGIN'}
And in curl pass those same headers also. I tried this.. It is not working.
If wrong how to add those headers by proxy??
more like HTTP_HEADERS = {'REMOTE_USER': 'username_you_want_to_spoof'}
But I can use users/api/create for creating users without this authorization problem as REMOTE_USER. Is there any connection between this?
Ok....thanks..Will give it a try.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.