منصة الوكلاء وواجهات API Road User Tools
تحويل الطاقة
التحويل بين كيلووات، والقدرة الحصانية الميكانيكية، والقدرة الحصانية المترية (PS).
واجهات
POST
نقطة النهاية REST
/api/v1/power/convertMCP
اسم الأداة
convert_powerطلب
أرسل الطلب كـ JSON. يقوم عملاء MCP بتمرير نفس الحقول كوسيطات الأداة.
cURLshell
curl -X POST https://roaduser.tools/api/v1/power/convert \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"value": 150,
"from": "kw",
"to": "hp"
}'هيئة الطلبjson
{
"value": 150,
"from": "kw",
"to": "hp"
}الاستجابة
يقوم REST بتغليف نتيجة الحساب في مظروف النجاح القياسي. تقوم MCP بإرجاع نفس بيانات الحساب مثل مخرجات الأداة المنظمة.
JSON
{
"ok": true,
"data": {
"input": {
"value": 150,
"from": "kw",
"to": "hp"
},
"conversions": {
"kw": 150,
"hp": 201.1533134392542,
"ps": 203.94324259558564
},
"result": 201.1533134392542
}
}{
"ok": false,
"error": {
"code": "invalid_request",
"message": "Invalid request input."
}
}المخططات
توضح التعريفات أدناه مخطط JSON الكامل المستخدم للتحقق من صحة المدخلات ووصف المخرجات.
مخطط الإدخال
{
"type": "object",
"additionalProperties": false,
"properties": {
"value": {
"type": "number",
"description": "Power value to convert. Must be finite and non-negative."
},
"from": {
"type": "string",
"enum": [
"kw",
"hp",
"ps"
],
"description": "Input power unit. hp is mechanical horsepower; ps is metric horsepower (PS)."
},
"to": {
"type": "string",
"enum": [
"kw",
"hp",
"ps"
],
"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": [
"kw",
"hp",
"ps"
]
},
"to": {
"type": "string",
"enum": [
"kw",
"hp",
"ps"
]
}
},
"required": [
"value",
"from"
]
},
"conversions": {
"type": "object",
"additionalProperties": false,
"properties": {
"kw": {
"type": "number"
},
"hp": {
"type": "number"
},
"ps": {
"type": "number"
}
},
"required": [
"kw",
"hp",
"ps"
]
},
"result": {
"type": "number",
"description": "Target-unit result when a target unit is supplied."
}
},
"required": [
"input",
"conversions"
]
}