Skip to content
This repository has been archived by the owner on Mar 19, 2018. It is now read-only.

Financial-Times/brands-rw-neo4j

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DECOMISSIONED See Concepts RW Neo4j instead

Brands Reader/Writer for Neo4j (brands-rw-neo4j)

Circle CIGo Report Card Coverage Status An API for reading/writing brands into Neo4j. Expects the brands json supplied to be in the format that comes out of the brands extractor.

Runbook for service

Developer Notes

Installation or Update

go get -u github.com/Financial-Times/brands-rw-neo4j

Running

$GOPATH/bin/brands-rw-neo4j --neo-url={neo4jUrl} --port={port} --batchSize=50 --graphiteTCPAddress=graphite.ft.com:2003 --graphitePrefix=content.{env}.brands.rw.neo4j.{hostname} --logMetrics=false

All arguments are optional, they default to a local Neo4j install on the default port (7474), application running on port 8080, batchSize of 1024, graphiteTCPAddress of "" (meaning metrics won't be written to Graphite), graphitePrefix of "" and logMetrics false.

Building

This service is built in CircleCI and deployed via Jenkins.

Loading Brand Data

API Endpoints

This API works, in the main, on the brands/{uuid} path.

PUT

The only mandatory fields are the uuid, and the alternativeIdentifier uuids (because the uuid is also listed in the alternativeIdentifier uuids list), and the uuid in the body must match the one used on the path. A successful PUT results in 200. Invalid json body input, or uuids that don't match between the path and the body will result in a 400 bad request response.

Example:

curl -XPUT -H "X-Request-Id: 123" -H "Content-Type: application/json" localhost:8080/brands/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54 --data '{"uuid": "dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54", "prefLabel": "Financial Times","strapline": "Make the right connections", "alternativeIdentifiers":{"uuids": ["dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54","6a2a0170-6afa-4bcc-b427-430268d2ac50"], "TME":["foo","bar"]},"type":"Brand"}'

The type field is not currently validated - instead, the Brands Writer writes type Brand and its parent types (Thing, Concept, Classification) as labels for the Brand.

GET

The internal read should return what got written (i.e., this isn't the public brand read API)

If not found, you'll get a 404 response.

The only field that is omitted if empty is the parentUUID field

curl -H "Content-Type: application/json" http://localhost:8080/brands/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54
{"uuid":"dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54","prefLabel":"Financial Times","description":"","strapline":"Make the right connections","descriptionXML":"","_imageUrl":""}

DELETE

Will return 204 if successful, 404 if not found:

curl -X DELETE -H "X-Request-Id: 123" localhost:8080/brands/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54

Admin endpoints