Skip to content

Releases: 18F/analytics-reporter-api

API v2 release

07 Mar 17:58
63b6495
Compare
Choose a tag to compare

The main focus of this update is to establish a structure that can handle semantic route versions.

Our analytics-reporter-api will call from db table dependent on which version is in path, ie. v1.1 or v2

✅ 1.1 => analytics_data table

this endpoint returns UA data: https://api.gsa.gov/analytics/dap/develop/v1.1/reports/language/data?api_key=DEMO_KEY1&limit=10

GA4 responses are being written from our working branch to the postgres database service

✅ 2+ => analytics_data_ga4 table

this endpoint returns GA4 data: https://api.gsa.gov/analytics/dap/develop/v2/reports/language/data?api_key=DEMO_KEY1&limit=10

any version that is not supported will communicate as a response in the request

✅ 2.xxx => 404
this endpoint returns a message about incorrect version requests: https://api.gsa.gov/analytics/dap/develop/v1.2/reports/language/data?api_key=DEMO_KEY1&limit=10

The work in this release includes:

updated environment variable for API_SECRET
removes white space from config.yml
new .nvmrc file
updated readme
includes env.example for local dev support
updated knexfile to support local .env file
includes migration file for creating analytics_data_ga4 table
updated package and lock file
includes express-routes-versioning dependency
updates app.js to include
imports router
checks version in route and sets it in the request
checks version on route request supporting:
1.1.0 and ~2.0.0 versions
when no match is found we call back our NoMatchFoundCallback function
this function responds 404 and includes a message to the requester
checks for version in request and includes a notice value if version === 'v1.1'
checks for version in request and returns proper table in db
updates our tests to handle versions
app.spec includes tests for both v1.1 and v2 routes
includes tests notice in v1.1
includes tests for unsupported versions