////
  Copyright 2009-2023 Roland Huss

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
////

[#version]
=== Getting the agent version (version)

The Jolokia command `version` returns the version of
the Jolokia agent along with the protocol version.

[#get-version]
==== GET version request

The GET URL for a version request has the following format:

----
<base-url>/version
----

For GET request the `version` part can be
omitted since this is the default command if no command is
provided as path info.

[#post-version]
==== POST version request

A version POST request has only a single key
`type` which has to be set to
*`version`*.

[#response-version]
==== Version response

The response value for a version request looks like:

[,json,subs="attributes,verbatim"]
----
{
  "request": {
    "type": "version"
  },
  "value": {
    "agent": "2.5.0",
    "protocol": "8.2",
    "decorators": {},
    "details": {
      "agent_version": "2.5.0",
      "agent_id": "jolokia-7778",
      "secured": false,
      "url": "http://192.168.0.166:7778/jolokia"
    },
    "id": "jolokia-7778",
    "config": {
      "maxDepth": "15",
      "discoveryEnabled": "true",
      "maxCollectionSize": "0",
      "agentId": "jolokia-7778",
      "debug": "true",
      "canonicalNaming": "false",
      "dateFormat": "yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSSXXX",
      "agentContext": "/jolokia",
      "historyMaxEntries": "10",
      "maxObjects": "0",
      "debugMaxEntries": "100"
    },
    "info": {
      "proxy": {},
      "jmx": {}
    }
  },
  "status": 200,
  "timestamp": 1770638947
}
----

NOTE:: Since Jolokia 2.1.0 we can use `includeRequest` parameter to tell Jolokia to exclude `request` field from the response.

`protocol` in the response value contains the
protocol version used, `agent` is the version of
the Jolokia agent. See xref:jolokia_protocol.adoc#versions[Jolokia protocol versions] for the various
protocol versions and the interoperability. If the agent is able
to detect the server, additional meta information about this
server is returned (i.e. the product name, the vendor and
optionally some extra information added by the server detector).
