Uploaded image for project: 'Mesos'
  1. Mesos
  2. MESOS-2257

Version the Operator/Admin API

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 1.0.0
    • None

    Description

      As a consumer of the Mesos HTTP API, it is necessary for us to determine the current version of Mesos so that we can parse the JSON documents returned correctly (since they change from version to version).

      Currently we're doing this by fetching state.json, parsing it and pulling out the version field. A more idiomatic way to do this would be to filter on the content-type in the header itself.

      To give a more concrete example, currently the JSON documents returned by the HTTP API return the following headers:

      HTTP/1.1 200 OK
      Date: Fri, 23 Jan 2015 21:31:37 GMT
      Content-Length: 9352
      Content-Type: application/json
      

      Something like the following (e.g. for master/state.json) would be easy to switch upon:

      HTTP/1.1 200 OK
      Date: Fri, 23 Jan 2015 21:31:37 GMT
      Content-Length: 9352
      Content-Type: application/vnd.mesos.master.state.v0.20.1+json; charset=utf-8
      

      The vnd prefix is typically used for vendor specific file types (see: http://en.wikipedia.org/wiki/Internet_media_type#Prefix_vnd). Charset=utf-8 is required for JSON documents and is currently being omitted.

      This content-type would change for each document type, for example:

      application/vnd.mesos.master.state.v0.20.1+json; charset=utf-8
      application/vnd.mesos.master.stats.v0.20.1+json; charset=utf-8
      application/vnd.mesos.slave.state.v0.20.1+json; charset=utf-8
      application/vnd.mesos.slave.stats.v0.20.1+json; charset=utf-8
      

      Alternatively, the version could be appended as an extra field:

      application/vnd.mesos.master.state+json; charset=utf-8; version=v0.20.1
      application/vnd.mesos.master.stats+json; charset=utf-8; version=v0.20.1
      application/vnd.mesos.slave.state+json; charset=utf-8; version=v0.20.1
      application/vnd.mesos.slave.stats+json; charset=utf-8; version=v0.20.1
      

      Thanks!

      Attachments

        Issue Links

          Activity

            People

              vinodkone Vinod Kone
              ssk2hd Sunil Shah
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: