创建分享

接口描述

在指定对象上创建分享对象,通过该分享对象可以访问指定对象的数据,返回share实例

请求URI

/share/:ref_type/:ref_id

HTTP Method

POST

参数说明

参数名称 是否必填 参数说明
ref_type true 来源类型,可为空,共四类:table(表格), item(数据)
ref_id true 来源ID
expired false 分享的过期时间,不传则永不过期
scope true 分享数据范围,参考share实例

响应结果说明

名称 说明

请求示例

POST /v2/share/:ref_type/:ref_id HTTP/1.1
Host: api.huoban.com
Content-Type: application/json
Authorization: Bearer {YOUR ACCESS TOKEN}

{
  "expired": 86400,
  "scope": {
    "where": {
      "and": [
        {
          "field": 1300,
          "query": {
            "eq": 200
          }
        }
      ]
    },
    "fields": {
      "view": {
        "is_all": true,
        "fields": []
      },
      "update": {
        "is_all": false,
        "fields": [
          11001,
          11002
        ]
      }
    }
  }
}

响应示例

HTTP/1.1 200 OK
Content-Type: application/json

{
  "share_id": 6000,
  "secret": "ruwlkjf123123u1oiou31pajffa",
  "scope": {
    "where": {
      "and": [
        {
          "field": 1300,
          "query": {
            "eq": 200
          }
        }
      ]
    },
    "fields": {
      "view": {
        "is_all": true,
        "fields": []
      },
      "update": {
        "is_all": false,
        "fields": [
          11001,
          11002
        ]
      }
    }
  },
  "bound_user_id": 1200,
  "created_by": {
    "user_id": 3000,
    "name": "名字",
    "avatar": "http:\/\/f2.huoban.com\/30000\/user_avatar\/40000\/xxx"
  },
  "ref_id": 5000,
  "ref_type": "table",
  "app_id": 4500,
  "expired_on": 1400000000,
  "created_on": "2016-08-24 20:00:00",
  "updated_on": "2016-08-24 20:00:00"
}



获取分享列表

接口描述

获取指定对象上的分享实例,如果是指定应用登录请求,则返回该应用下的分享,非管理员用户无法获取其他成员的分享信息,返回share实例集合

请求URI

/share/:ref_type/:ref_id

HTTP Method

GET

参数说明

参数名称 是否必填 参数说明
ref_type true 来源类型,可为空,共四类:table(表格), item(数据)
ref_id true 来源ID
bound_user_id false 绑定指定用户ID
limit false 返回数量限制,默认值为20
offset false 返回起始偏移量,默认值为0

响应结果说明

名称 说明

请求示例

GET /v2/share/:ref_type/:ref_id?bound_user_id=11002&offset=0&limit=20 HTTP/1.1
Host: api.huoban.com
Content-Type: application/json
Authorization: Bearer {YOUR ACCESS TOKEN}

响应示例

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "share_id": 6000,
    "secret": "ruwlkjf123123u1oiou31pajffa",
    "scope": {
      "where": {
        "and": [
          {
            "field": 1300,
            "query": {
              "eq": 200
            }
          }
        ]
      },
      "fields": {
        "view": {
          "is_all": true,
          "fields": []
        },
        "update": {
          "is_all": false,
          "fields": [
            11001,
            11002
          ]
        }
      }
    },
    "bound_user_id": 1200,
    "created_by": {
      "user_id": 3000,
      "name": "名字",
      "avatar": "http:\/\/f2.huoban.com\/30000\/user_avatar\/40000\/xxx"
    },
    "ref_id": 5000,
    "ref_type": "table",
    "app_id": 4500,
    "expired_on": 1400000000,
    "created_on": "2016-08-24 20:00:00",
    "updated_on": "2016-08-24 20:00:00"
  },
  {
    "share_id": 6001,
    "secret": "ruwlkjf123123u1oiou31pajffa",
    "scope": {
      "where": {
        "and": [
          {
            "field": 1300,
            "query": {
              "eq": 200
            }
          }
        ]
      },
      "fields": {
        "view": {
          "is_all": true,
          "fields": []
        },
        "update": {
          "is_all": false,
          "fields": [
            11001,
            11002
          ]
        }
      }
    },
    "bound_user_id": 1200,
    "created_by": {
      "user_id": 3000,
      "name": "名字",
      "avatar": "http:\/\/f2.huoban.com\/30000\/user_avatar\/40000\/xxx"
    },
    "ref_id": 5000,
    "ref_type": "table",
    "app_id": 4500,
    "expired_on": 1400000000,
    "created_on": "2016-08-24 20:00:00",
    "updated_on": "2016-08-24 20:00:00"
  }
]