Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-11603

Support REST API version negotiation

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Blocker Blocker
    • 3.3.0.CR1
    • 3.3.0.Beta3
    • openshift
    • None

      The latest REST api supports version negotiation:

      The client may indicate what service (protocol) version he'd like to use and the service would then use this version to talk to the client:

      Mail by Lili Nader on the 4.21.2012

      The rest api will return the latest version unless a version is explicitly requested by specifying it in HTTP Accept header in this format "Accept: application/xml; version=1.0"

      For example:
      curl -i -k https://localhost/broker/rest/api -H "Accept: application/xml; version=1.0"

      The api also returns a list of supported versions (right now the only supported version is 1.0):

      <?xml version="1.0" encoding="UTF-8"?>
      <response>
      <version>2.0</version>
      <supported-api-versions>
      <supported-api-version>1.0</supported-api-version>
      </supported-api-versions>
      </response>

      If the version requested in not supported then it will return a HTTP Status 406 and an error message as shown below.

      For example:
      curl -i -k https://localhost/broker/rest/api -H "Accept: application/xml; version=2.2"
      HTTP/1.1 406 Not Acceptable
      <?xml version="1.0" encoding="UTF-8"?>
      <response>
      <version>1.0</version>
      <messages>
      <message>
      <field nil="true"></field>
      <text>Requested API version 2.2 is not supported. Supported versions are 1.0</text>
      <exit-code/>
      <severity>error</severity>
      </message>
      </messages>
      <status>not_acceptable</status>
      <supported-api-versions>
      <supported-api-version>1.0</supported-api-version>
      </supported-api-versions>
      </response>

            adietish@redhat.com André Dietisheim
            adietish@redhat.com André Dietisheim
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: