Sign inSign up

coco/public-content-by-concept-api

By coco

Updated 1 day ago

Neo4J backed Content By Concept public read api

Image
0

10K+

coco/public-content-by-concept-api repository overview

Public API for Content By Concept (public-content-by-concept-api)

Circle CI Go Report Card Coverage Status

A public API which returns an ordered list of the most recently annotated content about a given concept

Installation & running locally

  • go get -u github.com/Financial-Times/public-content-by-concept-api
  • cd $GOPATH/src/github.com/Financial-Times/public-content-by-concept-api
  • go install
  • $GOPATH/bin/public-content-by-concept-api --neo-url={neo4jUrl} --port={port} --log-level={DEBUG|INFO|WARN|ERROR}--cache-duration{e.g. 22h10m3s} --requestLoggingEnabled=false Optional arguments are: --neo-url defaults to http://localhost:7474/db/data, which is the out of box url for a local neo4j instance. --port defaults to 8080. --cache-duration defaults to 1 hour --logLevel set level of app logging, request critical logs are info level with more helpful logs found at debug --requestLoggingEnabled when true will toggle logging of both admin endpoints(health/gtg) as well as http endpoints

Testing

  • Unit tests only: go test -race ./...

  • Unit and integration tests:

    docker-compose -f docker-compose-tests.yml up -d --build && \
    docker logs -f test-runner && \
    docker-compose -f docker-compose-tests.yml down
    

Examples:

  • curl http://localhost:8080/content?isAnnotatedBy=http://api.ft.com/things/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54
  • curl http://localhost:8080/content?isAnnotatedBy=http://api.ft.com/things/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54&fromDate=2016-01-02&toDate=2016-01-05&limit=200
  • curl http://localhost:8080/content?isAnnotatedBy=http://api.ft.com/things/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54&fromDate=2016-01-02&toDate=2016-01-05&page=3&limit=200

Note: Optional request params: limit (number of items to return), page, toDate, fromDate. isAnnotatedBy param accepts both full concept URI or just the UUID

API definition

Based on the following google doc

Admin Enpoints

Healthcheck: http://localhost:8080/__health Gtg: http://localhost:8080/__gtg Build-Info: http://localhost:8080/__build-info

Tag summary

Content type

Image

Digest

sha256:fe6db220e

Size

4.7 MB

Last updated

1 day ago

docker pull coco/public-content-by-concept-api