开发者文档

创建工作区

POST/api/orgs

权限与前置条件

当前有效登录用户。

此接口仅支持浏览器登录,不接受 API Key。Cookie 写入仍需允许来源的 Origin 和 X-Requested-With: suren360。不能同时携带 Cookie 与 API Key。所有路径参数须使用真实 ID。

请求参数

JSON 请求体

字段类型必填约束
namestring是{"minLength":1,"maxLength":80}
descriptionstring否{"default":"","maxLength":500}
companyNamestring否{"maxLength":200}
contactEmail联合类型否{"anyOf":[{"type":"string","const":""},{"type":"string","maxLength":254,"format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}]}
contactPhonestring否{"maxLength":254}
reportEmail联合类型否{"anyOf":[{"type":"string","const":""},{"type":"string","maxLength":254,"format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}]}
reportWechatstring否{"maxLength":254}
查看完整请求 JSON Schema
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "description": {
      "default": "",
      "type": "string",
      "maxLength": 500
    },
    "companyName": {
      "type": "string",
      "maxLength": 200
    },
    "contactEmail": {
      "anyOf": [
        {
          "type": "string",
          "const": ""
        },
        {
          "type": "string",
          "maxLength": 254,
          "format": "email",
          "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
        }
      ]
    },
    "contactPhone": {
      "type": "string",
      "maxLength": 254
    },
    "reportEmail": {
      "anyOf": [
        {
          "type": "string",
          "const": ""
        },
        {
          "type": "string",
          "maxLength": 254,
          "format": "email",
          "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
        }
      ]
    },
    "reportWechat": {
      "type": "string",
      "maxLength": 254
    }
  },
  "required": [
    "name"
  ],
  "additionalProperties": false
}

调用示例

先通过浏览器统一登录,使用受控环境中的已有会话。 请替换部署地址与示例字段,不要将凭证粘贴到聊天或日志中。

cURL · 示例占位值需替换
curl --request POST \
  'https://YOUR_DEPLOYMENT_HOST/api/orgs' \
  --cookie "$SUREN360_COOKIE" \
  --header 'Origin: https://YOUR_DEPLOYMENT_HOST' \
  --header 'X-Requested-With: suren360' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "替换为实际值"
}'

响应结构

成功返回 HTTP 200 的 JSON 对象。下方为响应结构定义,不是虚构的业务数据。

字段类型必填约束
organizationobject是{"required":["id","name","description","status","role","memberCount","createdAt"],"additionalProperties":false}
查看完整响应 JSON Schema
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "organization": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "companyName": {
          "type": "string"
        },
        "contactEmail": {
          "type": "string"
        },
        "contactPhone": {
          "type": "string"
        },
        "reportEmail": {
          "type": "string"
        },
        "reportWechat": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "suspended"
          ]
        },
        "role": {
          "type": "string",
          "enum": [
            "owner",
            "admin",
            "member"
          ]
        },
        "memberCount": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
        }
      },
      "required": [
        "id",
        "name",
        "description",
        "status",
        "role",
        "memberCount",
        "createdAt"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "organization"
  ],
  "additionalProperties": false
}
查看错误码与重试规则