Platfform Asiantau ac API Road User Tools
Trosi pwysedd teiars
Trosi rhwng punnoedd fesul modfedd sgwâr, bar, a chilopascals.
Rhyngwynebau
POST
Pwynt diwedd REST
/api/v1/pressure/convertMCP
Enw offeryn
convert_pressureCais
Anfonwch y cais fel JSON. Mae cleientiaid MCP yn pasio'r un meysydd ag argumentau'r offeryn.
cURLshell
curl -X POST https://roaduser.tools/api/v1/pressure/convert \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"value": 32,
"from": "psi",
"to": "bar"
}'Corff y caisjson
{
"value": 32,
"from": "psi",
"to": "bar"
}Ymateb
Mae REST yn amgáu canlyniad y cyfrifiad yn yr amlen lwyddiant safonol. Mae MCP yn dychwelyd yr un data cyfrifo fel allbwn offeryn strwythuredig.
JSON
{
"ok": true,
"data": {
"input": {
"value": 32,
"from": "psi",
"to": "bar"
},
"conversions": {
"psi": 32,
"bar": 2.2063223338137603,
"kpa": 220.632233381376
},
"result": 2.2063223338137603
}
}{
"ok": false,
"error": {
"code": "invalid_request",
"message": "Invalid request input."
}
}Sgemâu
Mae'r diffiniadau isod yn dangos y JSON Schema cyflawn a ddefnyddir i ddilysu mewnbynnau a disgrifio allbynnau.
Cynllun mewnbwn
{
"type": "object",
"additionalProperties": false,
"properties": {
"value": {
"type": "number",
"description": "Pressure value to convert. Must be finite and non-negative."
},
"from": {
"type": "string",
"enum": [
"psi",
"bar",
"kpa"
],
"description": "Input pressure unit."
},
"to": {
"type": "string",
"enum": [
"psi",
"bar",
"kpa"
],
"description": "Optional target unit. When omitted, all units are returned."
}
},
"required": [
"value",
"from"
]
}Cynllun allbwn
{
"type": "object",
"additionalProperties": false,
"properties": {
"input": {
"type": "object",
"additionalProperties": false,
"properties": {
"value": {
"type": "number"
},
"from": {
"type": "string",
"enum": [
"psi",
"bar",
"kpa"
]
},
"to": {
"type": "string",
"enum": [
"psi",
"bar",
"kpa"
]
}
},
"required": [
"value",
"from"
]
},
"conversions": {
"type": "object",
"additionalProperties": false,
"properties": {
"psi": {
"type": "number"
},
"bar": {
"type": "number"
},
"kpa": {
"type": "number"
}
},
"required": [
"psi",
"bar",
"kpa"
]
},
"result": {
"type": "number",
"description": "Target-unit result when a target unit is supplied."
}
},
"required": [
"input",
"conversions"
]
}