Skip to content

Reflections

This resource will return to the user 3 types of information. First, it can return a simple message. Second, it can return information about the user's browser. Third, it can return information about the resource's server. The reflection can be returned as plain text, JSON, XML, HTML, CLOD or YAML. It is a good example of when an API can return different types of data objects in the response data based on the inputs.

Resource

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

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 reflections 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.

Content Parameter

This parameter defines what content is to be returned to the user. If "hello" is sent, then "Hello, World!" will be returned. If "client" is sent, then some information about the internet client used to connect to the resource is returned. If "server" is sent, then some information about the connection to the server is returned. If none is sent, "hello" is assumed.

Schemas

JSON

reflections-schema.json

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "https://toolbox.omegatower.ninja/schemas/v1/reflections-schema.json",
    "type": "object",
    "title": "Toolbox Resources Reflections Schema",
    "description": "Version 1.2.0.13",
    "additionalProperties": false,
    "properties": {
        "reflections": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "test": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                        "parameter_test": {
                            "type": "boolean"
                        },
                        "parameter_output": {
                            "type": "string"
                        },
                        "parameter_content": {
                            "type": "string"
                        }
                    }
                },
                "data": {
                    "oneOf": [
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {}
                        },
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                                "hello": {
                                    "type": "string"
                                }
                            },
                            "required": [
                                "hello"
                            ]
                        },
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                                "client": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                        "browser_name_regex": {
                                            "type": "string"
                                        },
                                        "browser_name_pattern": {
                                            "type": "string"
                                        },
                                        "parent": {
                                            "type": "string"
                                        },
                                        "platform": {
                                            "type": "string"
                                        },
                                        "comment": {
                                            "type": "string"
                                        },
                                        "browser": {
                                            "type": "string"
                                        },
                                        "device_type": {
                                            "type": "string"
                                        },
                                        "ismobiledevice": {
                                            "type": "string"
                                        },
                                        "istablet": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "browser_name_regex",
                                        "browser_name_pattern",
                                        "parent",
                                        "platform",
                                        "comment",
                                        "browser",
                                        "device_type",
                                        "ismobiledevice",
                                        "istablet"
                                    ]
                                }
                            },
                            "required": [
                                "client"
                            ]
                        },
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                                "server": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                        "http_accept": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "http_accept_encoding": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "http_accept_language": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "https": {
                                            "type": "string"
                                        },
                                        "remote_addr": {
                                            "type": "string"
                                        },
                                        "request_method": {
                                            "type": "string"
                                        },
                                        "request_time": {
                                            "type": "integer"
                                        },
                                        "server_name": {
                                            "type": "string"
                                        },
                                        "server_port": {
                                            "type": "string"
                                        },
                                        "server_protocol": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "http_accept",
                                        "http_accept_encoding",
                                        "http_accept_language",
                                        "https",
                                        "remote_addr",
                                        "request_method",
                                        "request_time",
                                        "server_name",
                                        "server_port",
                                        "server_protocol"
                                    ]
                                }
                            },
                            "required": [
                                "server"
                            ]
                        }
                    ]
                },
                "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": [
        "reflections"
    ]
}

reflections JSON Schema Diagram

XML

reflections.xsd

<?xml version="1.0" encoding="utf-8"?>
<!-- Toolbox Resources Reflections 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="reflections">
        <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_content" type="xs:token" minOccurs="1" maxOccurs="1" />
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="data" minOccurs="1" maxOccurs="1">
                    <xs:complexType>
                        <xs:choice minOccurs="0">
                            <xs:element name="hello" type="xs:string" minOccurs="1" maxOccurs="1" />
                            <xs:element name="client">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="browser_name_regex" type="xs:string" minOccurs="1" maxOccurs="1" />
                                        <xs:element name="browser_name_pattern" type="xs:string" minOccurs="1" maxOccurs="1" />
                                        <xs:element name="parent" type="xs:string" minOccurs="1" maxOccurs="1" />
                                        <xs:element name="platform" type="xs:string" minOccurs="1" maxOccurs="1" />
                                        <xs:element name="comment" type="xs:string" minOccurs="1" maxOccurs="1" />
                                        <xs:element name="browser" type="xs:string" minOccurs="1" maxOccurs="1" />
                                        <xs:element name="device_type" type="xs:string" minOccurs="1" maxOccurs="1" />
                                        <xs:element name="ismobiledevice" type="xs:string" minOccurs="1" maxOccurs="1" />
                                        <xs:element name="istablet" type="xs:string" minOccurs="1" maxOccurs="1" />
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                            <xs:element name="server">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="http_accept" type="xs:string" minOccurs="1" maxOccurs="1" />
                                        <xs:element name="http_accept_encoding" type="xs:string" minOccurs="1" maxOccurs="1" />
                                        <xs:element name="http_accept_language" type="xs:string" minOccurs="1" maxOccurs="1" />
                                        <xs:element name="https" type="xs:string" minOccurs="1" maxOccurs="1" />
                                        <xs:element name="remote_addr" type="xs:string" minOccurs="1" maxOccurs="1" />
                                        <xs:element name="request_method" type="xs:string" minOccurs="1" maxOccurs="1" />
                                        <xs:element name="request_time" type="xs:string" minOccurs="1" maxOccurs="1" />
                                        <xs:element name="server_name" type="xs:string" minOccurs="1" maxOccurs="1" />
                                        <xs:element name="server_port" type="xs:string" minOccurs="1" maxOccurs="1" />
                                        <xs:element name="server_protocol" type="xs:string" minOccurs="1" maxOccurs="1" />
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                        </xs:choice>
                    </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:token" 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>

reflections XML Schema Diagram

Back to top