NAV Navbar
http

Linkflow开放接口指南

目前Linkflow开放平台只支持私有App的对接,通过私有App可以获取客户在Linkflow系统中的联系人信息、联系人渠道信息以及联系人的事件信息。

私有App是客户在Linkflow系统中为本租户创建的专属App,只有该租户可见。在客户创建完私有App之后,系统会为该App生成App Key和App Secret,开发者拿到App Key和App Secret之后,就可以获取Access Token,之后就可以访问Linkflow系统,获取需要的业务数据。

Private App

创建Private App

通过创建私有App获取 App Key 和 App Secret

登录Linkflow系统之后,进入菜单“设置”-》“App集成设置”-》“私有App设置”,然后点击右上角的按钮“创建私有App”,在弹出窗口中填写“App名字”和“App描述”,最后点击右下角的“保存”按钮,系统就会在当前弹出窗口生成App Key和App Secret。

通过App Key和App Secret获取Access Token

在获取App Key和App Secret之后,就可以来获取Access Token来访问Linkflow的资源了,具体访问方式如下:

GET /token HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Key: 创建私有App取得的App Key
X-OpenApi-Secret: 创建私有App取得的App Secret
HTTP/1.1 200 OK
Content-Type: application/json

{
    "expiration": "2017-09-04 09:30:23",
    "token": "Mi03Y2IxNjNkMC05YWFjLTQ5NmYtOWE3OS01NjU3ZWRjMmQwNzk="
}

HTTP Request

GET https://open.linkflowtech.com/token

Headers

Parameter Description
X-OpenApi-Key 创建私有App取得的App Key
X-OpenApi-Secret 创建私有App取得的App Secret

联系人

获取联系人列表

GET /contacts?size=1&page=0&groupId=1&search=13774202819 HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回一个JSON数组,里面包含了所有符合条件的联系人,示例如下

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

[
    {
        "anonymousId": null,
        "name": "peter pan",
        "nickname": null,
        "gender": "unknown",
        "dateOfBirthday": null,
        "avatar": null,
        "mobilePhone": "13774202819",
        "homePhone": null,
        "email": null,
        "country": null,
        "state": null,
        "street": null,
        "city": null,
        "postalCode": null,
        "comments": null,
        "userName": null,
        "title": null,
        "website": null,
        "company": null,
        "industry": null,
        "department": null,
        "idCard": null,
        "utm": {
            "source": "source",
            "campaign": "campaign",
            "medium": "medium",
            "content": "content",
            "term": "term"
        },
        "props": {
            "attr1": "单身",
            "attr2": 10000
        },
        "isAnonymous": false,
        "id": 2865,
        "dateCreated": "2017-08-22 13:50:51",
        "lastUpdated": "2017-08-22 13:50:51"
    }
]

HTTP Request

GET https://open.linkflowtech.com/contacts

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Querystring parameters

Parameter Required Default Type Description
page false 0 Integer 第几页,从0开始
size false 200 Integer 每页条数
groupId fasle Integer 联系人所在的组,不填写默认为所有人这个组
search false String 搜索关键词

识别联系人

用途是创建或者更新联系人信息。

识别联系人时需要指定渠道信息,即表示该联系人是从某个渠道被创建或被识别,联系人的externalId是关键信息,用于打通通过埋点获取的信息与通过API导入的信息。

以一个电商网站(example.com)为例,电商网站本身使用Linkflow的网页埋点系统获取客户行为数据(具体可阅读JS SDK一节),同时又需要通过API向Linkflow同步订单数据。为了打通在该电商网站的客户数据,无论是埋点还是API导入,都会使用相同的externalIdchannelId用于标识该电商网站的一个客户。

channel参数包含了渠道信息,该接口一般用于打通网站埋点数据与后台API导入数据

weChatInfo参数包含了微信渠道信息, 用于打通微信与其他渠道数据

POST /identifiers HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

请求示例如下:

{
    "externalId": "u1234567", //应该与网页埋点中调用jssdk的identify的externalId一致
    "channel": {
        "channelId": "example.com" // 与Linkflow“连接管理”里查看某个连接的channelId一样。对于自定义连接,channelId可以手动输入、或系统随机生成
    },
    "name": "张三", // 以下是联系人相关信息,均为可选参数
    "nickname",
    "avatar",
    "comments",
    "dateOfBirthday": "1988-10-02 00:00:00",
    "mobilePhone": "13912341234",
    "email": "zhangsan@example.com",
    "country": "中国",
    "state": "上海",
    "city": "上海",
    "title": "Manager",
    "company": "ABC",
    "industry": "医疗",
    "department": "Marketing",
    "gender": "male",
    "homePhone": "02522585858",
    "companyShortName": "shortName",
    "utm": { // 如果是创建新的联系人,则创建来源/活动/媒介/内容/关键字等UTM参数会写入该联系人属性;如果是更新联系人,虽然返回成功,但UTM参数也不会被写入该联系人。
        "source": "source",
        "campaign": "campaign",
        "medium": "medium",
        "content": "content",
        "term": "term"
    },
    "props": {
        "attr1": "单身",
        "attr2": 10000
    },
    "weChatInfo": { //weChatInfo为可选参数
        "appId": "wx0000000000",
        "appName": "测试公众号",
        "openId": "openId0000000000",
        "unionId": "unionId0000000000"
    }
}

在提交请求之后,系统会返回更新后的联系人信息,示例如下,结构与获取联系人列表中的单个联系人一致。

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

{
    "id": 83,
    "dateCreated": "2017-08-04 17:54:10",
    "lastUpdated": "2018-05-10 16:22:57",
    "ver": 5,
    "anonymousId": null,
    "name": "张三",
    "nickname": ,
    "gender": "unknown",
    "dateOfBirthday": "1988-10-02 00:00:00",
    "avatar": null,
    "profilePhoto": null,
    "mobilePhone": "13912341234",
    "props": {
        "attr1": "单身",
        "attr2": 10000
    }
    ...
}

HTTP Request

POST https://open.linkflowtech.com/identifiers

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Querystring parameters

Parameter Required Default Type Description
externalId true - String 系统外唯一标识
channel.channelId true - String 渠道唯一标识
channel.name false - String 渠道名称,可不填,如填写会做更新处理
name false - String 姓名
nickname false - String 昵称
avatar false - String 头像url
comments false - String 备注
dateOfBirthday false - String 生日,格式 yyyy-MM-dd HH:mm:ss
mobilePhone false - String 手机号
email false - String 邮箱
country false - String 国家
state false - String 省份
city false - String 城市
title false - String 职务
company false - String 公司
industry false - String 行业
department false - String 部门
street false - String 地址
postalCode false - String 邮编
website false - String 网址
idCard false - String 身份证
gender false - String 只可为female,male,unknown
homePhone false - String 座机
companyShortName false - String 公司简称
utm.source false - String 创建来源
utm.campaign false - String 创建活动
utm.medium false - String 创建媒介
utm.content false - String 创建内容
utm.term false - String 创建关键字
props false - Object 自定义字段, key为元数据中配置的alias,value为值
weChatInfo.appId false - String 微信公众号appid
weChatInfo.appName false - String 微信公众号名称
weChatInfo.openId false - String 微信用户openId
weChatInfo.unionId false - String 微信用户unionId

获取联系人自定义字段元数据 (Deprecated)

请使用新接口,此接口保留三个月

GET /contacts/meta/userfields HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回一个JSON数组,里面包含了所有当前租户已创建的自定义字段,示例如下

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

[
    {
        "id": 1,
        "type": "text",
        "name": "婚姻状态",
        "col": "attr1"
    },
    {
        "id": 2,
        "type": "number",
        "name": "薪水",
        "col": "attr2"
    }
]

HTTP Request

GET https://open.linkflowtech.com/contacts/meta/userfields

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

获取联系人自定义字段元数据

第三方通过该接口,查询租户已创建的自定义字段。 在Linkflow中,联系人有自己的基础属性,如:姓名、邮箱、手机、城市等, 如果基础属性不能满足您的业务需求,您可以在Linkflow里面创建自定义字段, 并通过此接口,获取每个自定义属性对应的attr编号。

GET /v2/contacts/meta/properties HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回一个JSON数组,里面包含了所有当前租户已创建的自定义字段,示例如下

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

[
    {
        "label": "婚姻状态",
        "alias": "attr1",
        "dataType": "text",
        "id": 31
    },
    {
        "label": "薪水",
        "alias": "attr2",
        "dataType": "number",
        "id": 32
    }
]

HTTP Request

GET https://open.linkflowtech.com/v2/contacts/meta/properties

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

获取联系人详情

第三方通过该接口,通过手机号码、邮箱、(两个字段必须至少填写一个)精准查询符合特定条件的联系人列表。

GET /v2/contacts?email=test@nazaio.com&mobilePhone=13888888888&needOpenId=1 HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回一个JSON数组,里面包含了所有符合条件的联系人,示例如下

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

[
    {
        "id": 1,
        "dateCreated": "2017-07-19 20:00:57",
        "lastUpdated": "2017-08-04 12:00:00",
        "ver": null,
        "anonymousId": null,
        "name": "康熙",
        "nickname": "康熙",
        "gender": "male",
        "dateOfBirthday": "1991-11-11 00:00:00",
        "avatar": null,
        "profilePhoto": null,
        "mobilePhone": "13888888888",
        "homePhone": "025-83729999",
        "email": "test@nazaio.com",
        "country": "中国",
        "state": "江苏",
        "street": "雨花",
        "city": "南京",
        "postalCode": "210000",
        "comments": "备注",
        "userName": null,
        "title": "java",
        "website": "https://www.linkflowtech.com/",
        "company": "上海源犀信息科技有限公司",
        "industry": "IT",
        "department": "研发",
        "idCard": null,
        "utm": {
            "source": "source",
            "campaign": "campaign",
            "medium": "medium",
            "content": "content",
            "term": "term"
        },
        "props": {
            "attr1": "单身",
            "attr2": 10000
        },
        "isAnonymous": false,
        "openIds": [
            {
                "channelId": "wx5a39a02868a39999",
                "channelName": "渠道名称A",
                "openId": "olbUb0gzPm0Z1eDkEhvq_Ieoqfa"
            },
            {
                "channelId": "wxaceb2577e5f99999",
                "channelName": "渠道名称B",
                "openId": "olbUb0gzPm0Z1eDkEhvq_NaWOzSc"
            }
        ]
    }
]

HTTP Request

GET https://open.linkflowtech.com/v2/contacts

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Querystring parameters

Parameter Required Default Type Description
email true - String 电子邮箱(电子邮箱和手机号两个字段至少填写一个)
mobilePhone true - String 手机号(电子邮箱和手机号两个字段至少填写一个)
needOpenId false - String 是否获取联系人的openid。1为获取,不填则默认为不需要获取。

Error Code

HTTP Status Code Parameter Description
500 B00030 电子邮箱和手机号两个字段至少存在一个

批量获取联系人详情

第三方通过该接口,通过联系人contactId列表获取联系人详情数据。最多支持一次拉取100条。

GET /v2/contacts_bulk?ids=1,3,5,7,8&needOpenId=1 HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回一个JSON数组,里面包含了所有符合条件的联系人,示例如下

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

[
    {
        "id": 1,
        "dateCreated": "2017-07-19 20:00:57",
        "lastUpdated": "2017-08-04 12:00:00",
        "ver": null,
        "anonymousId": null,
        "name": "康熙",
        "nickname": "康熙",
        "gender": "male",
        "dateOfBirthday": "1991-11-11 00:00:00",
        "avatar": null,
        "profilePhoto": null,
        "mobilePhone": "13888888888",
        "homePhone": "025-83729999",
        "email": "test@nazaio.com",
        "country": "中国",
        "state": "江苏",
        "street": "雨花",
        "city": "南京",
        "postalCode": "210000",
        "comments": "备注",
        "userName": null,
        "title": "java",
        "website": "https://www.linkflowtech.com/",
        "company": "上海源犀信息科技有限公司",
        "industry": "IT",
        "department": "研发",
        "idCard": null,
        "utm": {
            "source": "source",
            "campaign": "campaign",
            "medium": "medium",
            "content": "content",
            "term": "term"
        },
        "props": {
            "attr1": "单身",
            "attr2": 10000
        },
        "isAnonymous": false,
        "openIds": [
            {
                "channelId": "wx5a39a02868a39999",
                "channelName": "渠道名称A",
                "openId": "olbUb0gzPm0Z1eDkEhvq_Ieoqfa"
            },
            {
                "channelId": "wxaceb2577e5f99999",
                "channelName": "渠道名称B",
                "openId": "olbUb0gzPm0Z1eDkEhvq_NaWOzSc"
            }
        ]
    },
    {
        "id": 3,
        "dateCreated": "2017-03-29 16:16:57",
        "lastUpdated": "2017-03-29 16:16:57",
        "ver": null,
        "anonymousId": "olbUb0gzPm0Z1eDkEhvq_NaWOzSc",
        "name": "Kyle Lee",
        "nickname": "Kyle Lee",
        "gender": "male",
        "dateOfBirthday": null,
        "avatar": "http://wx.qlogo.cn/mmopen/UOlZKghBxaY81Ynib8fuQyRIJpyJQpIuGNONH6DLicqOdE8uskPI8KYbn1aUdnA0kPkhCfVV4m80c1z6Lh9bmu7w/0",
        "profilePhoto": null,
        "mobilePhone": null,
        "homePhone": null,
        "email": "bb@nazaio.com",
        "country": "中国",
        "state": "广东",
        "street": null,
        "city": "广州",
        "postalCode": null,
        "comments": "",
        "userName": null,
        "title": null,
        "website": null,
        "company": null,
        "industry": null,
        "department": null,
        "idCard": null,
        "utm": {
            "source": "source",
            "campaign": "campaign",
            "medium": "medium",
            "content": "content",
            "term": "term"
        },
        "props": {
            "attr1": "已婚",
            "attr2": 18000
        },
        "isAnonymous": false,
        "openIds": [
            {
                "channelId": "wx5a39a02868a39316",
                "channelName": "打头哇万",
                "openId": "olbUb0gzPm0Z1eDkEhvq_111"
            },
            {
                "channelId": "wxaceb2577e5f98632",
                "channelName": "联否Linkflow",
                "openId": "olbUb0gzPm0Z1eDkEhvq_NaWOzSc"
            }
        ]
    },
    {
        "id": 5,
        "dateCreated": "2017-03-29 22:37:22",
        "lastUpdated": "2017-03-29 22:37:22",
        "ver": null,
        "anonymousId": "olbUb0q01JkL55FwJxVpuA1f3suk",
        "name": "Alpha",
        "nickname": "Alpha",
        "gender": "male",
        "dateOfBirthday": null,
        "avatar": "http://wx.qlogo.cn/mmopen/PiajxSqBRaEKZJSIIapCZUPDAG7quD6y3WkvTVlMLibTHlYaV6IuiaeEaw3Se5DraR73bXN0PGUia8kekibmDgdkVHw/0",
        "profilePhoto": null,
        "mobilePhone": null,
        "homePhone": null,
        "email": "cc@nazaio.com",
        "country": "中国",
        "state": "江苏",
        "street": null,
        "city": "南京",
        "postalCode": null,
        "comments": "",
        "userName": null,
        "title": null,
        "website": null,
        "company": null,
        "industry": null,
        "department": null,
        "idCard": null,
        "utm": {
            "source": "source",
            "campaign": "campaign",
            "medium": "medium",
            "content": "content",
            "term": "term"
        },
        "props": {
            "attr1": "已婚",
            "attr2": 20000
        },
        "isAnonymous": false,
        "openIds": [
            {
                "channelId": "wxaceb2577e5f0000",
                "channelName": "渠道名称A",
                "openId": "olbUb0q01JkL55FwJxVpuA1f3suk"
            }
        ]
    }
]

HTTP Request

GET https://open.linkflowtech.com/v2/contacts_bulk

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Querystring parameters

Parameter Required Default Type Description
ids true - List 联系人id数组,每次传入的id个数不能超过100个,如超过则只取前100个id的数据
needOpenId false - String 是否获取联系人的openid。1为获取,不填则默认为不需要获取。

批量获取联系人ID

第三方通过该接口,按照更新时间查询符合特定条件的联系人ID列表。

GET /v2/contacts_bulk/ids?page=0&size=5&minUpdateTime=2017-01-01&maxUpdateTime=2018-01-01 HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回一个符合条件的联系人ID数组,示例如下

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

[
    1,
    3,
    5,
    7,
    8
]

HTTP Request

GET https://open.linkflowtech.com/v2/contacts_bulk/ids

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Querystring parameters

Parameter Required Default Type Description
page true - number 第几页,从0开始
size true - number 每页条数 注:page*size<=10000
maxUpdateTime false - datetime 最大更新时间, 示例:2018-01-01
minUpdateTime false - datetime 最小更新时间, 示例:2018-01-01
anonymous false 0 number -1:全量;0:实名;1:匿名

Error Code

HTTP Status Code Parameter Description
500 B00030 page*size必须小于等于10000

更新联系人

第三方通过该接口,通过联系人id,更新联系人信息。

PUT /v2/contacts/1 HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

请求示例如下:

{
    "id": 1,
    "name": "康熙",
    "nickname": "康熙",
    "gender": "male",
    "dateOfBirthday": "1991-11-11 00:00:00",
    "avatar": null,
    "mobilePhone": "13888888888",
    "homePhone": "025-83729999",
    "email": "test@nazaio.com",
    "country": "中国",
    "state": "江苏",
    "street": "雨花",
    "city": "南京",
    "postalCode": "210000",
    "comments": "备注",
    "userName": null,
    "title": "java",
    "website": "https://www.linkflowtech.com/",
    "company": "上海源犀信息科技有限公司",
    "industry": "IT",
    "department": "研发",
    "props": {
        "attr1": "单身",
        "attr2": 10000
    }
}

在提交请求之后,系统会返回更新后的联系人信息,示例如下,结构与获取联系人列表中的单个联系人一致。

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

{
    "id": 1,
    "dateCreated": "2017-08-04 17:54:10",
    "lastUpdated": "2018-05-10 16:22:57",
    "ver": 2,
    "anonymousId": null,
    "name": "康熙",
    "nickname": "康熙",
    "gender": "male",
    "dateOfBirthday": "1991-11-11 00:00:00",
    "avatar": null,
    "profilePhoto": null,
    "mobilePhone": "13888888888",
    "props": {
        "attr1": "单身",
        "attr2": 10000
    }
    ...
}

HTTP Request

PUT https://open.linkflowtech.com/v2/contacts/{contactId}

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Querystring parameters

Parameter Required Default Type Description
id true - Integer id
name false - String 姓名
avatar false - String 头像地址
gender false - String 性别(male/female/unknown)
mobilePhone false - String 手机号
userName false - String 用户名
nickname false - String 昵称
email false - String 邮箱
country false - String 国家
state false - String 省份
city false - String 城市
title false - String 职务
company false - String 公司
industry false - String 行业
department false - String 部门
comments false - String 备注
website false - String 网址
dateOfBirthday false - String 生日, 示例:1991-11-11 00:00:00
props false - Object 用户自定义字段,按照示例中的格式修改,修改联系人时,只取props中value中的数据

Error Code

HTTP Status Code Parameter Description
404 B00008 没有找到此ID的联系人

通过微信UnionId获取微信公众号OpenId

GET /v1/wx/wx1f7fbd28ac009cd0/user?unionId=ogtgm1A_UD5C8MJ3YR HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回一个JSON结构,示例如下

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

{
    "openId": "o0ZYI1ZKkYGLfdq",
    "unionId": "ogtgm1A_UD5C8MJ3YR",
    "status": true
}

HTTP Request

GET https://open.linkflowtech.com/v1/wx/{appId}/user

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Querystring parameters

Parameter Required Default Type Description
appId true - String 渠道Id
unionId true - String UnionId

根据联系人externalId获取联系人信息

GET /identifiers?externalId=ogtgm1HJ0m0Dk_Ges&channelId=wx1f7fbd28ac009cd0&channelType=WECHAT HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回一个JSON结构,示例如下

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

{
    "dateCreated": "2019-06-25 18:10:50",
    "lastUpdated": "2020-04-08 17:05:52",
    "ver": 50,
    "id": 19461,
    "anonymousId": "o0ZYI1Tx1WHnV06",
    "name": "小程序test",
    "nickname": "片叶",
    "gender": "male",
    "avatar": "http://thirdwx.qlogo.cn/mmopen/ukl",
    "mobilePhone": "13800000000",
    "email": "email",
    "country": "China",
    "state": "Jiangsu",
    "street": "",
    "city": "Nanjing",
    "comments": "test_wei",
    "website": "",
    "utm": {
        "source": "source",
        "campaign": "campaign",
        "medium": "medium",
        "content": "content"
    },
    "props": {
        "attr1": "单身",
        "attr2": 10000
    },
    "isAnonymous": false,
    "lastSeen": "2020-04-14 15:28:53",
    "lastTagged": "2019-11-18 23:24:59",
    "identified": "2019-06-25 18:10:50",
    "openIds": []
}

HTTP Request

GET https://open.linkflowtech.com/identifiers

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Querystring parameters

Parameter Required Default Type Description
externalId true - String externalId
channelId true - String 渠道账号
channelType true UDC String 渠道类型

通过externalid查询联系人标签

GET /v2/contacts/tags?externalId=ogtgm1HJ0m0Dk_Ges&channelId=wx1f7fbd28ac009cd0&channelType=WECHAT HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回一个JSON结构,示例如下

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

[
   {
     "tagId": 1,
     "tagName": "性别",
     "tagKey": "tag_yhxb",
     "value": "男"
     },
    {
     "tagId": 2,
     "tagName": "string",
     "tagKey": "string",
     "value": "string"
    }
]

HTTP Request

GET https://open.linkflowtech.com/v2/contacts/tags

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Querystring parameters

Parameter Required Default Type Description
externalId true - String externalId
channelId true - String 渠道账号
channelType true UDC String 渠道类型

渠道

创建自定义渠道

自定义渠道,channelTypeUDC,一般用于纯后台导入数据不需要数据打通的场景,如ERP,CRM的数据导入。

channelId如果不输入则由系统生成。

POST /udc HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

请求示例如下:

{
  "channelId": "udc_123", // 可选参数, 渠道唯一标识,在相同channelType的范围内全系统唯一
  "name": "UDC A"  // 渠道名称
}

在提交请求之后,系统会返回更新后的渠道信息

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

{
    "id": 83,
    "dateCreated": "2017-08-04 17:54:10",
    "lastUpdated": "2018-05-10 16:22:57",
    "channelId": "udc_123",
    "channelType": "UDC",
    "name": "UDC A"
}

HTTP Request

POST https://open.linkflowtech.com/udc

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Querystring parameters

Parameter Required Default Type Description
name true - String 渠道名称
channelId false - String 渠道唯一标识,如果不输入由系统生成

获取ChannelType列表

获取所有channelType。channelType-渠道类型是指一个App的类型, 比如微信服务号就是一种App的类型,对应的channelType为WECHAT; 又比如自定义渠道也是一种App的类型,对应的channelType为UDC。 在Linkflow里channelType+channelId可以确认一个渠道。

GET /channels/meta/types HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回一个JSON数组,里面包含了所有ChannelType,示例如下

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

[
    {
        "channelType": "LINK_FLOW",
        "channelTypeName": "联否"
    },
    {
        "channelType": "WECHAT",
        "channelTypeName": "微信"
    },
    {
        "channelType": "WORKWECHAT",
        "channelTypeName": "企业微信"
    },
    {
        "channelType": "SMS_YUN_PIAN",
        "channelTypeName": "云片网"
    },
    {
        "channelType": "WENJUANWANG",
        "channelTypeName": "问卷网"
    },
    {
        "channelType": "DINGTALK",
        "channelTypeName": "钉钉"
    },
    {
        "channelType": "SEND_CLOUD",
        "channelTypeName": "SendCloud"
    },
    {
        "channelType": "JINSHUJU",
        "channelTypeName": "金数据"
    },
    {
        "channelType": "PRIVATE_APP",
        "channelTypeName": "私有应用"
    },
    {
        "channelType": "SALESFORCE",
        "channelTypeName": "Salesforce"
    },
    {
        "channelType": "VHALL",
        "channelTypeName": "微吼"
    },
    {
        "channelType": "YOUZAN",
        "channelTypeName": "有赞"
    },
    {
        "channelType": "EXMAIL",
        "channelTypeName": "腾讯企业邮箱"
    },
    {
        "channelType": "DUMMY",
        "channelTypeName": "DUMMY"
    },
    {
        "channelType": "FENXIANGXIAOKE",
        "channelTypeName": "纷享销客"
    },
    {
        "channelType": "SMS_TENCENT",
        "channelTypeName": "腾讯短信"
    },
    {
        "channelType": "GENSEE",
        "channelTypeName": "展视互动"
    },
    {
        "channelType": "AIKE",
        "channelTypeName": "爱客"
    },
    {
        "channelType": "HUODONGXING",
        "channelTypeName": "活动行"
    },
    {
        "channelType": "WEIMOB",
        "channelTypeName": "微盟"
    },
    {
        "channelType": "QLCHAT",
        "channelTypeName": "千聊"
    },
    {
        "channelType": "MYSQL",
        "channelTypeName": "mysql"
    },
    {
        "channelType": "SQL_SERVER",
        "channelTypeName": "sqlserver"
    },
    {
        "channelType": "UDC",
        "channelTypeName": "user_defined_channel"
    }
]

HTTP Request

GET https://open.linkflowtech.com/channels/meta/types

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

联系人渠道帐号

获取联系人渠道帐号列表

GET /contacts/{id}/identities
HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回一个JSON数组,里面包含了该联系人的所有渠道账号信息,示例如下

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

[
    {
        "dateCreated": "2018-03-23 11:42:54",
        "lastUpdated": "2020-01-02 17:18:32",
        "ver": 25,
        "id": 4234,
        "contactId": 2995,
        "channelId": 174,
        "anonymousId": "o0ZYI1ZKkYGLfdqPIWcVlQ5XRoE4",
        "nickname": "张三",
        "isActive": true,
        "externalId": "ogtgm1A_UD5C8MJ3YRT0ZJ9LfV44",
        "channel": {
            "id": 174,
            "channelId": "wx1f7fbd28ac009cd0",
            "channelType": "WECHAT",
            "name": "ALPHA",
            "status": "ACTIVE"
        }
    },
    {
        "dateCreated": "2020-02-12 12:02:59",
        "lastUpdated": "2020-02-12 12:02:59",
        "ver": 1,
        "id": 656048,
        "contactId": 2995,
        "channelId": 416,
        "mobilePhone": "13645183960",
        "isActive": true,
        "externalId": "o0ZYI1ZKkYGLfdqPIWcVlQ5XRoE4",
        "channel": {
            "id": 416,
            "channelId": "udc_15PycxODaN",
            "channelType": "UDC",
            "name": "官网",
            "status": "ACTIVE"
        }
    }
]

HTTP Request

GET https://open.linkflowtech.com/contacts/{id}/identities

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Path Parameters

Parameter Required Default Type Description
id true - Integer 联系人ID

事件

创建自定义事件

POST /ude HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

{
    "event": "UDE_1MG2I6HGJ",
    "channelId": "example.com",
    "externalId": "abc123",
    "eventDate": 1509180345000,
    "attr1": "DD1232",
    "attr2": "200.00",
    "items":[
        {
            "event": "UDE_SUBITEM",
            "attr1": "item1"
        }
    ]
}

在提交请求之后,系统会返回一个已创建事件的结构,示例如下

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

{
    "externalId": "abc123",
    "channelId": "example.com",
    "event": "UDE_1MG2I6HGJ",
    "channelType": "UDC",
    "eventDate": 1509180345000,
    "attr1": "DD1232",
    "attr2": "200.00",
    "id": 902,
    "dateCreated": "2017-11-30 19:37:12",
    "lastUpdated": "2017-11-30 19:37:12",
    "ver": 1
}

HTTP Request

POST https://open.linkflowtech.com/ude

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Request parameters

Parameter Required Default Type Description
event true String 事件编码,在新建自定义事件的UI上可见
channelId true String 渠道ID,一般是网站的根域名
channelType false UDC String 渠道类型,默认是UDC
externalId true String 在本系统内用户的唯一标识,一般为用户id
eventDate true Long 时间戳精确到毫秒级别
items false Array 子事件列表,子事件只需要传event以及attr字段
attr1 false String 如该自定义事件设置了Attr1的字段含义那就需要在这里填值
attr2 false String 同上
attr3 false String 同上
attr4 false String 同上
attr5 false String 同上
attr6 false String 同上
attr7 false String 同上
attr8 false String 同上
attr9 false String 同上
attr10 false String 同上
attr11 false String 同上
attr12 false String 同上
attr13 false String 同上
attr14 false String 同上
attr15 false String 同上
attr16 false String 同上
attr17 false String 同上
attr18 false String 同上
attr19 false String 同上
attr20 false String 同上
utm.source false - String utm参数
utm.campaign false - String utm参数
utm.medium false - String utm参数
utm.content false - String utm参数
utm.term false - String utm参数

获取联系人事件

GET /contacts/{contactId}/events HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回一个该联系人的事件列表,示例如下

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

[
    {
        "dateCreated": "2019-12-07 17:07:11",
        "lastUpdated": "2019-12-07 17:07:11",
        "ver": 1,
        "id": 1126251,
        "contactIdentityId": 313114,
        "anonymousId": "66bd19ea-7859-4876-9691-db1232e47df7",
        "eventDate": 1575709631193,
        "channelId": "test-yyp",
        "channelName": "官网",
        "event": "WEBSITE__PAGE_VIEW",
        "sdkVersion": "19.10.R1",
        "sdkType": "JS SDK",
        "os": "iOS",
        "osVersion": "13.2.3",
        "browser": "微信",
        "browserVersion": "7.0.8",
        "country": "中国",
        "province": "江苏",
        "city": "南京",
        "manufacturer": "Apple",
        "deviceModel": "IPHONE",
        "ip": "117.62.191.148",
        "triggerFlow": true,
        "channelAppId": 2,
        "contactId": 2995,
        "attr1": "Wechat-H5-Demo",
        "attr2": "https://h5.leadswarp.com/wechat-h5.html?utm_source=%E6%9D%A5%E6%BA%90&utm_campaign=%E6%B4%BB%E5%8A%A8&utm_medium=%E5%AA%92%E4%BB%8B&utm_content=%E5%86%85%E5%AE%B9&utm_term=%E5%85%B3%E9%94%AE%E5%AD%97",
        "attr3": "Wechat,H5,Demo,OpenID",
        "attr4": "",
        "attr5": "",
        "utm": {
            "source": "来源",
            "campaign": "活动",
            "medium": "媒介",
            "content": "内容",
            "term": "关键字"
        }
    },
    {
        "dateCreated": "2019-12-07 16:46:48",
        "lastUpdated": "2019-12-07 16:46:48",
        "ver": 1,
        "id": 1066758,
        "contactIdentityId": 313113,
        "eventDate": 1575708408183,
        "channelId": "SHORTURL_15",
        "channelName": "短链接",
        "event": "SHORTURL__DWZ_REDIRECT",
        "triggerFlow": true,
        "contactId": 2995,
        "attr1": "q8T1vC",
        "attr2": "http://apitest.wenjuan.com/s/Bj2Az2?utm_source=%E5%BE%AE%E4%BF%A1%E6%96%87%E7%AB%A0&utm_campaign=%E6%98%9F%E8%80%80%E6%B3%95%E5%9B%BD%E6%96%B0%E8%A3%85%E6%B4%BB%E5%8A%A8&utm_medium=%E5%AA%92%E4%BB%8B&utm_content=test.utm&utm_term=%E9%97%AE%E5%8D%B7%E7%...",
        "attr3": "WENJUANWANG",
        "attr4": "apitest.wenjuan.com",
        "utm": {
            "source": "微信文章",
            "campaign": "星耀法国新装活动",
            "medium": "媒介",
            "content": "test.utm",
            "term": "问卷网测试"
        }
    },
    ...
]

HTTP Request

GET https://open.linkflowtech.com/contacts/{contactId}/events

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Querystring parameters

Parameter Required Default Type Description
contactId true - Long 联系人ID
page false 0 Integer 第几页,从0开始
size false 200 Integer 每页条数

游标获取所有事件

仅支持获取最近六个月以内的事件

GET /events/lite HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回一个事件列表,示例如下

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

[
    {
        "dateCreated": "2019-12-07 17:07:11",
        "lastUpdated": "2019-12-07 17:07:11",
        "ver": 1,
        "id": 1126251,
        "contactIdentityId": 313114,
        "anonymousId": "66bd19ea-7859-4876-9691-db1232e47df7",
        "eventDate": 1575709631193,
        "channelId": "test-yyp",
        "channelName": "官网",
        "event": "WEBSITE__PAGE_VIEW",
        "sdkVersion": "19.10.R1",
        "sdkType": "JS SDK",
        "os": "iOS",
        "osVersion": "13.2.3",
        "browser": "微信",
        "browserVersion": "7.0.8",
        "country": "中国",
        "province": "江苏",
        "city": "南京",
        "manufacturer": "Apple",
        "deviceModel": "IPHONE",
        "ip": "117.62.191.148",
        "triggerFlow": true,
        "channelAppId": 2,
        "contactId": 2995,
        "attr1": "Wechat-H5-Demo",
        "attr2": "https://h5.leadswarp.com/wechat-h5.html?utm_source=%E6%9D%A5%E6%BA%90&utm_campaign=%E6%B4%BB%E5%8A%A8&utm_medium=%E5%AA%92%E4%BB%8B&utm_content=%E5%86%85%E5%AE%B9&utm_term=%E5%85%B3%E9%94%AE%E5%AD%97",
        "attr3": "Wechat,H5,Demo,OpenID",
        "attr4": "",
        "attr5": "",
        "utm": {
            "source": "来源",
            "campaign": "活动",
            "medium": "媒介",
            "content": "内容",
            "term": "关键字"
        }
    },
    {
        "dateCreated": "2019-12-07 16:46:48",
        "lastUpdated": "2019-12-07 16:46:48",
        "ver": 1,
        "id": 1066758,
        "contactIdentityId": 313113,
        "eventDate": 1575708408183,
        "channelId": "SHORTURL_15",
        "channelName": "短链接",
        "event": "SHORTURL__DWZ_REDIRECT",
        "triggerFlow": true,
        "contactId": 2995,
        "attr1": "q8T1vC",
        "attr2": "http://apitest.wenjuan.com/s/Bj2Az2?utm_source=%E5%BE%AE%E4%BF%A1%E6%96%87%E7%AB%A0&utm_campaign=%E6%98%9F%E8%80%80%E6%B3%95%E5%9B%BD%E6%96%B0%E8%A3%85%E6%B4%BB%E5%8A%A8&utm_medium=%E5%AA%92%E4%BB%8B&utm_content=test.utm&utm_term=%E9%97%AE%E5%8D%B7%E7%...",
        "attr3": "WENJUANWANG",
        "attr4": "apitest.wenjuan.com",
        "utm": {
            "source": "微信文章",
            "campaign": "星耀法国新装活动",
            "medium": "媒介",
            "content": "test.utm",
            "term": "问卷网测试"
        }
    },
    ...
]

HTTP Request

GET https://open.linkflowtech.com/events/lite

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Querystring parameters

Parameter Required Default Type Description
lastMaxId true 0 Integer 上一次返回的事件列表的最大id,第一次可以传0
size false 200 Integer 每页条数

群组

查询群组

GET /v2/groups?id=126&name=wechat&groupType=static&ext1=wx134210231&ext2=wechattagid HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回一个JSON数组,里面包含了所有符合条件的群组,示例如下

HTTP/1.1 200 OK
Content-Type: application/json
[
    {
        "lastUpdated": "2017-12-07 16:59:38",
        "groupType": "static",
        "dateCreated": "2017-12-07 16:59:38",
        "name": "618潜在客户",
        "id": 47
    },
    {
        "lastUpdated": "2017-12-11 16:52:39",
        "groupType": "dynamic",
        "dateCreated": "2017-12-11 11:20:04",
        "name": "最近7天活跃客户",
        "id": 51
    }
]

HTTP Request

GET https://open.linkflowtech.com/v2/groups

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Querystring parameters

Parameter Required Default Type Description
id false null Integer 群组id
name false null String 群组名称(模糊查询)
groupType false null String static或dynamic
lastUpdated false null Date 最小更新时间
ext1 false null String 微信appId
ext2 false null String 微信群组id

创建群组

POST /v2/groups HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token
{
  "name" : "this-is-group-name",
  "groupType" : "static",
  "ext1" : "wechatappid",
  "ext2" : "wechattagid"
}

在提交请求之后,系统会返回刚创建的群组,示例如下

HTTP/1.1 200 OK
Content-Type: application/json
{
    "lastUpdated": "2018-06-25 14:58:22",
    "groupType": "static",
    "dateCreated": "2018-06-25 14:58:22",
    "name": "this-is-group-name",
    "id": 334
}

HTTP Request

POST https://open.linkflowtech.com/v2/groups

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Request Parameters

Parameter Required Default Type Description
name true - String 群组名称
groupType false static String 默认为static,目前不能设置别的值
ext1 false null String 微信appId
ext2 false null String 微信群组id

Error Code

HTTP Status Code Parameter Description
400 B00001 群组已存在
412 B00157 群组数量已达到上限

修改群组名

POST /v2/groups/{id} HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统成功修改群组名后,返回200状态码

HTTP/1.1 200 OK

HTTP Request

POST https://open.linkflowtech.com/v2/groups/{id}

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Path Parameters

Parameter Required Default Type Description
id true - Long 群组id

Request Parameters

Parameter Required Default Type Description
name true - String 群组名称

Error Code

HTTP Status Code Parameter Description
404 B00008 群组不存在
404 B01102 群组名已存在

删除群组

DELETE /v2/groups/{id} HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统成功删除群组后,返回200状态码

HTTP/1.1 200 OK

HTTP Request

DELETE https://open.linkflowtech.com/v2/groups/{id}

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Path Parameters

Parameter Required Default Type Description
id true - Long 群组id

Error Code

HTTP Status Code Parameter Description
404 B00008 群组不存在

查询联系人的群组

GET /v2/contacts/{contactId}/groups?groupType=static HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回联系人的群组,示例如下

HTTP/1.1 200 OK
Content-Type: application/json
[
    {
        "lastUpdated": "2017-12-07 16:59:38",
        "groupType": "static",
        "dateCreated": "2017-12-07 16:59:38",
        "name": "618潜在客户",
        "id": 47
    },
    {
        "lastUpdated": "2017-12-11 16:52:39",
        "groupType": "static",
        "dateCreated": "2017-12-11 11:20:04",
        "name": "关注用户",
        "id": 51
    }
]

HTTP Request

GET https://open.linkflowtech.com/v2/contacts/{contactId}/groups

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Path Parameters

Parameter Required Default Type Description
contactId true - Integer 联系人id

Request Parameters

Parameter Required Default Type Description
groupType false null String 群组类型

Error Code

HTTP Status Code Parameter Description
404 B00008 联系人不存在

查询群组联系人

GET /v2/groups/{groupId}/contacts?memberId=2346&size=500 HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回群组的联系人,示例如下

HTTP/1.1 200 OK
Content-Type: application/json
[
    {
        "lastUpdated": "2018-04-19 11:19:41",
        "dateCreated": "2018-04-19 11:19:41",
        "contact": {
            "mobilePhone": null,
            "name": "'非常满意'&*-^!@#$%{}[]\\|、\"\"「」【】",
            "id": 17771,
            "email": null
        },
        "contactGroupId": 252,
        "version": null,
        "memberId": 1243167
    },
    {
        "lastUpdated": "2018-04-19 14:54:53",
        "dateCreated": "2018-04-19 14:54:53",
        "contact": {
            "mobilePhone": null,
            "name": "tiger",
            "id": 17760,
            "email": null
        },
        "contactGroupId": 252,
        "version": null,
        "memberId": 1243184
    }
]

HTTP Request

GET https://open.linkflowtech.com/v2/groups/{groupId}/contacts

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Path Parameters

Parameter Required Default Type Description
groupId true - Integer 群组id

Querystring parameters

Parameter Required Default Type Description
memberId false 0 Integer 起始memberId(不包含)
size false 500 Integer 查询数量,最大值:500

Error Code

HTTP Status Code Parameter Description
400 B00031 size超过最大数量
404 B00008 群组不存在

添加群组联系人

POST /v2/groups/{groupId}/contacts HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token
[
  17760, 17771, 17578
]

在提交请求之后,系统会返回加组结果,示例如下

HTTP/1.1 200 OK
Content-Type: application/json
{
    "success": [
        17760,
        17771,
        17578
    ],
    "failure": [],
    "group": {
        "lastUpdated": "2018-06-25 14:58:10",
        "groupType": "static",
        "dateCreated": "2018-06-25 10:15:46",
        "name": "双11vip客户",
        "id": 333
    }
}

HTTP Request

POST https://open.linkflowtech.com/v2/groups/{groupId}/contacts

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Path Parameters

Parameter Required Default Type Description
groupId true - Integer 群组id

Error Code

HTTP Status Code Parameter Description
400 B00031 联系人超过最大数量
404 B00008 群组不存在

删除群组联系人

DELETE /v2/groups/{groupId}/contacts HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token
[
  17760, 17771, 17578
]

在提交请求之后,系统会返回删组结果,示例如下

HTTP/1.1 200 OK
Content-Type: application/json
{
    "success": [
        17760,
        17771,
        17578
    ],
    "failure": [],
    "group": {
        "lastUpdated": "2018-06-25 14:58:10",
        "groupType": "static",
        "dateCreated": "2018-06-25 10:15:46",
        "name": "双11vip客户",
        "id": 333
    }
}

HTTP Request

DELETE https://open.linkflowtech.com/v2/groups/{groupId}/contacts

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Path Parameters

Parameter Required Default Type Description
groupId true - Integer 群组id

Error Code

HTTP Status Code Parameter Description
400 B00031 联系人超过最大数量
404 B00008 群组不存在

二维码

新建二维码

POST /v2/qrcode HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,会将二维码图片二进制流写入到响应里

HTTP/1.1 200 OK
Content-Type: image/jpeg
Content-Disposition: attachment;filename={文件名}
{
    "appId":"wxf2d36651dc1b7ab0",
    "utm":{
        "term":"term",
        "campaign":"campaign",
        "source":"source"
    },
    "size":"small"
}

HTTP Request

POST https://open.linkflowtech.com/v2/qrcode

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Request parameters

Parameter Required Default Type Description
appId true - String 公众号
utm.term true - String 关键字
utm.source false null String 来源
utm.campaign false null String 活动
size true - String 大小,值为small或medium或large

维度表

维度表数据上传

POST /v1/dim/{dimensionId}/data HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统成功上传数据后,返回200状态码 http HTTP/1.1 200 OK

请求示例如下:

[
    {
        "id":"1",
        "color":"红色"
    },
    {
        "id":"2",
        "color":"红色"
    },
    {
        "id":"3",
        "color":"红色"
    }

]

HTTP Request

POST https://open.linkflowtech.com/v1/dim/{dimensionId}/data

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Path Parameters

Parameter Required Default Type Description
dimensionId true - String 维度表alias

Error Code

HTTP Status Code Parameter Description
500 B01206 上传数量超过限制
404 B00008 维度表不存在
500 B01201 维度表无主键
500 B01205 数据结点不包含主键列

标签

创建用户标签元数据

POST /v1/tags HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token
{
  "tagName": "aaccc",
  "tagKey": "tag_ccc2",
  "dataType": "number",
  "tagType": "UPLOAD",
  "identityType": "externalId",
  "channelId": "1"
}

在提交请求之后,系统会返回刚创建的元数据,示例如下

HTTP/1.1 200 OK
Content-Type: application/json
{
    "tagKey": "tag_ccc2",
    "tagName": "aaccc",
    "dataType": "number",
    "status": "ACTIVE",
    "dateCreated": "2017-11-30 19:37:12",
    "lastUpdated": "2017-11-30 19:37:12",
}

HTTP Request

POST https://open.linkflowtech.com/v1/tags

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Request Parameters

Parameter Required Default Type Description
tagKey true String 标签key,唯一识别标识,需要以tag_开头,只包含:小写字母、数字、下划线
tagName true String 标签显示名
dataType true String 标签值数据类型,枚举值,只支持传入text、number、array、datetime、boolean
tagType true String 只支持传"UPLOAD"
identityType true String 用户身份类型,如:phone、email、wechat.unionid
channelId true String 当用户身份类型为externalId时,需要传channelId(连接的数值型id)

Error Code

HTTP Status Code Parameter Description
500 B00002 必填参数为空
500 B00010 参数不合法
500 B00159 channelId不存在
500 B00037 标签超过配额数
500 B01157 key不符合tag_开头,只包含:小写字母、数字、下划线
500 B01151 标签已经存在

删除用户标签元数据

DELETE /v1/tags/tagkeys/{tagKey}
HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,返回200状态码,示例如下

HTTP/1.1 200 OK

HTTP Request

DELETE https://open.linkflowtech.com/v1/tags/tagkeys/{tagKey}

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Request Parameters

Parameter Required Default Type Description
tagKey true String 标签key,唯一识别标识,需要以tag_开头,只包含:小写字母、数字、下划线

Error Code

HTTP Status Code Parameter Description
500 B00002 必填参数为空
500 B_01162 标签不存在

获取用户标签元数据列表

GET /v1/tags?size=1&page=0 HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回元数据列表,示例如下

HTTP/1.1 200 OK
Content-Type: application/json
[{
    "tagKey": "tag_878",
    "tagName": "用户活跃度",
    "dataType": "text",
    "status": "ACTIVE",
    "dateCreated": "2017-11-30 19:37:12",
    "lastUpdated": "2017-11-30 19:37:12",
    "lastCalculateTime":"2017-11-30 20:37:12",
}]

HTTP Request

GET https://open.linkflowtech.com/v1/tags?size=1&page=0

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Request Parameters

Parameter Required Default Type Description
page true integer 第几页,从0开始
size true integer 每页条数,限制200条

Error Code

HTTP Status Code Parameter Description
500 B00010 参数不合法

上传用户标签值文件

POST /v1/tags/tagkeys/{tagKey}/upload/file/operates/{operate}
HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回上传文件结果消息体,示例如下

HTTP/1.1 200 OK
Content-Type: application/json
{
    "tagKey":"tag_878",
    "fileName": "tag_878_file1",
    "ossUrl": "https://devtest.leadswarp.com/oss/1/tag/upload/tmp/20220321/7216b1262f184413bb529701a060eba9/ef00c630b0bb4f90a10de9e5bfcd7194"
}

HTTP Request

POST https://open.linkflowtech.com/v1/tags/tagkeys/{tagKey}/upload/file/operates/{operate}

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Request Parameters

Parameter Required Default Type Description
tagKey true String 标签key,唯一识别标识,需要以tag_开头,只包含:小写字母、数字、下划线
operate true String overwrite覆盖,即删除标签元数据中已有的文件,用新上传的文件代替,append:追加,即保留标签元数据中已有的文件,并新增新上传的文件
file true MultipartFile 上传的文件,文件大小限制在100M内

Error Code

HTTP Status Code Parameter Description
500 B01163 文件大小超过100M
500 B00010 参数不合法
500 B01162 tagKey不存在

发起计算用户标签值任务

POST /v1/tags/tagkeys/{tagKey}/calculate
HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回200,示例如下

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

HTTP Request

POST https://open.linkflowtech.com/v1/tags/tagkeys/{tagKey}/calculate

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Request Parameters

Parameter Required Default Type Description
tagKey true String 标签key,唯一识别标识,需要以tag_开头,只包含:小写字母、数字、下划线

Error Code

HTTP Status Code Parameter Description
500 B01162 tagKey不存在
500 B01152 任务计算状态不对,只有FINISH, ERROR, CALC_ERROR允许重新计算

生成用户标签值文件

POST /v1/tags/tagkeys/{tagKey}/export
HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token
{
  "identityType": "externalId",
  "channelId": "111"
}

在提交请求之后,系统会返回创建任务消息体,示例如下

HTTP/1.1 200 OK
Content-Type: application/json
{
  "tagKey":"tag_sf",
  "taskId":19723653547885,
  "status":"INITIAL"
}

HTTP Request

POST https://open.linkflowtech.com/v1/tags/tagkeys/{tagKey}/export

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Request Parameters

Parameter Required Default Type Description
tagKey true String 标签key,唯一识别标识,需要以tag_开头,只包含:小写字母、数字、下划线
identityType true String 用户识别标识类型
channelId 如果identity_type为externalId,则为必填 String 自定义连接id(连接的数值型id)

Error Code

HTTP Status Code Parameter Description
500 B00002 必填参数为空
500 B00010 参数不合法
500 B01162 tagKey不存在
500 B00159 channelId不存在

获取用户标签值文件下载地址

GET /v1/tags/tagkeys/export/{taskId} HTTP/1.1
User-Agent: MyClient/1.0.0
Accept: application/json
X-OpenApi-Token: Access Token

在提交请求之后,系统会返回文件下载地址,示例如下

HTTP/1.1 200 OK
Content-Type: application/json
{
    "taskId": 19723653547885,
    "status": "FINISH",
    "errorMsg": "",
    "fileUrl": ""
}

HTTP Request

GET https://open.linkflowtech.com/v1/tags/tagkeys/export/{taskId}

Headers

Parameter Description
X-OpenApi-Token 通过App Key和App Secret换取的Access Token

Request Parameters

Parameter Required Default Type Description
taskId true Long 生成标签文件任务id