当前位置: 首页 > Skill >

Self Dev Cnb Openapi Skills

Self Dev Cnb Openapi Skills

Self Dev Cnb Openapi Skills

与 CNB (Cloud Native Build) Open API 交互,用于代码管理和开发协作。当用户需要查询项目、代码仓库、问题、合并请求或其他开发相关数据时使用。需要 CNB_TOKEN 环境变量进行身份认证。API 请求地址从环境变量 CNB_API_ENDPOINT 获取,默认为 https://api.cnb.cool。

1.0.0 2026.11.16 775
获取Skill文件查看使用说明
作 者:江禾 许可证: 更新时间:2026.11.16
本文目录展开

CNB API 技能文档

技能概述

本技能提供 CNB (Cloud Native Build) Open API 的完整调用能力,支持所有 API 接口的调用和操作。每个 API 都有详细的文档说明,包含请求参数、响应格式和调用示例。

重要规则(必须遵守):

  1. 必须实际执行:访问 CNB API 时,必须通过 exec_command 工具实际执行 curl 命令,不要只在回复中描述或展示 curl 命令。用户需要的是 API 返回的结果,不是命令本身。
  2. 使用 curl + Authorization:不要使用 web_fetch 工具,因为 web_fetch 无法携带认证信息。
  3. 使用环境变量:始终使用 $CNB_TOKEN 和 $CNB_API_ENDPOINT 环境变量引用,不要使用 占位符。
  4. 主动执行:不要询问用户"是否需要我执行",直接执行 curl 获取结果并分析。
  5. 必须: 执行 curl 命令时必须使用 -w '%header{traceparent}' 获取 trace 信息,当请求失败时,务必返回 traceparent header, traceparent 信息仅记录在命令输出的日志中用于问题排查,不要在回复中展示给用户。

页面 URL 解析规则

当用户提供 CNB 平台的页面链接时,需要从 URL 中提取参数来构造 API 请求:

页面 URL 格式 提取参数 对应 API
https://{host}/{repo}/-/build/logs/{sn} repo, sn GET /{repo}/-/build/status/{sn} 查状态,GET /{repo}/-/build/logs?sn={sn} 查日志列表
https://{host}/{repo}/-/issues/{number} repo, number GET /{repo}/-/issues/{number}
https://{host}/{repo}/-/pulls/{number} repo, number GET /{repo}/-/pulls/{number}
https://{host}/{repo}/-/git/commits/{ref} repo, ref GET /{repo}/-/git/commits/{ref}
https://{host}/{repo} repo GET /{repo}

示例:用户给了 https://{host}/{org}/{repo}/-/build/logs/{sn}

  • 提取 repo = {org}/{repo},sn = {sn}
  • 先执行:curl ... "${CNB_API_ENDPOINT}/{org}/{repo}/-/build/status/{sn}" 获取构建状态
  • 如需详细日志,再调用 stage 接口

基础配置

API 基础地址: 从环境变量 CNB_API_ENDPOINT 获取,默认为 https://api.cnb.cool

认证方式: Bearer Token

环境变量:

  • CNB_TOKEN:身份认证令牌(必须)
  • CNB_API_ENDPOINT:API 请求基础地址(可选,默认为 https://api.cnb.cool)

请求头要求:

  • Accept: application/vnd.cnb.api+json
  • Authorization: Bearer $CNB_TOKEN

API 接口索引

activities 服务

接口 描述
GetUserActivitiesByDate 获取个人动态活跃详情汇总。Get user activities by date.
GetUserRepoActivityDetails 个人仓库动态详情列表。List of personal repository activity details.
TopContributors 获取仓库 top 活跃用户。List the top active users

ai 服务

接口 描述
AiChatCompletions AI 对话。调用者需有代码写权限(CNB_TOKEN 仅需读权限,部署令牌不检查读写权限)。AI chat completions. Requires caller to have repo write permission.

assets 服务

接口 描述
DeleteAsset 通过 asset 记录 id 删除一个 asset
GetFiles 获取 issue 文件或合并请求文件的请求,返回文件二进制内容。Request to retrieve file of issues and pull requests, returns binary content.
GetImgs 获取 issue 图片或合并请求图片的请求,返回图片二进制内容。Request to retrieve image of issues and pull requests, returns binary content.
ListAssets 仓库的 asset 记录列表

badge 服务

接口 描述
GetBadge 获取徽章 svg 或 JSON 数据。Get badge svg or JSON data.
ListBadge 获取徽章列表数据。List badge data
UploadBadge 上传徽章数据。Upload badge data

build 服务

接口 描述
BuildCrontabSync 同步仓库分支下的定时任务。 Synchronize the content under the repository branch.
BuildLogsDelete 删除流水线日志内容。Delete pipeline logs content.
BuildRunnerDownloadLog 流水线runner日志下载。Pipeline runner log download.
GetBuildLogs 查询流水线构建列表。List pipeline builds.
GetBuildStage 查询流水线Stage详情。Get pipeline build stage detail.
GetBuildStatus 查询流水线构建状态。Get pipeline build status.
StartBuild 开始一个构建。Start a build.
StopBuild 停止一个构建。 Stop a build.

charge 服务

接口 描述
GetSpecialAmount 查看特权额度

event 服务

接口 描述
GetEvents 获取仓库动态预签名地址,并返回内容。Get events pre-signed URL and return content.

followers 服务

接口 描述
GetFollowersByUserID 获取指定用户的粉丝列表。Get the followers list of specified user.
GetFollowingByUserID 获取指定用户的关注人列表。Get the list of users that the specified user is following.

git 服务

接口 描述
CreateBlob 创建一个 blob。Create a blob.
CreateBranch 创建新分支。Create a new branch based on a start point.
CreateBranchLock 锁定分支
CreateTag 创建一个 tag。Create a tag.
DeleteBranch 删除指定分支。Delete the specified branch.
DeleteBranchLock 解除锁定分支
DeleteCommitAnnotation 删除指定 commit 的元数据。Delete commit annotation.
DeleteCommitAsset 删除指定 commit 的附件。Delete commit asset.
DeleteTag 删除指定 tag。Delete the specified tag.
DeleteTagAnnotation 删除指定 tag 的元数据。Delete the metadata of the specified tag.
GetArchive 下载仓库内容
GetArchiveCommitChangedFiles 打包下载 commit 变更文件。Download archive of changed files for a commit.
GetArchiveCompareChangedFiles 打包下载两次 ref 之间的变更文件。Download archive of changed files for a compare.
GetBranch 查询指定分支。Get a branch.
GetCommit 查询指定 commit。Get a commit.
GetCommitAnnotations 查询指定 commit 的元数据。Get commit annotations.
GetCommitAnnotationsInBatch 查询指定 commit 的元数据。Get commit annotations in batch.
GetCommitAssets 发起一个获取 commits 附件的请求, 302到有一定效期的下载地址。Get a request to fetch a commit assets and returns 302 redirect to the assets URL with specific valid time.
GetCommitAssetsBySha 查询指定 commit 的附件。List commit assets.
GetCommitStatuses 查询指定 commit 的提交状态。List commit check statuses.
GetCompareCommits 比较两个提交、分支或标签之间差异的接口。Compare two commits, branches, or tags.
GetContent 查询仓库文件列表或文件。List repository files or file.
GetContentWithoutPath 查询仓库文件和目录内容。List repository files and directories.
GetHead 获取仓库默认分支。Get the default branch of the repository.
GetPresignedLFSDownloadLink 获取 git lfs 文件下载链接
GetRaw 获得仓库指定文件内容
GetTag 查询指定 tag。Get a tag.
GetTagAnnotations 查询指定 tag 的元数据。Query the metadata of the specified tag.
ListBranches 查询分支列表。List branches.
ListCommits 查询 commit 列表。List commits.
ListTags 查询 tag 列表。List tags.
PostCommitAssetUploadConfirmation 确认 commit 附件上传完成。Confirm commit asset upload.
PostCommitAssetUploadURL 新增一个 commit 附件。Create a commit asset.
PutCommitAnnotations 设定指定 commit 的元数据。Put commit annotations.
PutTagAnnotations 设定指定 tag 的元数据。Set the metadata of the specified tag.

gitsettings 服务

接口 描述
DeleteBranchProtection 删除仓库保护分支规则。 Delete branch protection rule.
GetBranchProtection 查询仓库保护分支规则。Get branch protection rule.
GetPipelineSettings 查询仓库云原生构建设置。List pipeline settings.
GetPullRequestSettings 查询仓库合并请求设置。List pull request settings.
GetPushLimitSettings 查询仓库推送设置。List push limit settings.
ListBranchProtections 查询仓库保护分支规则列表。List branch protection rules.
PatchBranchProtection 更新仓库保护分支规则。Update branch protection rule.
PostBranchProtection 新增仓库保护分支规则。Create branch protection rule.
PutPipelineSettings 更新仓库云原生构建设置。Update pipeline settings.
PutPullRequestSettings 更新仓库合并请求设置。Set pull request settings.
PutPushLimitSettings 设置仓库推送设置。Set push limit settings.

issues 服务

接口 描述
CanUserBeAssignedToIssue 检查用户是否可以被添加到 issue 的处理人中。 Checks if a user can be assigned to an issue.
CreateIssue 创建一个 Issue。Create an issue.
DeleteIssueAssignees 删除 issue 中的处理人。 Removes one or more assignees from an issue.
DeleteIssueLabel 删除 issue 标签。Remove a label from an issue.
DeleteIssueLabels 清空 issue 标签。Remove all labels from an issue.
GetIssue 查询指定的 Issues。Get an issue.
GetIssueComment 获取指定 issue 评论。Get an issue comment.
GetIssueFiles 获取 Issue 文件,返回文件二进制内容。Request to retrieve file of issues, returns binary content.
GetIssueImgs 获取 Issue 图片,返回图片二进制内容。Request to retrieve image of issues, returns binary content.
GetIssueProperties 查询指定Issue的自定义属性列表。Get issue custom properties.
ListIssueActivities 查询指定 Issue 的 Timeline Activity
ListIssueActivitiesLatest 查询某一动态之后的 Issue Activity
ListIssueAssignees 查询指定 issue 的处理人。 List repository issue assignees.
ListIssueComments 查询仓库的 issue 评论列表。List repository issue comments.
ListIssueLabels 查询 issue 的标签列表。List labels for an issue.
ListIssues 查询仓库的 Issues。List issues.
ListRepoInvisibleProperties 查询仓库不可见的自定义属性列表。List repository invisible custom properties.
ListRepoVisibleProperties 查询仓库可见的自定义属性列表。List repository visible custom properties.
ListUserIssues 查询当前用户相关的 Issues。List issues for the authenticated user across all repositories.
PatchIssueAssignees 更新 issue 中的处理人。 Updates the assignees of an issue.
PatchIssueComment 修改一个 issue 评论。Update an issue comment.
PostIssueAssignees 添加处理人到指定的 issue。 Adds up to assignees to a issue, Users already assigned to an issue are not replaced.
PostIssueComment 创建一个 issue 评论。Create an issue comment.
PostIssueCommentFileAssetUploadURL 创建一个 Issue 评论的文件上传 url。请使用 put 发起流式上传到 upload_url 地址。上传完成后将 asset_link 添加到创建评论请求的 body 中。 Create a file upload URL for an Issue comment. Please use put to initiate a stream upload to the upload_url address. After uploading, add the asset_link to the body of the create comment request.
PostIssueCommentImageAssetUploadURL 创建一个 Issue 评论的图片上传 url。请使用 put 发起流式上传到 upload_url 地址。上传完成后将 asset_link 添加到创建评论请求的 body 中。Create an image upload URL for an Issue comment. Please use put to initiate a stream upload to the upload_url address. After uploading, add the asset_link to the body of the create comment request.
PostIssueLabels 新增 issue 标签。Add labels to an issue.
PutIssueLabels 设置 issue 标签。 Set the new labels for an issue.
UpdateIssue 更新一个 Issue。Update an issue.
UpdateIssueProperties 批量更新Issue自定义属性值

knowledgebase 服务

接口 描述
DeleteKnowledgeBase 删除知识库
GetKnowledgeBaseInfo 获取知识库信息
GetModels 获取当前支持的 Embedding 模型列表
QueryKnowledgeBase 查询知识库,使用文档:https://docs.cnb.cool/zh/ai/knowledge-base.html
SearchNpc 全局语义搜索 NPC 角色

members 服务

接口 描述
AddMembersOfGroup 添加成员。Add members.
AddMembersOfMission 添加成员。Add members.
AddMembersOfRegistry 添加成员。Add members.
AddMembersOfRepo 添加成员。Add members.
DeleteMembersOfGroup 删除指定组织的直接成员。Remove direct members from specified organization.
DeleteMembersOfRepo 删除指定仓库的直接成员。Remove direct members from specified repository.
DeleteOutsideCollaborators 删除指定仓库的外部贡献者。Removes external contributors from specified repository.
GetMemberAccessLevelOfGroup 获取指定组织内, 访问成员在当前层级内的权限信息。Get permission information for accessing members at current level.
GetMemberAccessLevelOfRepo 获取指定仓库内, 访问成员在当前层级内的权限信息。Get permission information for accessing members at current level.
ListAllMembers 获取指定仓库内的有效成员列表,包含继承成员。List active members in specified repository including inherited members.
ListInheritMembersOfGroup 获取指定组织的继承成员。List inherited members within specified organization
ListInheritMembersOfRepo 获取指定仓库内的继承成员。List inherited members within specified repository。
ListMemberAccessLevelOfGroup 获取指定组织内指定成员的权限信息, 结果按组织层级来展示, 包含上层组织的权限继承信息。Get specified member's permissions with organizational hierarchy.
ListMemberAccessLevelOfRepo 获取指定仓库内指定成员的权限信息, 结果按组织层级来展示, 包含上层组织的权限继承信息。Get specified member's permissions with organizational hierarchy.
ListMembersOfGroup 获取指定组织内的所有直接成员。List all direct members within specified organization.
ListMembersOfRepo 获取指定仓库内的所有直接成员。List all direct members within specified repository.
ListOutsideCollaborators 获取指定仓库内的外部贡献者。List external contributors in specified repository.
UpdateMembersOfGroup 更新指定组织的直接成员权限信息。Update permission information for direct members in specified organization.
UpdateMembersOfRepo 更新指定仓库内的直接成员权限信息。Update permission information for direct members in specified repository.
UpdateOutsideCollaborators 更新指定仓库的外部贡献者权限信息。 Update permission information for external contributors in specified repository.

missions 服务

接口 描述
CreateMission 创建任务集。Create a mission.
DeleteMission 删除指定任务集。Delete the specified mission.
GetGroupSubMissions 查询组织下面用户有权限查看到的任务集。Query all missions that the user has permission to see under the specific organization.
GetMissionViewConfig 查询任务集视图配置信息。Get mission view config.
GetMissionViewList 获取任务集视图列表。Get view list of a mission.
PostMissionViewConfig 设置任务集视图配置信息。Set mission view config.
PostMissionViewList 排序任务集视图。Sort mission view list.
PutMissionViewList 添加、修改任务集视图。Update a mission view or add a new one.
SetMissionVisibility 改变任务集可见性。Update the visibility of a mission.

organizations 服务

接口 描述
CreateOrganization 创建新组织。Create new organization.
DeleteOrganization 删除指定组织。Delete the specified organization.
GetGroup 获取指定组织信息。Get information for the specified organization.
GetGroupSetting 获取指定组织的配置详情。Get the configuration details for the specified organization.
GetGroupsByUserID 获取指定用户拥有权限的顶层组织列表。 Get a list of top-level organizations that the specified user has permissions to access.
ListGroups 查询当前用户在指定组织下拥有指定权限的子组织列表。Get the list of sub-organizations that the current user has access to in the specified organization.
ListSubgroups 获取指定组织下的子组织列表。Get the list of sub-organizations under the specified organization.
ListTopGroups 获取当前用户拥有权限的顶层组织列表。Get top-level organizations list that the current user has access to.
TransferGroup 转移组织。Transfer an organization.
UpdateGroupSetting 更新指定组织的配置。Updates the configuration for the specified organization.
UpdateOrganization 更新组织信息, 可更新的内容为: 组织描述, 组织展示名称, 组织网站, 组织联系邮箱。Updates organization information including: description, display name, website URL and contact email.
UploadLogos 发起一个上传 logo 的请求,返回上传文件的url,请使用 put 发起流式上传。Initiate a request to upload logo,returns upload URL.Use PUT to initiate a stream upload.

pulls 服务

接口 描述
CanUserBeAssignedToPull 检查用户是否可以被添加到合并请求的处理人中。 Checks if a user can be assigned to a pull request.
DeletePullAssignees 删除合并请求中的处理人 Removes one or more assignees from a pull request.
DeletePullLabel 删除合并请求标签。Remove a label from a pull.
DeletePullLabels 清空合并请求标签。Remove all labels from a pull.
DeleteRepoFiles 删除 UploadFiles 上传的附件
DeleteRepoImgs 删除 UploadImgs 上传的图片
GetPrFiles 获取合并请求文件,返回文件二进制内容。Request to retrieve file of pull requests, returns binary content.
GetPrImgs 获取合并请求图片,返回图片二进制内容。Request to retrieve image of pull requests, returns binary content.
GetPull 查询指定合并请求。Get a pull request.
GetPullComment 获取一个合并请求评论。Get a pull comment.
ListPullAssignees 查询指定合并请求的处理人。List repository pull request assignees.
ListPullComments 查询合并请求评论列表。List pull comments requests.
ListPullCommitStatuses 查询 Pull Request 的状态检查
ListPullCommits 查询指定合并请求的提交列表。Lists the commits in a specified pull request.
ListPullFiles 查询指定合并请求的文件列表。Lists the files in a specified pull request.
ListPullLabels 查询指定合并请求的标签列表。List labels for a pull.
ListPullReviewComments 查询指定合并请求评审评论列表。List pull review comments.
ListPullReviews 查询特定合并请求的评审列表。List pull reviews.
ListPulls 查询合并请求列表。List pull requests.
ListPullsByNumbers 根据 number 列表查询合并请求列表。List pull requests by numbers.
MergePull 合并一个合并请求。Merge a pull request.
PatchPull 更新一个合并请求。Update a pull request.
PatchPullComment 更新一个合并请求评论。Update a pull comment.
PostPull 新增一个合并请求。Create a pull request.
PostPullAssignees 添加处理人到指定的合并请求。 Adds up to assignees to a pull request. Users already assigned to an issue are not replaced.
PostPullComment 新增一个合并请求评论。Create a pull comment.
PostPullLabels 新增合并请求标签。Add labels to a pull.
PostPullRequestReviewReply 回复一个 review 评审
PostPullReview 新增一次合并请求评审。Create a pull review.
PutPullLabels 设置合并请求标签。Set the new labels for a pull.
UploadFiles 发起一个上传 files 的请求,返回上传文件的url,请使用 put 发起流式上传。Initiate a request to upload files,returns upload URL.Use PUT to initiate a stream upload.
UploadImgs 发起一个上传 imgs 的请求,返回上传文件的url,请使用 put 发起流式上传。Initiate a request to upload images,returns upload URL.Use PUT to initiate a stream upload.

rank 服务

接口 描述
GetLanguageList 获取排行榜语言
GetRepoAnnualRank 获取公仓年榜
GetRepoDailyRank 获取公仓日榜
GetRepoMonthlyRank 获取公仓月榜
GetRepoWeeklyRank 获取公仓周榜

registries 服务

接口 描述
DeletePackage 删除制品。 Delete the specific package.
DeletePackageTag 删除制品标签。 Delete the specific tag under specific package
DeleteRegistry 删除制品库。Delete the registry.
GetGroupSubRegistries 查询组织下面用户有权限查看到的制品仓库。Query all registries that the user has permission to see under specific organization.
GetPackage 获取指定制品的详细信息。 Get the package detail.
GetPackageTagDetail 获取制品标签详情。 Get the specific tag under specific package.
GetPackageTagProvenance 获取制品标签的出生证明。 Get the specific tag provenance under specific package.
ListPackageTags 查询制品标签列表。 List all tags under specific package.
ListPackages 查询制品列表。 List all packages.
SetRegistryVisibility 改变制品仓库可见性。Update visibility of registry.

releases 服务

接口 描述
DeleteRelease 删除指定的 release。Delete a release.
DeleteReleaseAsset 删除指定的 release 附件 the specified release asset.
GetLatestRelease 查询最新的 release。Query the latest release.
GetReleaseAsset 查询指定的 release 附件 the specified release asset.
GetReleaseByID 根据 id 查询指定 release, 包含附件信息。Get a release by id, include assets information.
GetReleaseByTag 通过 tag 查询指定 release,包含附件信息。Get a release by tag, include assets information.
GetReleasesAsset 发起一个获取 release 附件的请求, 302到有一定效期的下载地址。Get a request to fetch a release assets and returns 302 redirect to the assets URL with specific valid time.
ListReleases 查询 release 列表。List releases.
PatchRelease 更新 release。Update a release.
PostRelease 新增一个 release。Create a release.
PostReleaseAssetUploadConfirmation 确认 release 附件上传完成。Confirm release asset upload.
PostReleaseAssetUploadURL 新增一个 release 附件。Create a release asset.

repocodeissue 服务

接口 描述
GetCodeIssueDetailOpenAPI 获取源码扫描问题详情
ListCodeIssueOpenAPI 获取源码扫描问题列表

repocontributor 服务

接口 描述
GetRepoContributorTrend 查询仓库贡献者前 100 名的详细趋势数据。Query detailed trend data for top 100 contributors of the repository.

repolabels 服务

接口 描述
DeleteLabel 删除指定的仓库标签。Delete the specified repository label.
ListLabels 查询仓库的标签列表。List repository labels.
PatchLabel 更新标签信息。Update label information.
PostLabel 创建一个 标签。Create a label.

repositories 服务

接口 描述
ArchiveRepo 仓库归档。Archive a repository.
CreateRepo 创建仓库。Create repositories.
DeleteRepo 删除指定仓库。Delete the specified repository.
GetByID 获取指定仓库信息。Get information for the specified repository.
GetGroupSubRepos 查询组织下访问用户有权限查看到仓库。List the repositories that the user has access to.
GetPinnedRepoByGroup 获取指定组织的仓库墙列表。List the pinned repositories of a group.
GetPinnedRepoByID 获取指定用户的用户仓库墙。 Get a list of repositories that the specified user has pinned.
GetRepos 获取当前用户拥有指定权限及其以上权限的仓库。List repositories owned by the current user with the specified permissions or higher.
GetReposByUserName 获取指定用户有指定以上权限并且客人态可见的仓库。List repositories where the specified user has the specified permission level or higher and are visible to guests.
ListForksRepos 获取指定仓库的 fork 列表。Get fork list for specified repository.
SetPinnedRepoByGroup 更新指定组织仓库墙。Update the pinned repositories of a group.
SetRepoVisibility 改变仓库可见性。Update visibility of repository.
TransferRepo 转移仓库。Transfer a repository.
UnArchiveRepo 解除仓库归档。Unarchive a repository.
UpdateRepo 更新仓库信息, 可更新的内容为: 仓库简介, 仓库站点, 仓库主题, 开源许可证。updates repository details including description, website URL,topics and license type.

search 服务

接口 描述
ListPublicRepos Search resource with the key

security 服务

接口 描述
GetRepoSecurityOverview 查询仓库安全模块概览数据。Query the security overview data of a repository

starring 服务

接口 描述
GetUserAllStaredRepos 获取当前用户 star 的仓库列表。List all stared repositories.
GetUserStaredRepos 获取指定用户的 star 仓库列表。Get the list of repositories starred by the specified user.
ListStarUsers 获取指定仓库的star用户列表。Get the list of users who starred the specified repository.

users 服务

接口 描述
AutoCompleteSource 查询当前用户用户拥有指定权限的所有资源列表。List resources that the current user has specified permissions for.
GetUserInfo 获取指定用户的详情信息。Get detailed information for a specified user.
GetUserInfoByName 获取指定用户的详情信息。Get detailed information for a specified user.
ListEmail 获取用户邮箱列表
ListGPGKeys 获取用户 GPG keys 列表。List GPG Keys.
UpdateUserInfo 更新指定用户的详情信息。Updates the specified user's profile information.

workspace 服务

接口 描述
DeleteWorkspace 删除我的云原生开发环境。Delete my workspace.
GetWorkspaceDetail 根据流水线sn查询云原生开发访问地址。Query cloud-native development access address by pipeline SN.
ListWorkspaces 获取我的云原生开发环境列表。List my workspaces.
StartWorkspace 启动云原生开发环境,已存在环境则直接打开,否则重新创建开发环境。Start cloud-native dev. Opens existing env or creates a new one.
WorkspaceStop 停止/关闭我的云原生开发环境。Stop/close my workspace.

使用指南

1. 获取访问令牌

在调用任何 API 之前,需要先获取有效的 CNB_TOKEN。

2. 构造请求

所有请求都需要包含以下基础头信息:

Accept: application/vnd.cnb.api+json
Authorization: Bearer $CNB_TOKEN

3. 处理响应

API 返回标准的 JSON 格式响应。请根据 HTTP 状态码判断请求是否成功:

  • 200: 请求成功
  • 400: 请求参数错误
  • 401: 未授权
  • 403: 禁止访问
  • 404: 资源不存在
  • 500: 服务器内部错误

调用示例

基础 GET 请求示例

curl -w '%header{traceparent}' -X GET 
  "${CNB_API_ENDPOINT}/api/endpoint" 
  -H "Accept: application/vnd.cnb.api+json" 
  -H "Authorization: Bearer $CNB_TOKEN"

带参数的 POST 请求示例

curl -w '%header{traceparent}' -X POST 
  "${CNB_API_ENDPOINT}/api/endpoint" 
  -H "Accept: application/vnd.cnb.api+json" 
  -H "Authorization: Bearer $CNB_TOKEN" 
  -H "Content-Type: application/json" 
  -d '{"key": "value"}'

注意事项

  1. 所有 API 调用都需要有效的认证令牌
  2. 请求和响应数据格式为 JSON
  3. 请根据具体 API 文档中的参数要求构造请求
  4. 建议在生产环境中添加适当的错误处理和重试机制

本文档基于 Swagger 文件自动生成:https://api.cnb.cool/swagger.json

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,035
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,031
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,019
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,017
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,014
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,014
Skill 文件
  • SKILL.md
    • CNB API 技能文档
    • 技能概述
    • 页面 URL 解析规则
    • 基础配置
    • API 接口索引
      • activities 服务
      • ai 服务
      • assets 服务
      • badge 服务
      • build 服务
      • charge 服务
      • event 服务
      • followers 服务
      • git 服务
      • gitsettings 服务
      • issues 服务
      • knowledgebase 服务
      • members 服务
      • missions 服务
      • organizations 服务
      • pulls 服务
      • rank 服务
      • registries 服务
      • releases 服务
      • repocodeissue 服务
      • repocontributor 服务
      • repolabels 服务
      • repositories 服务
      • search 服务
      • security 服务
      • starring 服务
      • users 服务
      • workspace 服务
    • 使用指南
      • 1. 获取访问令牌
      • 2. 构造请求
      • 3. 处理响应
    • 调用示例
      • 基础 GET 请求示例
      • 带参数的 POST 请求示例
    • 注意事项
  • 项目或源文件

相关 Skill

更多
service-qa-coach service-qa-coach Review support quality for chat, email, phone, social DM, or marketplace service teams. Use when a team needs a QA scorecard, failure-mode analysis, coaching plan, calibration checklist, or service-improvement brief without live ticketing, CRM, or contact-center system access.
高中数学作业批改助手 高中数学作业批改助手 >图片识别 直接读取学生手写作答照片,识别公式、符号、步骤 🧮 自动推导 根据题目自动生成参考答案和评分细则,无需教师预设 📊 逐步给分 每个关键步骤独立评分,体现过程分 📝 结构化报告 输出含识别内容、参考答案、逐步评分、改进建议的完整报告 🗂 批量批改 支持一次性批改多道题,最终汇总得分表
Vibration Analysis Vibration Analysis 分析来自CMS趋势、RMS/峰值、频谱及SCADA报警的风机传动链(主轴、齿轮箱、发电机)振动数据。
Traditional Bone Tool Making Basics Traditional Bone Tool Making Basics Use when you need custom, durable, repairable tools like awls, needles, scrapers, harpoons, or fishing hooks made from local animal bones or antlers and comm...
音频混音工具 音频混音工具 名称:Sound Mixing Tool(标识 sound-mixing-tool) 短简介(≤60字):音乐/音效响度精确对齐 + 融合混音工作流:用 ffmpeg 两段式 loudnorm 把多组素材 LUFS 偏差压到 <0.10,再最小干预融合、导出可进引擎的独立分轨。 标签/关键词:音频混音 响度匹配 LUFS ffmpeg 游戏音频 音效设计 Wwise FMOD 分轨导出 后期处理 触发词:混音 · 响度匹配 · LUFS 对齐 · MIX 版本 · 音乐音效分轨 · 融合 · 不打架 · 不能盖住 适用场景 :游戏音频集成、影视短视频配乐、播客后期