Draft content API is a microservice that provides access to draft content stored in PAC.
10K+
Draft content API is a microservice that provides access to draft content stored in PAC. At the moment the service is a simple proxy to UPP Content API.
Download the source code, dependencies and test dependencies:
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
mkdir $GOPATH/src/github.com/Financial-Times/draft-content-api
cd $GOPATH/src/github.com/Financial-Times
git clone https://github.com/Financial-Times/draft-content-api.git
cd public-things-api && dep ensure -vendor-only
go build .
Run the tests and install the binary:
go test ./...
go install
Run the binary (using the help flag to see the available optional arguments):
$GOPATH/bin/draft-content-api [--help]
Options:
--app-system-code="draft-content-api" System Code of the application ($APP_SYSTEM_CODE)
--app-name="draft-content-api" Application name ($APP_NAME)
--app-timeout="8s" Endpoints Timeout Duration ($APP_TIMEOUT)
--port="8080" Port to listen on ($APP_PORT)
--content-rw-endpoint="..." Endpoint for draft content RW ($DRAFT_CONTENT_RW_ENDPOINT)
--mam-endpoint="..." Endpoint for draft content mapper ($DRAFT_CONTENT_MAPPER_ENDPOINT)
--content-endpoint="..." Endpoint to get content from CAPI ($CONTENT_ENDPOINT)
--content-api-key="..." API key to access CAPI ($CAPI_APIKEY)
3. Test:
1. Either using curl:
curl http://localhost:8080/draft/content/b7b871f6-8a89-11e4-8e24-00144feabdc0 | json_pp
1. Or using [httpie](https://github.com/jkbrzt/httpie):
http GET http://localhost:8080/draft/content/b7b871f6-8a89-11e4-8e24-00144feabdc0
Note that the read endpoint is /drafts/content/{uuid} whereas the write endpoint is /drafts/nativecontent/{uuid}.
Using curl:
curl http://localhost:8080/drafts/content/b7b871f6-8a89-11e4-8e24-00144feabdc0 | json_pp`
Or using httpie:
http GET http://localhost:8080/drafts/content/b7b871f6-8a89-11e4-8e24-00144feabdc0
At the moment this endpoint is a proxy to the content available in UPP, so it returns a payload consistent to the Content API in UPP.
Using curl:
curl -X PUT http://localhost:8080/drafts/nativecontent/b7b871f6-8a89-11e4-8e24-00144feabdc0 --data-binary "@/path/to/file.json"
This returns a 200 status with no body.
Admin endpoints are:
/__gtg
/__health
/__build-info
The /__health and /__gtg check the availability of:
env app parameter, for all environments other than local logs are written to file.local./__build-info and /__gtg endpoints are not logged as they are called every second from varnish/vulcand and this information is not needed in logs/splunk.Content type
Image
Digest
sha256:ebed35fac…
Size
3.5 MB
Last updated
over 2 years ago
docker pull coco/draft-content-api