upfrontsoftware / izinto-angular

0 stars 0 forks source link

Add HTTP data source #230

Open rochecompaan opened 3 years ago

rochecompaan commented 3 years ago

Add HTTP as a new type of data source.

When "HTTP" is selected as "Type", allow the user to specify the request config in a text area using the Axios request config syntax: https://www.npmjs.com/package/axios#request-config

This would enable access to almost any HTTP based API.

On the server-side, map the args in the syntax to the parameters documents in the requests library: https://requests.readthedocs.io/en/latest/api/#main-interface.

It might not be possible to map all the Axios config options to Python's request library. We should try to at least map the ones that are most important for API access.

Have a look at the following APIs to make sure that your mapping covers the URL and auth syntax:

nvernooy commented 3 years ago

Added request config to HTTP data sources instead of the usual parameters

image

Using this request config works for queries from izinto aggregations

{
        "url": "http://35.187.32.42:8086/query",
        "params": {"database": "izinto_aggregations"},
        "auth": {
             "username": "upfrontsoftware",
             "password": "keHZZEd3L8nkXJvK"
         },
        "headers": {"Content-type": "application/x-www-form-urlencoded", "Accept": "application/json", "Accept-Encoding": "gzip"}
}