CLIInsights

CLI

Insights

Read the statistics of an establishment from the terminal over the last 24 hours, 7 days or 28 days, as JSON ready for jq.

Establishment statistics

insights:get takes the id of an establishment and returns its statistics as JSON. The metrics are described in Insights.

sofia insights:get $ESTABLISHMENT_ID

Choose a period

--period accepts three values:

  • last24Hours: the last 24 hours.
  • last7Days: the last 7 days.
  • last28Days: the last 28 days, the default of the API.

Examples

sofia insights:get $ESTABLISHMENT_ID --period last24Hours
sofia insights:get $ESTABLISHMENT_ID --period last7Days
sofia insights:get $ESTABLISHMENT_ID --period last28Days

Scripting with statistics

Pipe the answer into jq to keep one number, for a dashboard or a weekly report.

sofia insights:get $ESTABLISHMENT_ID --period last7Days | jq '.data[] | {platform, reach: .measures.reach.value}'
Was this page helpful?