منصة الوكلاء وواجهات API Road User Tools
تحويل عزم الدوران
التحويل بين نيوتن متر ورطل-قدم.
واجهات
POST
نقطة النهاية REST
/api/v1/torque/convertMCP
اسم الأداة
convert_torqueطلب
أرسل الطلب كـ JSON. يقوم عملاء MCP بتمرير نفس الحقول كوسيطات الأداة.
cURLshell
curl -X POST https://roaduser.tools/api/v1/torque/convert \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"value": 400,
"from": "nm",
"to": "lbft"
}'هيئة الطلبjson
{
"value": 400,
"from": "nm",
"to": "lbft"
}الاستجابة
يقوم REST بتغليف نتيجة الحساب في مظروف النجاح القياسي. تقوم MCP بإرجاع نفس بيانات الحساب مثل مخرجات الأداة المنظمة.
JSON
{
"ok": true,
"data": {
"input": {
"value": 400,
"from": "nm",
"to": "lbft"
},
"conversions": {
"nm": 400,
"lbft": 295.0248597109062
},
"result": 295.0248597109062
}
}{
"ok": false,
"error": {
"code": "invalid_request",
"message": "Invalid request input."
}
}المخططات
توضح التعريفات أدناه مخطط JSON الكامل المستخدم للتحقق من صحة المدخلات ووصف المخرجات.
مخطط الإدخال
{
"type": "object",
"additionalProperties": false,
"properties": {
"value": {
"type": "number",
"description": "Torque value to convert. Must be finite and non-negative."
},
"from": {
"type": "string",
"enum": [
"nm",
"lbft"
],
"description": "Input torque unit."
},
"to": {
"type": "string",
"enum": [
"nm",
"lbft"
],
"description": "Optional target unit. When omitted, all units are returned."
}
},
"required": [
"value",
"from"
]
}مخطط الإخراج
{
"type": "object",
"additionalProperties": false,
"properties": {
"input": {
"type": "object",
"additionalProperties": false,
"properties": {
"value": {
"type": "number"
},
"from": {
"type": "string",
"enum": [
"nm",
"lbft"
]
},
"to": {
"type": "string",
"enum": [
"nm",
"lbft"
]
}
},
"required": [
"value",
"from"
]
},
"conversions": {
"type": "object",
"additionalProperties": false,
"properties": {
"nm": {
"type": "number"
},
"lbft": {
"type": "number"
}
},
"required": [
"nm",
"lbft"
]
},
"result": {
"type": "number",
"description": "Target-unit result when a target unit is supplied."
}
},
"required": [
"input",
"conversions"
]
}