You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Gerald Kallas <ca...@mailbox.org.INVALID> on 2020/11/23 20:15:39 UTC

Camel K API Design

Dear all,

I've created a simple REST API (see below) and deployed this in an existing OpenShift cluster with the Camel-K Operator. The API can be reached under

http://hello-kamel.<cluster-host>/say/hello

The next steps are

  * change the URL (hello - app, kamel - project)
  * change the scheme to HTTPS
  * secure the API

I did search around but didn't find anything that helps. Maybe someone who is more familiar with Camel-K could help with the questions above?

Many thanks for any hints in advance.

Best
- Gerald

Attachments

api-hello.json

{
    "swagger": "2.0",
    "info": {
        "title": "HelloAPI",
        "description": "Hello API",
        "version": "1.0"
    },
    "host": "",
    "basePath": "/say/",
    "tags": [
        {
            "name": "Hello",
            "description": "HelloAPI"
        }
    ],
    "consumes": [
        "application/json"
    ],
    "produces": [
        "application/json"
    ],
    "paths": {
        "/hello": {
            "get": {
                "summary": "getHello",
                "description": "Get Message Hello World!",
                "operationId": "getHello",
                "responses": {
                    "200": {
                        "description": "Response",
                        "schema": {
                            "$ref": "#/definitions/HelloData"
                        }
                    }
                }
            }
        }
    },
    "definitions": {
        "HelloData": {
            "title": "Root Type for HelloData",
            "description": "Hello Data",
            "type": "object",
            "properties": {
                "message": {
                    "type": "string"
                }
            },
            "example": "{}"
        }
    }
}

api-hello.xml

<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://camel.apache.org/schema/spring"
        xsi:schemaLocation="
            http://camel.apache.org/schema/spring
            http://camel.apache.org/schema/spring/camel-spring.xsd">

	<route>
		<from uri="direct:getHello"/>
		<log message="getHello has been called."/>
		<setBody>
			<simple>Hello World!</simple>
		</setBody>
	</route>

</routes>

deployment

kamel run --name hello --property camel.rest.port=8080 --open-api hello-api.json hello-api.xml