Skip to content

Latest commit

 

History

History
71 lines (60 loc) · 1.77 KB

README.md

File metadata and controls

71 lines (60 loc) · 1.77 KB

API

The Graylog API follows a generated, slightly modified Swagger 1.2 format (read: not Swagger 2.0; not OpenAPI 3.0).

The Swagger doc can be found at <graylog server>/api/api-browser.

API Version

  • 2.4.0-beta.3+a6b18a2

How-to: Codegen

NOTE: What follows is awkward.

  1. Install Node-based api-spec-converter.
npm install api-spec-converter
  1. Patch the local swagger-converter module dependency with this simple diff.

  2. Convert.

NOTE: Assumes locally running Graylog of chosen version.

api-spec-converter http://localhost:9000/api/api-docs --from=swagger_1 --to=swagger_2 > swagger.json
  1. Edit swagger.json and delete the following definitions (counts as of 2.4):

    • AuthenticationConfig (3)
    • Metric (1)
    • CollectorInput (2)
    • MetricRegistry (1)
    • JsonSchema (1)
    • LookupResult (2)
    • ResultMessage (2)
    • Multimap (1)
    • CollectorConfiguration (5)
    • CollectorConfigurationSnippet (2)
    • Collection (4)
    • CollectorOutput (2)
    • ChunkedOutput (2)
    • CollectorConfigurationListResponse (1)
  2. Rename:

    • RestBoolean --> boolean
  3. Add basic authentication underneath schemes.

  "securityDefinitions": {
    "basicAuth": {
      "type": "basic"
    }
  },
  "security": [
    {
      "basicAuth": []
    }
  ],
  1. Grab Golang dependencies.
go get -u github.com/go-openapi/runtime
go get -u golang.org/x/net/context
go get -u golang.org/x/net/context/ctxhttp
go get -u golang.org/x/net/context/ctxhttp
go get -u github.com/go-swagger/go-swagger/cmd/swagger
  1. Golang Codegen.
swagger generate client --skip-validation -A go-graylog
  1. Rename Java-ey reverse domain name notation packages in pkg/plugins_*.