支持三位或四位八进制、九字符符号权限,以及 setuid、setgid 和 sticky 特殊权限。 访问类别:匿名 API,可携带 Token 使用独立额度
请求参数
modequery必填- string · 最短:3 字符 · 最长:9 字符
_formatquery- 响应格式为 json 或 text;_format=svg 返回 JSON。plain 是 text 的别名。未识别的值继续按 Accept 协商。
- string · 可选:json、text
_colorquery- 控制 text 响应的 ANSI 颜色。0、false、off、no 关闭;省略或其他值保留。
- string · 可选:0、false、off、no
路径兼容入口
GET /chmod/{mode}
将 mode 的值进行 URL 编码后填入路径。
响应
application/json
{
"type": "object",
"properties": {
"octal": {
"type": "string"
},
"symbolic": {
"type": "string"
},
"permissions": {
"type": "object",
"properties": {
"owner": {
"type": "object",
"properties": {
"read": {
"type": "boolean"
},
"write": {
"type": "boolean"
},
"execute": {
"type": "boolean"
}
},
"required": [
"read",
"write",
"execute"
]
},
"group": {
"type": "object",
"properties": {
"read": {
"type": "boolean"
},
"write": {
"type": "boolean"
},
"execute": {
"type": "boolean"
}
},
"required": [
"read",
"write",
"execute"
]
},
"others": {
"type": "object",
"properties": {
"read": {
"type": "boolean"
},
"write": {
"type": "boolean"
},
"execute": {
"type": "boolean"
}
},
"required": [
"read",
"write",
"execute"
]
},
"setuid": {
"type": "boolean"
},
"setgid": {
"type": "boolean"
},
"sticky": {
"type": "boolean"
}
},
"required": [
"owner",
"group",
"others",
"setuid",
"setgid",
"sticky"
]
}
},
"required": [
"octal",
"symbolic",
"permissions"
]
}application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}响应示例
成功响应
curl -sS 'https://oit.sh/chmod/755?_format=json'HTTP 200
content-type: application/json
content-encoding: gzip
cache-control: no-store
{
"octal": "755",
"symbolic": "rwxr-xr-x",
"permissions": {
"owner": {
"read": true,
"write": true,
"execute": true
},
"group": {
"read": true,
"write": false,
"execute": true
},
"others": {
"read": true,
"write": false,
"execute": true
},
"setuid": false,
"setgid": false,
"sticky": false
}
}错误示例
curl -sS 'https://oit.sh/chmod?mode=invalid+value&_format=json'HTTP 400
content-type: application/json
content-encoding: gzip
cache-control: no-store
{
"error": {
"code": "INVALID_INPUT",
"message": "参数无效",
"issues": [
{
"location": "query",
"field": "mode",
"code": "too_big",
"message": "字符数最多为 9"
}
]
}
}curl 访问示例
curl、wget、HTTPie 默认得到 text/plain。示例展示纯文本输出。
命令与输出
curl -sS 'https://oit.sh/chmod/755?_color=0'HTTP 200
content-type: text/plain; charset=utf-8
content-encoding: gzip
cache-control: no-store
octal: 755
symbolic: rwxr-xr-x
permissions:
owner:
read: true
write: true
execute: true
group:
read: true
write: false
execute: true
others:
read: true
write: false
execute: true
setuid: false
setgid: false
sticky: false
在线调试
curl -X GET 'https://oit.sh/chmod?mode=755'
响应
等待发送请求