v1-brands-transformer

command module
v1.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2017 License: MIT Imports: 18 Imported by: 0

README

V1 Brands Transformer

CircleCI Go Report Card Coverage Status codecov

An API for pulling in and transforming V1/TME Brands into the UPP representation of an Brand

Installation

For the first time:

go get github.com/Financial-Times/v1-brands-transformer

or update:

go get -u github.com/Financial-Times/v1-brands-transformer

Running

$GOPATH/bin/v1-brands-transformer --bertha-source-url={bertha url} --tme-username={tme-username} --port={port} --tme-password={tme-password} --token={tme-token} --base-url={base-url for the app} --tme-base-url={tme-base-url} --maxRecords={maxRecords} --batchSize={batchSize} --cache-file-name={cache-file-name}

TME credentials are mandatory and can be found in lastpass

Building

With Docker:

docker build -t coco/v1-brands-transformer .

docker run -ti --env BASE_URL=<base url> --env BERTHA_SOURCE_URL=<bertha url> --env TME_BASE_URL=<structure service url> --env TME_USERNAME=<user> --env TME_PASSWORD=<pass> --env TOKEN=<token> --env CACHE_FILE_NAME=<file> coco/v1-brands-transformer

Endpoints

GET /transformers/brands

The V1 Brands transformer holds all the V1 Brands in memory and this endpoint gets the JSON for ALL the Brands. Useful for piping to a file or using with up-rest-utils but be careful using this via Postman or a Browser as it is a lot of JSON

A successful GET results in a 200.

curl -X GET https://{pub-semantic-user}:{pub-semantic-password}@semantic-up.ft.com/__v1-brands-transformer/transformers/brands

GET /transformers/brands/{uuid}

The V1 Brands transformer holds all the V1 Brands in memory and this endpoint gets the JSON for an brand with a given UUID. The UUID is derived from the TME composite id at this point

A successful GET results in a 200 and 404 for not finding the brand

curl -X GET https://{pub-semantic-user}:{pub-semantic-password}@semantic-up.ft.com/__v1-brands-transformer/transformers/brands/8138ca3f-b80d-3ef8-ad59-6a9b6ea5f15e

GET /transformers/brands/__ids

All of the UUIDS for ALL the V1 brands - This is needed for loading via the concept publisher

curl -X GET https://{pub-semantic-user}:{pub-semantic-password}@semantic-up.ft.com/__v1-brands-transformer/transformers/brands/__ids

GET /transformers/brands/__count

A count of how brands are in the transformer's memory cache

curl -X GET https://{pub-semantic-user}:{pub-semantic-password}@semantic-up.ft.com/__v1-brands-transformer/transformers/brands/__count

POST /transformers/brands/__reload

Fetches all the V1 Brands from TME and reloads the cache. There is no payload for this post

curl -X POST https://{pub-semantic-user}:{pub-semantic-password}@semantic-up.ft.com/__v1-brands-transformer/transformers/brands/__reload

Admin endpoints

Healthchecks: http://localhost:8080/__health

Ping: http://localhost:8080/ping or http://localhost:8080/__ping

Build-info: http://localhost:8080/build-info

Good to Go: http://localhost:8080/__gtg

API Document

V1 Brands Transformer API Endpoints

A Note on UUID Mapping

Link to the UUID map

This map is a static map of TME identifiers to the randomly generated UUIDs that were created by editorial as part of the Bertha spreadsheet. Since they don't follow the normal manner of generating a UUID in UP, we need to store them as a map TME -> UUID.

This shouldn't require changing as new brands added to the spreadsheet have their UUIDs generated correctly from their TME identifier.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL