Skip to content

Conversions

This resource is a simple Unit of Measure converter. The converted values can be returned as plain text, JSON, XML, HTML, CLOD or YAML. It is a good example of when an API expects input data to return a simple output in the response data.

Resource

https://rest.omegatower.ninja/toolbox/v1/conversions

Methods Allowed

GET, HEAD

Available Response Representations

200 OK

  • text/plain; charset=UTF-8
  • text/html; charset=UTF-8
  • application/xml
  • application/json
  • application/x-clod
  • application/x-yaml

400 Bad Request

  • text/plain; charset=UTF-8
  • text/html; charset=UTF-8
  • application/xml
  • application/json
  • application/x-clod
  • application/x-yaml

Request Query Parameters

Test Mode

Sending the Test parameter will return to the user in the "test" section all the possible parameters with their current values. This can be used to verify that you are able to successfully connect to the resource. It will be returned formatted as defined by the Output parameter. If none is sent, "false" is assumed.

Output Parameter

This parameter defines how the conversions are to be returned to the user. Values of "text", "verbose", "json", "xml", "html", "clod" or "yaml" are allowed. If none is sent, "text" is assumed.

Value Parameter

This parameter defines the value to be converted. If none is sent, 1 is assumed.

Unit of Measure 1 Parameter

This parameter defines the Unit of Measure converting from. Values of "kilometer", "meter", "centimeter", "mile", "foot", "inch", "kilogram", "gram", "milligram", "ton", "pound", "ounce", "kiloliter", "liter", "milliliter", "gallon", "quart", "pint", "cup", "tablespoon" or "teaspoon" are allowed. If none is sent, "foot" is assumed.

Unit of Measure 2 Parameter

This parameter defines the Unit of Measure converting to. Values of "kilometer", "meter", "centimeter", "mile", "foot", "inch", "kilogram", "gram", "milligram", "ton", "pound", "ounce", "kiloliter", "liter", "milliliter", "gallon", "quart", "pint", "cup", "tablespoon" or "teaspoon" are allowed. If none is sent, "meter" is assumed.

Schemas

JSON

conversions-schema.json

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "https://toolbox.omegatower.ninja/schemas/v1/conversions-schema.json",
    "type": "object",
    "title": "Toolbox Resources Conversions Schema",
    "description": "Version 1.2.0.13",
    "additionalProperties": false,
    "properties": {
        "conversions": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "test": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                        "parameter_test": {
                            "type": "boolean"
                        },
                        "parameter_output": {
                            "type": "string"
                        },
                        "parameter_value": {
                            "type": "number"
                        },
                        "parameter_uom1": {
                            "type": "string"
                        },
                        "parameter_uom2": {
                            "type": "string"
                        }
                    }
                },
                "data": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                        "result": {
                            "type": "number"
                        }
                    }
                },
                "error": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                        "title": {
                            "type": "string"
                        },
                        "detail": {
                            "type": "string"
                        },
                        "resource_server": {
                            "type": "string"
                        },
                        "type": {
                            "type": "integer"
                        },
                        "source": {
                            "type": "string"
                        }
                    }
                },
                "links": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                        "about": {
                            "type": "string"
                        },
                        "openapi": {
                            "type": "string"
                        },
                        "swaggerhub": {
                            "type": "string"
                        },
                        "wadl": {
                            "type": "string"
                        },
                        "describedby": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "about",
                        "openapi",
                        "swaggerhub",
                        "wadl"
                    ]
                }
            },
            "required": [
                "test",
                "data",
                "error",
                "links"
            ]
        }
    },
    "required": [
        "conversions"
    ]
}

Conversions JSON Schema Diagram

XML

conversions.xsd

<?xml version="1.0" encoding="utf-8" ?>
<!-- Toolbox Resources Conversions Schema, Version 1.2.0.13 -->
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="conversions">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="test" minOccurs="1" maxOccurs="1">
                    <xs:complexType>
                        <xs:sequence minOccurs="0">
                            <xs:element name="parameter_test" type="xs:boolean" minOccurs="1" maxOccurs="1" />
                            <xs:element name="parameter_output" type="xs:token" minOccurs="1" maxOccurs="1" />
                            <xs:element name="parameter_value" type="xs:decimal" minOccurs="1" maxOccurs="1" />
                            <xs:element name="parameter_uom1" type="xs:token" minOccurs="1" maxOccurs="1" />
                            <xs:element name="parameter_uom2" type="xs:token" minOccurs="1" maxOccurs="1" />
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="data" minOccurs="1" maxOccurs="1">
                    <xs:complexType>
                        <xs:sequence minOccurs="0">
                            <xs:element name="result" type="xs:decimal" minOccurs="1" maxOccurs="1" />
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="error" minOccurs="1" maxOccurs="1">
                    <xs:complexType>
                        <xs:sequence minOccurs="0">
                            <xs:element name="title" type="xs:string" minOccurs="1" maxOccurs="1" />
                            <xs:element name="detail" type="xs:string" minOccurs="1" maxOccurs="1" />
                            <xs:element name="resource_server" type="xs:anyURI" minOccurs="1" maxOccurs="1" />
                            <xs:element name="type" type="xs:unsignedByte" minOccurs="1" maxOccurs="1" />
                            <xs:element name="source" type="xs:string" minOccurs="1" maxOccurs="1" />
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="links" minOccurs="1" maxOccurs="1">
                    <xs:complexType>
                        <xs:sequence minOccurs="0">
                            <xs:element name="about" type="xs:anyURI" minOccurs="1" maxOccurs="1" />
                            <xs:element name="openapi" type="xs:anyURI" minOccurs="1" maxOccurs="1" />
                            <xs:element name="swaggerhub" type="xs:anyURI" minOccurs="1" maxOccurs="1" />
                            <xs:element name="wadl" type="xs:anyURI" minOccurs="1" maxOccurs="1" />
                            <xs:element name="describedby" type="xs:anyURI" minOccurs="1" maxOccurs="1" />
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

Conversions XML Schema Diagram

Back to top