转换 2 至 36 进制整数

POST/radix/convert
公开访问curl

接受最多 4096 位带符号整数。结果以字符串返回并保留整数精度。 访问类别:匿名 API,可携带 Token 使用独立额度

请求参数

_formatquery
响应格式为 json 或 text;_format=svg 返回 JSON。plain 是 text 的别名。未识别的值继续按 Accept 协商。
string · 可选:json、text
_colorquery
控制 text 响应的 ANSI 颜色。0、false、off、no 关闭;省略或其他值保留。
string · 可选:0、false、off、no

请求体

application/json
text必填
string · 最长:4097 字符
from必填
integer · 最小值:2 · 最大值:36
to必填
integer · 最小值:2 · 最大值:36

响应

application/json

{
  "type": "object",
  "properties": {
    "text": {
      "type": "string"
    }
  },
  "required": [
    "text"
  ]
}

响应示例

成功响应

curl -sS --json '{"from":16,"to":10,"text":"ffffffffffffffff"}' https://oit.sh/radix/convert
HTTP 200
content-type: application/json
content-encoding: gzip
cache-control: no-store

{
  "text": "18446744073709551615"
}

错误示例

curl -sS --json '{}' https://oit.sh/radix/convert
HTTP 400
content-type: application/json
content-encoding: gzip
cache-control: no-store

{
  "error": {
    "code": "INVALID_INPUT",
    "message": "参数无效",
    "issues": [
      {
        "location": "body",
        "field": "text",
        "code": "invalid_type",
        "message": "需要 字符串 类型"
      },
      {
        "location": "body",
        "field": "from",
        "code": "invalid_type",
        "message": "需要 数字 类型"
      },
      {
        "location": "body",
        "field": "to",
        "code": "invalid_type",
        "message": "需要 数字 类型"
      }
    ]
  }
}

curl 访问示例

curl、wget、HTTPie 默认得到 text/plain。示例展示纯文本输出。

命令与输出

curl -sS --json '{"from":16,"to":10,"text":"ffffffffffffffff"}' 'https://oit.sh/radix/convert?_color=0&_format=text'
HTTP 200
content-type: text/plain; charset=utf-8
content-encoding: gzip
cache-control: no-store

text: 18446744073709551615

在线调试

必填
必填
必填
Ctrl / ⌘ + Enter
curl -X POST 'https://oit.sh/radix/convert' \
  -H 'Content-Type: application/json' \
  --data-raw '{"text":"ffffffffffffffff","from":16,"to":10}'

响应

等待请求

等待发送请求