创建地点
在系统中第一次创建地点数据
Tip: 非必填字段,不传时默认为空
请求
| 项目 | 值 |
|---|---|
| HTTP URL | https://open.feishu.cn/open-apis/corehr/v1/locations |
| HTTP Method | POST |
| 接口频率限制 | 1000 次/分钟、50 次/秒 |
| 支持的应用类型 | custom |
| 权限要求 调用该 API 所需的权限。开启其中任意一项权限即可调用 开启任一权限即可 | corehr:corehr 更新核心人事信息 corehr:locations:write 更新地点信息 |
请求头
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| Authorization | string | 是 | tenant_access_token 值格式:"Bearer access_token" 示例值:"Bearer t-7f1bcd13fc57d46bac21793a18e560" 了解更多:如何选择与获取 access token |
| Content-Type | string | 是 | 固定值:"application/json; charset=utf-8" |
查询参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
client_token | string | 否 | 操作的唯一标识,用于幂等的进行更新操作,格式为标准的 UUIDV4。此值为空表示将发起一次新的请求,此值非空表示幂等的进行更新操作。 示例值:"fe599b60-450f-46ff-b2ef-9f6675625b97" |
请求体
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
hiberarchy_common | hiberarchy_common | 是 | 地点基本信息,该结构维护了地点的名称、编码、启用状态、上级地点等基础信息。 |
└ parent_id | string | 否 | 上级地点ID。ID获取方式: - 调用【创建地点】【批量分页查询地点】等接口可以返回地点ID 示例值:"4719168654814483759" |
└ name | i18n\[\] | 是 | 地点名称 - 名称不能包含「/」「;」「;」「\」「'」字符。 - 地点中英文名称会有全局唯一校验 |
└ lang | string | 是 | 语言 - 中文用zh-CN,英文用en-US。 示例值:"zh-CN" |
└ value | string | 是 | 内容 示例值:"刘梓新" |
└ active | boolean | 是 | 启用状态,true为启用,false为停用 示例值:true |
└ code | string | 否 | 地点编码 (不能与其他记录的编码重复) - 开启自动编码时,以自动生成的编码值为准,传入值不生效 - 未开启自动编码时,编码字段值以传入值为准 示例值:"12456" |
└ description | i18n\[\] | 否 | 描述 |
└ lang | string | 是 | 语言 - 中文用zh-CN,英文用en-US。 示例值:"zh-CN" |
└ value | string | 是 | 内容 示例值:"刘梓新" |
location_usage_list | enum\[\] | 否 | 地点用途(当地点用途是"工作地点"时,地址必填) |
└ enum_name | string | 是 | 地点用途 ID,枚举值及详细信息可通过【批量查询地点用途】接口查询获得。 - 请求参数object_api_name=location;custom_api_name=location_usage 示例值:"work_space" |
address | address\[\] | 否 | 地址 |
└ country_region_id | string | 是 | 国家 / 地区 ID 可通过【查询国家/地区信息】接口获取 示例值:"6862995757234914824" |
└ region_id | string | 否 | 主要行政区 ID 可通过【查询省份/行政区信息】接口获取 示例值:"6863326815667095047" |
└ city_id | string | 否 | 城市ID。ID获取 调用【查询城市信息】等接口可以返回城市ID 示例值:"6863333254578046471" |
└ distinct_id | string | 否 | 区县ID。ID获取 调用【查询区县信息】等接口可以返回区县ID 示例值:"6863333516579440141" |
└ address_line1 | string | 否 | 地址行 1 - 填写规则可见【地址填写指南】 示例值:"丹佛测试地址-纽埃时区" |
└ address_line2 | string | 否 | 地址行 2 - 填写规则可见【地址填写指南】 示例值:"PoewH" |
└ address_line3 | string | 否 | 地址行 3 - 填写规则可见【地址填写指南】 示例值:"PoewH" |
└ address_line4 | string | 否 | 地址行 4 - 填写规则可见【地址填写指南】 示例值:"jmwJc" |
└ address_line5 | string | 否 | 地址行 5 - 填写规则可见【地址填写指南】 示例值:"jmwJc" |
└ address_line6 | string | 否 | 地址行 6 - 填写规则可见【地址填写指南】 示例值:"jmwJc" |
└ address_line7 | string | 否 | 地址行 7 - 填写规则可见【地址填写指南】 示例值:"jmwJc" |
└ address_line8 | string | 否 | 地址行 8 - 填写规则可见【地址填写指南】 示例值:"rafSu" |
└ address_line9 | string | 否 | 地址行 9 - 填写规则可见【地址填写指南】 示例值:"McPRG" |
└ local_address_line1 | string | 否 | 地址行 1(非拉丁语系的本地文字) - 填写规则可见【地址填写指南】 示例值:"丹佛测试地址-纽埃时区" |
└ local_address_line2 | string | 否 | 地址行 2(非拉丁语系的本地文字) - 填写规则可见【地址填写指南】 示例值:"PoewH" |
└ local_address_line3 | string | 否 | 地址行 3(非拉丁语系的本地文字) - 填写规则可见【地址填写指南】 示例值:"PoewH" |
└ local_address_line4 | string | 否 | 地址行 4(非拉丁语系的本地文字) - 填写规则可见【地址填写指南】 示例值:"jmwJc" |
└ local_address_line5 | string | 否 | 地址行 5(非拉丁语系的本地文字) - 填写规则可见【地址填写指南】 示例值:"jmwJc" |
└ local_address_line6 | string | 否 | 地址行 6(非拉丁语系的本地文字) - 填写规则可见【地址填写指南】 示例值:"jmwJc" |
└ local_address_line7 | string | 否 | 地址行 7(非拉丁语系的本地文字) - 填写规则可见【地址填写指南】 示例值:"jmwJc" |
└ local_address_line8 | string | 否 | 地址行 8(非拉丁语系的本地文字) - 填写规则可见【地址填写指南】 示例值:"rafSu" |
└ local_address_line9 | string | 否 | 地址行 9(非拉丁语系的本地文字) - 填写规则可见【地址填写指南】 示例值:"McPRG" |
└ postal_code | string | 否 | 邮政编码 示例值:"611530" |
└ address_type_list | enum\[\] | 否 | 地址类型,枚举值及详细信息可通过【获取字段详情】接口查询获得。 - 请求参数object_api_name=address;custom_api_name=address_type |
└ enum_name | string | 是 | 枚举值 示例值:"registered_address" |
└ is_primary | boolean | 否 | 是否为主要地址 示例值:true |
└ is_public | boolean | 否 | 公开地址 示例值:true |
working_hours_type_id | string | 否 | 工时制度 ID,枚举值及详细信息可通过【批量查询工时制度】接口查询获得 示例值:"4690238309151997779" |
effective_time | string | 是 | 版本生效日期 - 填写格式:YYYY-MM-DD 00:00:00(系统会自动将时分秒改为00:00:00) - 系统默认为填写日期当天的 00:00:00 生效 - 该接口只支持到最小单位为日 - 日期范围要求:1900-01-01 00:00:00~9999-12-31 23:59:59 - 详情可以参考时间轴介绍 示例值:"2020-05-01 00:00:00" |
locale | enum | 否 | 区域设置ID ,枚举值及详细信息可通过【批量查询枚举信息】接口查询获得。 - 请求参数object_api_name=location;custom_api_name=locale 示例值:zh_cn |
└ enum_name | string | 是 | 枚举值 示例值:"zh_cn" |
time_zone_id | string | 否 | 时区 示例值:"123456789" |
display_language_id | string | 否 | 默认显示语言 示例值:"123456789" |
请求体示例
json
{
"hiberarchy_common": {
"parent_id": "4719168654814483759",
"name": [
{
"lang": "zh-CN",
"value": "刘梓新"
}
],
"active": true,
"code": "12456",
"description": [
{
"lang": "zh-CN",
"value": "刘梓新"
}
]
},
"location_usage_list": [
{
"enum_name": "work_space"
}
],
"address": [
{
"country_region_id": "6862995757234914824",
"region_id": "6863326815667095047",
"city_id": "6863333254578046471",
"distinct_id": "6863333516579440141",
"address_line1": "丹佛测试地址-纽埃时区",
"address_line2": "PoewH",
"address_line3": "PoewH",
"address_line4": "jmwJc",
"address_line5": "jmwJc",
"address_line6": "jmwJc",
"address_line7": "jmwJc",
"address_line8": "rafSu",
"address_line9": "McPRG",
"local_address_line1": "丹佛测试地址-纽埃时区",
"local_address_line2": "PoewH",
"local_address_line3": "PoewH",
"local_address_line4": "jmwJc",
"local_address_line5": "jmwJc",
"local_address_line6": "jmwJc",
"local_address_line7": "jmwJc",
"local_address_line8": "rafSu",
"local_address_line9": "McPRG",
"postal_code": "611530",
"address_type_list": [
{
"enum_name": "registered_address"
}
],
"is_primary": true,
"is_public": true
}
],
"working_hours_type_id": "4690238309151997779",
"effective_time": "2020-05-01 00:00:00",
"locale": {
"enum_name": "zh_cn"
},
"time_zone_id": "123456789",
"display_language_id": "123456789"
}响应
响应体
| 名称 | 类型 | 描述 |
|---|---|---|
code | int | 错误码,非 0 表示失败 |
msg | string | 错误描述 |
data | \- | - |
└ location | location | 4718803945687580505 |
└ id | string | 实体在CoreHR内部的唯一键 |
└ hiberarchy_common | hiberarchy_common | 地点基本信息,该结构维护了地点的名称、编码、启用状态、上级地点 等基础信息。 |
└ parent_id | string | 上级地点,在创建场景下, 该字段必填,枚举值及详细信息可通过【查询地点列表】接口查询获得 |
└ name | i18n\[\] | 名称 |
└ lang | string | 语言 - 中文用zh-CN,英文用en-US。 |
└ value | string | 内容 |
└ type | enum | 组织类型 |
└ enum_name | string | 组织类型,默认值为 location, 枚举值及详细信息可通过【批量查询枚举类型】接口查询获得 |
└ display | i18n\[\] | 枚举多语展示 |
└ lang | string | 语言 - 中文用zh-CN,英文用en-US。 |
└ value | string | 内容 |
└ active | boolean | 启用 |
└ effective_time | string | 生效时间 - 填写格式: YY-MM-DD 00:00:00 - 生效时间, 系统默认为填写日期当天的 00:00:00 生效 |
└ expiration_time | string | 失效时间 - 填写格式: YYYY-MM-DD 00:00:00 - 本次编辑的记录版本失效的时间, 如果用户在本次操作的生效日期之后修改了地点信息,则系统会将下一次操作的日期作为当前记录的失效时间。 - 系统默认为填写日期当天的 00:00:00 失效 |
└ code | string | 编码 |
└ description | i18n\[\] | 描述 |
└ lang | string | 语言 - 中文用zh-CN,英文用en-US。 |
└ value | string | 内容 |
└ custom_fields | object_field_data\[\] | 自定义字段 |
└ field_name | string | 字段名 |
└ value | string | 字段值,是json转义后的字符串,根据元数据定义不同,字段格式不同。如:("\"123\"", "\"123.23\"", "\"true\"", [\"id1\",\"id2\"], \"2006-01-02 15:04:05\") |
└ location_usage_list | enum\[\] | 地点用途 |
└ enum_name | string | 枚举值,地点用途 ID,枚举值及详细信息可通过【批量查询地点用途】接口查询获得 |
└ display | i18n\[\] | 枚举多语展示 |
└ lang | string | 语言 - 中文用zh-CN,英文用en-US。 |
└ value | string | 工作地点 |
└ address | address\[\] | 地址 |
└ full_address_local_script | string | 完整地址(本地文字) |
└ full_address_western_script | string | 完整地址(西方文字) |
└ id | string | 地址ID |
└ country_region_id | string | 国家 / 地区 ID 可通过【查询国家/地区信息】接口获取 |
└ region_id | string | 主要行政区 ID 可通过【查询省份/行政区信息】接口获取 |
└ city_id | string | 城市 |
└ distinct_id | string | 区/县 |
└ address_line1 | string | 地址行 1 |
└ address_line2 | string | 地址行 2 |
└ address_line3 | string | 地址行 3 |
└ address_line4 | string | 地址行 4 |
└ address_line5 | string | 地址行 5 |
└ address_line6 | string | 地址行 6 |
└ address_line7 | string | 地址行 7 |
└ address_line8 | string | 地址行 8 |
└ address_line9 | string | 地址行 9 |
└ local_address_line1 | string | 地址行 1(非拉丁语系的本地文字) |
└ local_address_line2 | string | 地址行 2(非拉丁语系的本地文字) |
└ local_address_line3 | string | 地址行 3(非拉丁语系的本地文字) |
└ local_address_line4 | string | 地址行 4(非拉丁语系的本地文字) |
└ local_address_line5 | string | 地址行 5(非拉丁语系的本地文字) |
└ local_address_line6 | string | 地址行 6(非拉丁语系的本地文字) |
└ local_address_line7 | string | 地址行 7(非拉丁语系的本地文字) |
└ local_address_line8 | string | 地址行 8(非拉丁语系的本地文字) |
└ local_address_line9 | string | 地址行 9(非拉丁语系的本地文字) |
└ postal_code | string | 邮政编码 |
└ address_type_list | enum\[\] | 地址类型 枚举值可通过【获取字段详情】接口查询,查询参数如下: - object_api_name = "address" - custom_api_name = "address_type" |
└ enum_name | string | 枚举值 |
└ display | i18n\[\] | 枚举多语展示 |
└ lang | string | 语言 - 中文用zh-CN,英文用en-US。 |
└ value | string | 内容 |
└ is_primary | boolean | 主要地址 |
└ is_public | boolean | 公开地址 |
└ custom_fields | object_field_data\[\] | 自定义字段 |
└ field_name | string | 字段名 |
└ value | string | 字段值,是json转义后的字符串,根据元数据定义不同,字段格式不同。如:("\"123\"", "\"123.23\"", "\"true\"", [\"id1\",\"id2\"], \"2006-01-02 15:04:05\") |
└ working_hours_type_id | string | 工时制度 ID,枚举值及详细信息可通过【批量查询工时制度】接口查询获得 |
└ effective_time | string | 版本生效时间 - 填写格式: YY-MM-DD 00:00:00 - 生效时间, 系统默认为填写日期当天的 00:00:00 生效 |
└ expiration_time | string | 版本失效时间 - 填写格式: YYYY-MM-DD 00:00:00 - 本次编辑的记录版本失效的时间, 如果用户在本次操作的生效日期之后修改了地点信息,则系统会将下一次操作的日期作为当前记录的失效时间。 - 系统默认为填写日期当天的 00:00:00 失效 |
└ custom_fields | object_field_data\[\] | 自定义字段 |
└ field_name | string | 字段名 |
└ value | string | 字段值,是json转义后的字符串,根据元数据定义不同,字段格式不同。如:("\"123\"", "\"123.23\"", "\"true\"", [\"id1\",\"id2\"], \"2006-01-02 15:04:05\") |
└ locale | enum | 区域设置ID ,枚举值及详细信息可通过【批量查询枚举信息】接口查询获得 |
└ enum_name | string | 枚举值 |
└ display | i18n\[\] | 枚举多语展示 |
└ lang | string | 语言 - 中文用zh-CN,英文用en-US。 |
└ value | string | 内容 |
└ time_zone_id | string | 时区 |
└ display_language_id | string | 默认显示语言 |
响应体示例
json
{
"code": 0,
"msg": "success",
"data": {
"location": {
"id": "4718803945687580505",
"hiberarchy_common": {
"parent_id": "4719168654814483759",
"name": [
{
"lang": "zh-CN",
"value": "刘梓新"
}
],
"type": {
"enum_name": "location",
"display": [
{
"lang": "zh-CN",
"value": "地点"
}
]
},
"active": true,
"effective_time": "2020-05-01 00:00:00",
"expiration_time": "2020-05-02 00:00:00",
"code": "12456",
"description": [
{
"lang": "zh-CN",
"value": "刘梓新"
}
],
"custom_fields": [
{
"field_name": "name",
"value": "\"Sandy\""
}
]
},
"location_usage_list": [
{
"enum_name": "phone_type",
"display": [
{
"lang": "zh-CN",
"value": "工作地点"
}
]
}
],
"address": [
{
"full_address_local_script": "中国北京北京",
"full_address_western_script": "Beijing, Beijing, China,",
"id": "6989822217869624863",
"country_region_id": "6862995757234914824",
"region_id": "6863326815667095047",
"city_id": "6863333254578046471",
"distinct_id": "6863333516579440141",
"address_line1": "丹佛测试地址-纽埃时区",
"address_line2": "PoewH",
"address_line3": "PoewH",
"address_line4": "jmwJc",
"address_line5": "jmwJc",
"address_line6": "jmwJc",
"address_line7": "jmwJc",
"address_line8": "rafSu",
"address_line9": "McPRG",
"local_address_line1": "丹佛测试地址-纽埃时区",
"local_address_line2": "PoewH",
"local_address_line3": "PoewH",
"local_address_line4": "jmwJc",
"local_address_line5": "jmwJc",
"local_address_line6": "jmwJc",
"local_address_line7": "jmwJc",
"local_address_line8": "rafSu",
"local_address_line9": "McPRG",
"postal_code": "611530",
"address_type_list": [
{
"enum_name": "onboarding_address",
"display": [
{
"lang": "zh-CN",
"value": " 入职地址"
}
]
}
],
"is_primary": true,
"is_public": true,
"custom_fields": [
{
"field_name": "name",
"value": "\"Sandy\""
}
]
}
],
"working_hours_type_id": "4690238309151997779",
"effective_time": "2020-05-01 00:00:00",
"expiration_time": "2020-05-02 00:00:00",
"custom_fields": [
{
"field_name": "name",
"value": "\"Sandy\""
}
],
"locale": {
"enum_name": "zh_cn",
"display": [
{
"lang": "zh-CN",
"value": "刘梓新"
}
]
},
"time_zone_id": "123456789",
"display_language_id": "123456789"
}
}
}错误码
| HTTP状态码 | 错误码 | 描述 | 排查建议 |
|---|---|---|---|
| 400 | 1160004 | client_token repeat. | 重复请求,请确认是否已处理完成 |
| 400 | 1160251 | superior location is required | 上级地点为必填,请检查上级地点是否为空 |
| 400 | 1160252 | the number of characters in the text field exceeds the limit | 文本类字段的长度超过限制,请减少字符数 |
| 400 | 1160253 | the name can't contain "/", ";", or ";" | 名称中包含「/」、「;」、「;」、「\」、「'」请删除相关特殊字符 |
| 400 | 1160263 | code already exists | 请检查编码是否与其他记录重复 |
| 400 | 1160264 | this operation will make the relationship between the superior and the subordinate into a ring | 地点上下级关系成环,请检查上级地点是否正确 |
| 400 | 1160269 | effective date can't exceed 9999 | 生效日期不允许大于 9999 年,请检查生效日期是否正确 |
| 400 | 1160502 | The name already exists in same superior location. Please enter a different one. | 上级地点下已存在相同名称,请使用其他名称 |
| 400 | 1160311 | Unable to create a sub-department as location will be deactivated | 该地点将被停用,无法为其新建下级 |
| 400 | 1160313 | Unable to select "Geographical division" and other usages at the same time | 不能同时选择「地域划分」和其他用途 |
| 400 | 1160314 | Unable to select "Work location" and "Work space" at the same time | 不能同时选择「工作地点」和「办公楼宇」 |
| 400 | 1160315 | select a primary address | 请选择主要地址 |
| 400 | 1160316 | detailed address isn't required | 无需填写详细地址 |
| 400 | 1160317 | You can only select "work location" or "office location" | 仅可选择「工作地点」或「办公地点」 |
| 400 | 1160321 | enter an array for field | 请检查填写的信息, 需输入数组类型 |
| 400 | 1160327 | metadata of field doesn't exist | 该字段不是地点对象字段,请检查字段 APIName 是否正确 |
| 400 | 1160328 | Enter an integer for field | 请填写 Integer 整型数据 |
| 400 | 1160329 | field exceeds the maximum value | 请检查数字大小是否在范围内 |
| 400 | 1160330 | field exceeds the minimum value | 请检查数字大小是否在范围内请检查数字格式是否正确 |
| 400 | 1160331 | Enter an integer or decimal for field | 请检查数字格式是否正确 |
| 400 | 1160332 | enter a boolean value for field | 请检查布尔类型字段是否正确 |
| 400 | 1160333 | Enter an i18n object for field | 请检查多语字段传参是否正确 |
| 400 | 1160334 | Enter an enumeration value for field | 请检查传参是否正确 |
| 400 | 1160335 | Enter an array for field | 请检查传参是否正确 |
| 400 | 1160336 | org doesn't exist | 请检查地点是否存在 |
| 400 | 1160337 | deprecated | 已废弃 |
| 400 | 1160338 | field must be a string | 请检查传参是否正确 |
| 400 | 1160339 | field must be a string | 请检查传参是否正确 |
| 400 | 1160340 | field must be in the yyyy-MM-dd HH:mm:ss format | 请检查时间格式是否正确 |
| 400 | 1160341 | deprecated | 已废弃 |
| 400 | 1160343 | Duplicate code | 请检查编码是否与其他记录重复 |
| 400 | 1160256 | depercated | 已废弃 |
| 400 | 1160347 | org will be deactivated | 请检查停启用状态 |
| 400 | 1160349 | org deactivated on date | 请检查停启用状态 |
| 400 | 1160352 | The option has been deactivated | 请检查枚举类字段的选项是否已停用 |
| 400 | 1160353 | effective date can't be earlier than 1900 | 生效日期不能早于 1900 年 |
| 400 | 1160360 | unable to remove "work location" | 不能移除「工作地点」 |
| 400 | 1160354 | service rate limiting protection, please try again later | 请稍后再试 |
