REST API
I am trying to query an explore view from a cross origin. I don't have experience with python and tried using the labels: @has_access_api @cross_origin(allow_headers=['Content-Type'])
before the definition of the explore method but when I try to run the query it shows "http://example-domain.com:8080/login/" as the location header of the response. I guess there is a permissions problem I still have to figure out so I tried to trace where the app redirects to login with no luck.
how can I authenticate an access through an ajax call?
We installed cors support and enabled it in caravel following this instructions: pip install -U flask-cors
The following keys in caravel_config.py can be specified to configure CORS: ENABLE_CORS: True CORS_OPTIONS: without parameters
We want get the json from slices for example: https://example-domain.com:8088/caravel/explore/table/4/?slice_name=%25+RFC+Exitosos+-+1yr&y_axis_zero=y&resample_fillmethod=&show_brush=y&line_interpolation=linear&show_legend=y&resample_rule=&granularity_sqla=date{blablabla}e=kpm_measurements&contribution=false&time_grain_sqla=month&having=
Through ajax:
$.get(" https://example-domain.com:8088/caravel/explore/table/4/?slice_name=%25+RFC+Exitosos+-+1yr&y_axis_zero=y&resample_fillmethod=&show_brush=y&line_interpolation=linear&show_legend=y&resample_rule=&granularity_sqla=date{blablabla}e=kpm_measurements&contribution=false&time_grain_sqla=month&having=").done(function(response){ console.log(response); });
So we created a new view method with @cross_origin(allow_headers=['Content-Type'], supports_credentials=True) and without the @has_access decorator to test and it works, but we want to know if there is a native alternative to expose a service for a REST client.
+1
For future reference, I was able to get CORS working using the instructions here:
https://superset.incubator.apache.org/installation.html#cors
Which essentially just means to run this from your venv command line:
pip install superset[cors]
And to add the following line to your superset_config.py:
ENABLE_CORS = True
Notice: this issue has been closed because it has been inactive for 289 days. Feel free to comment and request for this issue to be reopened.
+1 Can we reopen the issue of exposing Superset resources via API? How do external applications authenticate requests for superset resources?
activet