菜单

概览管理 API

本文的 API 针对的是概览中「我的概览」


增加数据概览

[POST /dashboards]

  • Request (application/json)

    示例展示
    {
    "name": "转化漏斗分析",
    "is_public": 0 // 0表示仅自己可见,1表示所有用户可见
    }
  • Response 200 (application/json)

    示例展示
    {
    "id": 2 // dashboard id
    }

删除数据概览

[DELETE /dashboards/{dashboardId}]

  • Response 200

    {}
  • 使用 curl 示例

    // $ID 为对应概览的 id,可由下面获取所有概览的 API 接口获取
    curl 'https://golddemo.cloud.sensorsdata.cn/api/dashboards/$ID?token=53f48d27f5ed6e701241d7548093274533d0af3d9d2ae80740a629836897900d&project=default'

获取所有数据概览

[GET /dashboards]

  •  Response 200 (application/json)

    示例展示
    [
    {
    "id": 1,
    "name": "营销数据分析",
    "create_time": "2015-11-04 16:34:33",
    "user_id": 1,
    "is_default": 0,
    "is_public": 1,
    "username": "admin",
    "project_id": 1,
    "config": "{\"widgetTime\":\"0 week\",\"widgetUnit\":\"minute\"}"
    },
    {
    "id": 3,
    "name": "产品黏性分析",
    "create_time": "2015-11-04 17:38:29",
    "user_id": 1,
    "is_default": 0,
    "is_public": 1,
    "username": "admin",
    "project_id": 1
    }
    ]

获取某个数据概览的详情

[GET /dashboards/{dashboardId}]

  •  Response 200 (application/json)

    示例展示
    {
    "id": 1,
    "name": "营销数据分析",
    "create_time": "2015-11-04 16:34:33",
    "user_id": 1,
    "is_default": 0,
    "is_public": 1,
    "username": "admin",
    "items": [
    {
    "bookmark": {
    "id": 1,
    "type": "/segmentation/",
    "name": "每天不同渠道带来的用户量",
    "data": "{\"measures\":[{\"event_name\":\"views\",\"aggregator\":\"unique\"}],\"unit\":\"day\",\"by_fields\":[\"user.first_visit_channel\"],\"chartsType\":\"line\",\"sampling_factor\":64,\"from_date\":\"2016-06-20\",\"to_date\":\"2016-06-26\",\"bookmarkid\":\"1\",\"bookmarktime\":\"7 day\",\"rollup_date\":\"false\",\"filter\":{}}",
    "time": "7 day",
    "create_time": "2015-11-04 04:35:44",
    "user_id": 1,
    "dashboards": [ ],
    "related_events": [
    "views"
    ],
    "project_id": 1
    },
    "config": "{\"widgetIndex\":2,\"widgetByValues\":[\"百度\",\"36kr\",\"今日头条\"],\"widgetType\":\"column\",\"widgetTime\":\"7 day\",\"widgetUnit\":\"day\",\"widgetRememberType\":{\"unit\":\"column\"}}",
    "bookmark_id": 0
    },
    {
    "bookmark": {
    "id": 183,
    "type": "/segmentation/",
    "name": "每天不同渠道提交线索量",
    "data": "{\"measures\":[{\"event_name\":\"applies\",\"aggregator\":\"unique\"}],\"unit\":\"month\",\"by_fields\":[\"user.first_visit_channel\"],\"chartsType\":\"line\",\"sampling_factor\":64,\"from_date\":\"2016-01-01\",\"to_date\":\"2016-06-20\",\"filter\":{}}",
    "time": "7 day",
    "create_time": "2016-06-27 07:24:23",
    "user_id": 1,
    "dashboards": [ ],
    "related_events": [
    "applies"
    ],
    "project_id": 1
    },
    "config": "{\"widgetIndex\":3,\"widgetByValues\":[\"百度\",\"36kr\",\"今日头条\"],\"widgetType\":\"line\",\"widgetTime\":\"7 day\",\"widgetUnit\":\"day\",\"widgetRememberType\":{\"unit\":\"line\"}}",
    "bookmark_id": 0
    }
    ],
    "project_id": 1,
    "config": "{\"widgetTime\":\"0 week\",\"widgetUnit\":\"minute\"}"
    }

保存书签到数据概览

[POST /bookmarks/bookmark]

保存书签到数据概览时,书签类型可以是事件分析,漏斗分析,留存分析,分布分析,对应的 type 分别是 /segmentation/, /funnel/, /retention/, /addiction/。data 是对应的 request,request 写法参考第三节。

  • Request (application/json)

    示例展示
    {
    "related_events": [
    "Share"
    ],
    "name": "分享的总次数", // 书签名称
    "dashboards": [
    2 // 数据概览的id
    ],
    "type": "/segmentation/",
    "data": "{\"measures\":[{\"event_name\":\"Share\",\"aggregator\":\"general\"}],\"unit\":\"day\",\"chartsType\":\"line\",\"sampling_factor\":64,\"rangeText\":\"本周\",\"from_date\":\"2016-10-17\",\"to_date\":\"2016-10-20\",\"filter\":{}}"
    }
  • Response 200 (application/json)

    示例展示
    {
    "id": 1 //书签id
    }

获取书签配置

[GET /bookmarks/bookmark/{bookmarkId}]

书签配置包括类型、名称和具体的查询条件。

  • Response 200 (application/json)

    示例展示
    {
    "related_events": [
    "Share"
    ],
    "name": "分享的总次数",
    "dashboards": [
    2
    ],
    "type": "/segmentation/",
    "data": "{\"measures\":[{\"event_name\":\"Share\",\"aggregator\":\"general\"}],\"unit\":\"day\",\"chartsType\":\"line\",\"sampling_factor\":64,\"rangeText\":\"本周\",\"from_date\":\"2016-10-17\",\"to_date\":\"2016-10-20\",\"filter\":{}}"
    }

删除一个数据概览中的书签

[DELETE /bookmarks/bookmark/{bookmarkId}]

  • Response 200

    {}
上一个
元数据管理 API
下一个
渠道管理API
最近修改: 2024-12-27