Ardán Gníomhairí agus API Road User Tools
Tiontaigh barainneacht breosla
Tiontaigh idir MPG na RA, MPG SAM, lítear in aghaidh an 100 ciliméadar, agus ciliméadar in aghaidh an lítir.
Comhéadain
POST
Críochphointe REST
/api/v1/fuel-economy/convertMCP
Ainm uirlise
convert_fuel_economyIarratas
Seol an t-iarratas mar JSON. Pasann cliaint MCP na réimsí céanna le hargóintí uirlisí.
cURLshell
curl -X POST https://roaduser.tools/api/v1/fuel-economy/convert \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"value": 40,
"from": "mpg_uk",
"to": "l_per_100km"
}'Comhlacht iarrataisjson
{
"value": 40,
"from": "mpg_uk",
"to": "l_per_100km"
}Freagra
Fillteann REST an toradh ríofa sa chlúdach caighdeánach rathúlachta. Tugann MCP na sonraí ríofa céanna ar ais agus aschur uirlisí struchtúrtha.
JSON
{
"ok": true,
"data": {
"input": {
"value": 40,
"from": "mpg_uk",
"to": "l_per_100km"
},
"conversions": {
"mpg_uk": 40,
"mpg_us": 33.30696738515955,
"l_per_100km": 7.062023408295555,
"km_per_l": 14.160247597385885
},
"result": 7.062023408295555
}
}{
"ok": false,
"error": {
"code": "invalid_request",
"message": "Invalid request input."
}
}Scéimeanna
Léiríonn na sainmhínithe thíos Scéimre JSON iomlán a úsáidtear chun ionchuir a bhailíochtú agus chun cur síos a dhéanamh ar aschuir.
Scéimre ionchuir
{
"type": "object",
"additionalProperties": false,
"properties": {
"value": {
"type": "number",
"description": "Fuel economy value to convert. Must be finite and greater than zero."
},
"from": {
"type": "string",
"enum": [
"mpg_uk",
"mpg_us",
"l_per_100km",
"km_per_l"
],
"description": "Input fuel economy unit."
},
"to": {
"type": "string",
"enum": [
"mpg_uk",
"mpg_us",
"l_per_100km",
"km_per_l"
],
"description": "Optional target unit. When omitted, all units are returned."
}
},
"required": [
"value",
"from"
]
}Scéimre aschuir
{
"type": "object",
"additionalProperties": false,
"properties": {
"input": {
"type": "object",
"additionalProperties": false,
"properties": {
"value": {
"type": "number"
},
"from": {
"type": "string",
"enum": [
"mpg_uk",
"mpg_us",
"l_per_100km",
"km_per_l"
]
},
"to": {
"type": "string",
"enum": [
"mpg_uk",
"mpg_us",
"l_per_100km",
"km_per_l"
]
}
},
"required": [
"value",
"from"
]
},
"conversions": {
"type": "object",
"additionalProperties": false,
"properties": {
"mpg_uk": {
"type": "number"
},
"mpg_us": {
"type": "number"
},
"l_per_100km": {
"type": "number"
},
"km_per_l": {
"type": "number"
}
},
"required": [
"mpg_uk",
"mpg_us",
"l_per_100km",
"km_per_l"
]
},
"result": {
"type": "number",
"description": "Target-unit result when a target unit is supplied."
}
},
"required": [
"input",
"conversions"
]
}