瀏覽代碼

[api] Simplify API and remove /iam prefix

Romain Rigaux 4 年之前
父節點
當前提交
a25b04f47b

+ 2 - 2
desktop/core/src/desktop/api_public_urls.py

@@ -35,8 +35,8 @@ urlpatterns = [
 # Compatibility with "old" private API.
 # e.g. https://demo.gethue.com/notebook/api/execute/hive
 urlpatterns += [
-  re_path(r'^iam/get_config/?$', api_public.get_config),
-  re_path(r'^iam/get_namespaces/(?P<interface>[\w\-]+)/?$', api_public.get_context_namespaces),  # To remove
+  re_path(r'^get_config/?$', api_public.get_config),
+  re_path(r'^get_namespaces/(?P<interface>[\w\-]+)/?$', api_public.get_context_namespaces),  # To remove
 
   re_path(r'^editor/create_notebook/?$', api_public.create_notebook, name='api_create_notebook'),
   re_path(r'^editor/create_session/?$', api_public.create_session, name='api_create_session'),

+ 1 - 1
desktop/core/src/desktop/js/api/urls.js

@@ -21,7 +21,7 @@ export const EXECUTE_API_PREFIX = '/notebook/api/execute/';
 export const DOCUMENTS_API = '/desktop/api2/doc/';
 export const DOCUMENTS_SEARCH_API = '/desktop/api2/docs/';
 export const GET_HUE_CONFIG_API = '/desktop/api2/get_hue_config';
-export const FETCH_CONFIG_API = '/api/iam/get_config/';
+export const FETCH_CONFIG_API = '/api/get_config/';
 export const FETCH_CONFIG_API_PRIVATE = '/desktop/api2/get_config/';
 export const HDFS_API_PREFIX = '/filebrowser/view=' + encodeURIComponent('/');
 export const ADLS_API_PREFIX = '/filebrowser/view=' + encodeURIComponent('adl:/');

+ 1 - 1
desktop/core/src/desktop/js/catalog/api.ts

@@ -195,7 +195,7 @@ export const fetchNamespaces = (
   connector: Connector,
   silenceErrors?: boolean
 ): CancellablePromise<Record<string, Namespace[]> & { dynamicClusters?: boolean }> =>
-  get(`/api/iam/get_namespaces/${connector.id}`, undefined, { silenceErrors });
+  get(`/api/get_namespaces/${connector.id}`, undefined, { silenceErrors });
 
 export const fetchNavigatorMetadata = ({
   entry,

+ 7 - 5
docs/docs-site/content/developer/api/rest/_index.md

@@ -110,9 +110,9 @@ It is possible to submit data in **JSON format**:
 
     -H "Content-Type: application/json" -d '{"username": "hue", "password": "hue"}'
 
-### Authentication
+### Authenticate
 
-Authenticating and getting a [JWT token](https://jwt.io/):
+Provide login credentials and get a [JWT token](https://jwt.io/):
 
     curl -X POST -d 'username=hue,password=hue' http://localhost:9000/api/token/
     {"refresh":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTYyMTcyNDYzMSwianRpIjoiOGM0NDRjYzRhN2VhNGMxZDliMGZhNmU1YzUyMjM1MjkiLCJ1c2VyX2lkIjoxfQ.t6t7_eYrNhpGN3-Jz5MDLXM8JtGP7V9Y9lacOTInqqQ","access":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjIxNjM4NTMxLCJqdGkiOiJhZjgwN2E0ZjBmZDI0ZWMxYWQ2NTUzZjEyMjIyYzU4YyIsInVzZXJfaWQiOjF9.dQ1P3hbzSytp9-o8bWlcOcwrdwRVy95M2Eolph92QMA"}
@@ -130,13 +130,15 @@ Authenticating and getting a [JWT token](https://jwt.io/):
 
 ### Execute a Query
 
-Now that we are logged-in, here is how to execute a `SHOW TABLES` SQL query via the `hive` connector. You could repeat the steps with any query you want, e.g. `SELECT * FROM web_logs LIMIT 100`.
+Now that we are authenticated, here is how to execute a `SHOW TABLES` SQL query via the `hive` connector. You could repeat the steps with any query you want, e.g. `SELECT * FROM web_logs LIMIT 100`.
 
-Until Editor v2 is out [HUE-8768](https://issues.cloudera.org/browse/HUE-8768), the API is pretty complicated but still functional:
+- **hive** represent either the dialect name and will select the connector to the only Hive databases.
+- **hive-1**
+- **1**
 
 For a `SHOW TABLES`, first we send the query statement:
 
-    curl -X POST https://demo.gethue.com/notebook/api/execute/hive --data 'executable={"statement":"SHOW TABLES","database":"default"}&notebook={"type":"query","snippets":[{"id":1,"statement_raw":"SHOW TABLES","type":"hive","variables":[]}],"name":"","isSaved":false,"sessions":[]}&snippet={"id":1,"type":"hive","result":{},"statement":"SHOW TABLES","properties":{}}'
+    curl -X POST http://localhost:9000/api/editor/execute/hive --data 'statement=SHOW TABLES'
 
     {"status": 0, "history_id": 17880, "handle": {"statement_id": 0, "session_type": "hive", "has_more_statements": false, "guid": "EUI32vrfTkSOBXET6Eaa+A==\n", "previous_statement_hash": "3070952e55d733fb5bef249277fb8674989e40b6f86c5cc8b39cc415", "log_context": null, "statements_count": 1, "end": {"column": 10, "row": 0}, "session_id": 63, "start": {"column": 0, "row": 0}, "secret": "RuiF0LEkRn+Yok/gjXWSqg==\n", "has_result_set": true, "session_guid": "c845bb7688dca140:859a5024fb284ba2", "statement": "SHOW TABLES", "operation_type": 0, "modified_row_count": null}, "history_uuid": "63ce87ba-ca0f-4653-8aeb-e9f5c1781b78"}
 

文件差異過大導致無法顯示
+ 0 - 0
docs/docs-site/static/js/gethue/components/SqlScratchpadWebComponent.js


部分文件因文件數量過多而無法顯示