{
    "swagger": "2.0",
    "info": {
        "title": "IBM MessageSight RESTMSG Sample",
        "description": "Publish messages to an IBM MessageSight server.",
        "version": "1"
    },
    "host": "kwb8:16109",
    "schemes": [
        "http",
        "https"
    ],
    "basePath": "/restmsg",
    "security": [
        {
            "UserCredentials": []
        }
    ],
    "tags": [
        {
            "name": "message",
            "description": "Publish and get messages"
        },
    ],
    "paths": {
        "/message/{topic}": {
            "parameters": [
                {
                    "name": "topic",
                    "in": "path",
                    "description": "The name of the topic",
                    "required": true,
                    "type": "string"
                },
                {
                    "name": "ClientID",
                    "in": "query",
                    "description": "The client ID for the connection",
                    "type": "string"
                }
            ],
            "post": {
                "tags": [
                    "message"
                ],
                "summary": "Publish a message to a topic",
                "description": "Publish a message to a topic",
                "parameters": [
                    {
                        "name": "message",
                        "in": "body",
                        "description": "The contents of the message",
                        "schema": {
                            "$ref": "#/definitions/MessageContents"
                        }
                    },
                    {
                        "name": "persist",
                        "in": "query",
                        "description": "Specifies that the message should be persisted",
                        "type": "boolean"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success"
                    },
                    "400": {
                        "description": "Bad request",
                        "schema": {
                            "$ref": "#/definitions/ErrorMessage"
                        }
                    },
                    "403": {
                        "description": "Not authorized",
                        "schema": {
                            "$ref": "#/definitions/ErrorMessage"
                        }
                    }
                }
            },
            "put": {
                "tags": [
                    "message"
                ],
                "summary": "Publish a retained message to a topic",
                "description": "Publish a retained message to a topic",
                "parameters": [
                    {
                        "name": "message",
                        "in": "body",
                        "description": "The contents of the message",
                        "schema": {
                            "$ref": "#/definitions/MessageContents"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success"
                    },
                    "400": {
                        "description": "Bad request",
                        "schema": {
                            "$ref": "#/definitions/ErrorMessage"
                        }
                    },
                    "403": {
                        "description": "Not authorized",
                        "schema": {
                            "$ref": "#/definitions/ErrorMessage"
                        }
                    }
                }
            },
            "get": {
                "tags": [
                    "message"
                ],
                "summary": "Get the retained message for a topic",
                "description": "Get the retained message for a topic",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "Topic": {
                                "description": "The topic on which the message was received",
                                "type": "string"
                            }
                        },
                        "schema": {
                            "$ref": "#/definitions/MessageContents"
                        }
                    },
                    "204": {
                        "description": "No message available"
                    },
                    "400": {
                        "description": "Bad request",
                        "schema": {
                            "$ref": "#/definitions/ErrorMessage"
                        }
                    },
                    "403": {
                        "description": "Not authorized",
                        "schema": {
                            "$ref": "#/definitions/ErrorMessage"
                        }
                    }
                }
            },
            "delete": {
                "tags": [
                    "message"
                ],
                "summary": "Delete the retained message for a topic",
                "description": "Delete the retained message for a topic",
                "responses": {
                    "200": {
                        "description": "Success"
                    },
                    "400": {
                        "description": "Bad request",
                        "schema": {
                            "$ref": "#/definitions/ErrorMessage"
                        }
                    },
                    "403": {
                        "description": "Not authorized",
                        "schema": {
                            "$ref": "#/definitions/ErrorMessage"
                        }
                    }
                }
            }
        }
    },
    "securityDefinitions": {
        "UserCredentials": {
            "type": "basic",
            "description": "The IBM MessageSight username and password.  The endpoint specifies whether the username and password are required."
        }
    },
    "definitions": {
        "MessageContents": {
            "type": "string"
        },
        "ErrorMessage": {
            "required": [
                "Code",
                "Message"
            ],
            "properties": {
                "Code": {
                    "type": "string",
                    "description": "The IBM MessageSight return code"
                },
                "Message": {
                    "type": "string",
                    "description": "The description associated with the return code"
                }
            }
        }
    }
}
