Skip to content

Financial-Times/public-organisations-api

Repository files navigation

Public API for Organisation (public-organisation-api)

Provides a public API for Organisation stored in a Neo4J graph database

Organisations are being migrated to be served from the new Public Concepts API and as such this API will eventually be deprecated. From July 2018 requests to this service will be redirected via the concepts api then transformed to match the existing contract and returned.

Build & deployment etc:

_NB You will need to create a tagged release in order to build

Installation

Download the source code, dependencies and build the binary:

    go get -u github.com/Financial-Times/public-organisation-api
    cd $GOPATH/src/github.com/Financial-Times/public-organisation-api
    go install

To run the tests:

	go test -v -race ./...

Running locally

Usage: public-organisations-api [OPTIONS]

A public RESTful API for accessing organisations in Neo4j

Options:
      --app-system-code        System Code of the application (env $APP_SYSTEM_CODE) (default "public-organisation-api")
      --port                   Port to listen on (env $APP_PORT) (default "8080")
      --log-level              Log level to use (env $LOG_LEVEL) (default "debug")
      --env                    environment this app is running in (default "local")
      --cache-duration         Duration Get requests should be cached for. e.g. 2h45m would set the max-age value to '7440' seconds (env $CACHE_DURATION) (default "30s")
      --publicConceptsApiURL   Public concepts API endpoint URL. (env $CONCEPTS_API) (default "http://localhost:8081")

API definition

  • Based on the following google doc
  • See the api Swagger file for endpoints definitions

Healthchecks

Healthchecks: http://localhost:8080/__health

Logging

  • The application uses logrus, the logfile is initilised in main.go.
  • Logging requires an env app parameter for all enviroments other than local.
  • Logs are written to a file.
  • When the application is run locally, logging is written into the console. If you want to log locally to file, you need to pass in an env parameter that is different than local.

NOTE: The /__build-info and /__gtg endpoints are not logged as they are called very often from the healthchecking services and this information is not needed in the logs or Splunk.