Hi Dennis,

a new endpoint for this was recently introduced: /api/v1/chart/data, which is 
working pretty well on master branch. The documentation is still pretty slim on 
how to use it, but to get started, I suggest checking out 
http://localhost:9000/swaggerview/v1 <http://localhost:9000/swaggerview/v1> (or 
which ever hostname/port you’re running on). There was recently a PR that added 
fairly comprehensive OpenAPI specs to the chart data endpoint, do check that 
out, too: https://github.com/apache/incubator-superset/pull/9556 
<https://github.com/apache/incubator-superset/pull/9556>. As long as you’re 
logged in and have set "WTF_CSRF_ENABLED = False” on superset_config.py, you 
should be able to interact with the endpoints via the Swagger UI. Below is an 
example that retrieves data similar to the Word Cloud chart in the USA Birth 
Names example dashboard, and calculates some aggregates for boy/girl names 
using the new post processing operations feature. For more help, feel free to 
reach out on Slack.

Hope this helps,

Ville


{
  "datasource": {
    "id": 3,
    "type": "table"
  },
  "force": true,
  "queries": [
    {
      "groupby": [
        "name",
        "gender"
      ],
      "metrics": [
        {
          "label": "sum__num"
        },
        {
          "label": "count"
        }
      ],
      "filters": [
        {
          "col": "gender",
          "op": "IN",
          "val": [
            "boy",
            "girl"
          ]
        }
      ],
      "post_processing": [
        {
          "operation": "aggregate",
          "options": {
            "groupby": [
              "gender"
            ],
            "aggregates": {
              "10th_percentile": {
                "operator": "percentile",
                "column": "sum__num",
                "options": {
                  "q": 10
                }
              },
              "median": {
                "operator": "median",
                "column": "sum__num"
              },
              "average": {
                "operator": "mean",
                "column": "sum__num"
              },
              "unique_names": {
                "operator": "sum",
                "column": "count"
              }
            }
          }
        }
      ]
    }
  ]
}

> On 11. May 2020, at 10.44, Dennis Meyer <den...@jdeluxe.org> wrote:
> 
> Hi,
> 
> Is there an easy way to get data via an API call?
> Idea would be to access data from existing charts in machine readable 
> JSON/CSV/… and potentially pass over the parameters (like from , to and e.g. 
> a product filter).
> 
> I of course can see the calls the browser does, but it’s very UI oriented. Is 
> there a special HTTP/header parameter that will result in a plain result?
> 
> Thanks very much,
> Dennis

Attachment: smime.p7s
Description: S/MIME cryptographic signature

  • API Dennis Meyer
    • Re: API Ville Brofeldt

Reply via email to