Introduction to Application
Programming Interfaces,
and ONS’ APIs
Andrew Fergusson
Lead Data Scientist
ONS ⊃ Digital Publishing ⊃ Data Service
andrew.fergusson@ons.gov.uk
Teams, 6 July 2023
Agenda
• What are APIs?
• Advantages of APIs
• Practical demonstration of APIs
What is an API?
More importantly why should you care?
Analysis lifecycle
Wrangle
Data
Analysis Disseminate
Data wrangling sucks
• Spreadsheets are presentational, not designed for
analysis
• Cross tabs typically only have two dimensions
• Got to re-interpret the column headers, unpivot the data
• Contains more data than you need
• Not value add!
Application Programming Interfaces
• A set of rules and protocols that allows software and data
sources to communicate
• Standards-backed, e.g. HTTP Methods (information
transfer), HTTP Status Codes (like 200 Okay 401
Unauthorized), JSON, XML
• Can be accessed using URLs which contain your
request details (a HTTP GET) or with a JSON file a
(HTTP PUT)
Some useful APIs (Not just for reading data!)
• The ONS Census and CMD API:
https://developer.ons.gov.uk/
• The NHS Fingertips API: https://fingertips.phe.org.uk/api
• HMRC’s suite of APIs:
https://developer.service.hmrc.gov.uk/api-
documentation/docs/api
• DWP’s suite of APIs:
https://www.api.gov.uk/dwp/#department-for-work-and-
pensions
APIs are a set of
procedures to access
data
There may be lots of new terms here, but consuming APIs is risk-
free. The worst outcome of a bad API call you’ll experience from
an ONS API is that it didn’t understand your query.
Photo by Kevin Fitzgerald on Unsplash
Advantages of APIs
Why should you use APIs?
Why you should use APIs
• Formatted for analysis
• Filtered for your patch
• No transformation errors
• Automated updates
• Real-time data (depends!)
• Enriched data sources
• Increased efficiency
• Enhanced quality
• Collaboration and sharing
• Agility and adaptability
Using or not using an
API is your choice
Configuring a service to use an API may take a bit more
effort but you’ll get all of that time back and then some.
Photo by Bernd 📷 Dittrich on Unsplash
Practical demonstration
of APIs
Introduction to the ONS Census API
Notes about this demonstration
• This demonstration is using Visual Studio Code, a free Integrated
Developer Environment, and Python a programming language
• The examples are configurable, and the presentational document will be
available after this session
• This example is more advanced than the autumn sessions, but it is
necessary to demonstrate how the ONS Census API works
• PowerBI and Tableau can consume APIs directly, and interpret the API’s responses in
JSON for you
• Programming in Python will not be required
• Being familiar with how the API structures data helps you think about your requests

More Related Content

PPTX
ONS Local and Data Science Community Workshop 1: How to use APIs
PPTX
ONS Local and Data Science Community Workshop 1: How to use APIs
PDF
ONS Local presents Suffolk County Council's Cost of Living Dashboard
PPTX
Why Progressive Web Apps For WordPress - WordCamp Finland
PPTX
AWS PPT.pptx
PPTX
Building loosely coupled integrations with Logic Apps
PPTX
Introduction to Amazon Web Services (AWS)
DOCX
Seminar Report On Amazon Web Service
ONS Local and Data Science Community Workshop 1: How to use APIs
ONS Local and Data Science Community Workshop 1: How to use APIs
ONS Local presents Suffolk County Council's Cost of Living Dashboard
Why Progressive Web Apps For WordPress - WordCamp Finland
AWS PPT.pptx
Building loosely coupled integrations with Logic Apps
Introduction to Amazon Web Services (AWS)
Seminar Report On Amazon Web Service

What's hot (20)

PDF
금융 분야 마이데이터 (My Data) 산업 도입 방안 및 AWS 활용법 – 고종원 AWS 어카운트 매니저, 양찬욱 KB국민카드 팀장:: ...
PPTX
What is AWS?
PPTX
Azure vs AWS
PDF
Cloud Computing - An Introduction
PDF
NATIVE VS PWA APPS – A COMPLETE GUIDE
PDF
AWS Certification | AWS Architect Certification Training | AWS Tutorial | AWS...
PPTX
Aws ppt
PDF
Case Study: Event Manager Mobile app
PPTX
Introduction of Progressive Web App
PPTX
Firebase Cloud Messaging
PPTX
Understanding cloud with Google Cloud Platform
PPT
Cloud Computing and Amazon Web Services
PDF
PPTX
Microsoft power virtual agents
PDF
AWS Finance Symposium_금융권을 위한 hybrid 클라우드 도입 첫걸음
PPTX
App Modernisation with Microsoft Azure
PPTX
Microsoft Azure Logic apps
PPTX
Microsoft Cloud Computing - Windows Azure Platform
PDF
Introduction to Firebase from Google
PPTX
AWS Cloud Watch
금융 분야 마이데이터 (My Data) 산업 도입 방안 및 AWS 활용법 – 고종원 AWS 어카운트 매니저, 양찬욱 KB국민카드 팀장:: ...
What is AWS?
Azure vs AWS
Cloud Computing - An Introduction
NATIVE VS PWA APPS – A COMPLETE GUIDE
AWS Certification | AWS Architect Certification Training | AWS Tutorial | AWS...
Aws ppt
Case Study: Event Manager Mobile app
Introduction of Progressive Web App
Firebase Cloud Messaging
Understanding cloud with Google Cloud Platform
Cloud Computing and Amazon Web Services
Microsoft power virtual agents
AWS Finance Symposium_금융권을 위한 hybrid 클라우드 도입 첫걸음
App Modernisation with Microsoft Azure
Microsoft Azure Logic apps
Microsoft Cloud Computing - Windows Azure Platform
Introduction to Firebase from Google
AWS Cloud Watch
Ad

Similar to ONS Local and Data Science Community Workshop 1: How to use APIs (20)

PDF
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
PPTX
Oscon2014 Netflix API - Top 10 Lessons Learned
PPTX
Lessons learned on the Azure API Stewardship Journey.pptx
PPTX
Top 10 Lessons Learned from the Netflix API - OSCON 2014
PPTX
PDF
The Ultimate API Publisher's Guide
PDF
(ATS6-DEV02) Web Application Strategies
PPTX
Flavours of APIs
PPTX
API Documentation.pptx
PPTX
API Documentation.pptx
PDF
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
PPTX
Application Insights for Integration Developers
PDF
Designing Usable APIs featuring Forrester Research, Inc.
PPTX
apidays LIVE New York 2021 - Service API design validation by Uchit Vyas, KPMG
PDF
Service api design validation & collaboration
PPTX
Building a REST API for Longevity
PDF
APIdays Helsinki 2019 - How API Will Help Win the Deals - the Case of Infrast...
PDF
Making the Most of Power BI with SQL Server 2014 and Azure
PPTX
SPS Dubai 2017 - PowerApps & Microsoft Flow: Advanced scenarios
PPTX
Api design part 1
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
Oscon2014 Netflix API - Top 10 Lessons Learned
Lessons learned on the Azure API Stewardship Journey.pptx
Top 10 Lessons Learned from the Netflix API - OSCON 2014
The Ultimate API Publisher's Guide
(ATS6-DEV02) Web Application Strategies
Flavours of APIs
API Documentation.pptx
API Documentation.pptx
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
Application Insights for Integration Developers
Designing Usable APIs featuring Forrester Research, Inc.
apidays LIVE New York 2021 - Service API design validation by Uchit Vyas, KPMG
Service api design validation & collaboration
Building a REST API for Longevity
APIdays Helsinki 2019 - How API Will Help Win the Deals - the Case of Infrast...
Making the Most of Power BI with SQL Server 2014 and Azure
SPS Dubai 2017 - PowerApps & Microsoft Flow: Advanced scenarios
Api design part 1
Ad

More from Office for National Statistics (20)

PPTX
The truth behind the numbers: spotting statistical misuse
PPTX
Global journeys: estimating international migration
PDF
ONS Economic Forum Slidepack – 21 July 2025
PPTX
Numbers of a nation: how we estimate population statistics | Accessible slides
PPTX
Bringing data to life | Bricks, mortar and data: understanding house and rent...
PPTX
Earnings Symposium Slidepack - 29 April 2025
PPTX
Bringing data to life - Crime webinar Accessible.pptx
PPTX
ONS Economic Forum Slidepack – 19 May 2025.pptx
PPTX
Measuring what matters most: understanding national well-being
PPTX
ONS Economic Forum Slidepack - 24 March 2025 (slideshare).pptx
PPTX
Bringing data to life: Artificial Intelligence and innovation - keeping human...
PPTX
SlideShare ONS Economic Forum Slidepack - 27 January 2025
PPTX
A Quick Introduction to the Reference Data Management Framework
PPTX
Reference Data Management Framework Overview Digital Booklet
PPTX
Bringing data to life: How are your vitals? Exploring health by numbers
PPTX
SlideShare Annual crime and justice statistics forum - 7 November 2024
PPTX
SlideShare ONS Economic Forum Slidepack - 25 November 2024
PPTX
Air fryers and vinyl records: how we measure the cost of living
PPTX
Bringing data to life - environment static.pptx
PPTX
Bringing data to life an introduction to statistics
The truth behind the numbers: spotting statistical misuse
Global journeys: estimating international migration
ONS Economic Forum Slidepack – 21 July 2025
Numbers of a nation: how we estimate population statistics | Accessible slides
Bringing data to life | Bricks, mortar and data: understanding house and rent...
Earnings Symposium Slidepack - 29 April 2025
Bringing data to life - Crime webinar Accessible.pptx
ONS Economic Forum Slidepack – 19 May 2025.pptx
Measuring what matters most: understanding national well-being
ONS Economic Forum Slidepack - 24 March 2025 (slideshare).pptx
Bringing data to life: Artificial Intelligence and innovation - keeping human...
SlideShare ONS Economic Forum Slidepack - 27 January 2025
A Quick Introduction to the Reference Data Management Framework
Reference Data Management Framework Overview Digital Booklet
Bringing data to life: How are your vitals? Exploring health by numbers
SlideShare Annual crime and justice statistics forum - 7 November 2024
SlideShare ONS Economic Forum Slidepack - 25 November 2024
Air fryers and vinyl records: how we measure the cost of living
Bringing data to life - environment static.pptx
Bringing data to life an introduction to statistics

Recently uploaded (20)

PPTX
cpgram enivaran cpgram enivaran cpgram enivaran
PDF
4_Key Concepts Structure and Governance plus UN.pdf okay
PPTX
Developing_An_Advocacy_Agenda_by_Kevin_Karuga.pptx
PDF
CXPA Finland Webinar: Rated 5 Stars - Delivering Service That Customers Truly...
PPTX
Part I CSO Conference and AVP Overview.pptx
PPTX
LUNG CANCER PREDICTION MODELING USING ARTIFICIAL NEURAL NETWORK.pptx
PPTX
DFARS Part 252 - Clauses - Defense Regulations
PDF
UNEP/ UNEA Plastic Treaty Negotiations Report of Inc 5.2 Geneva
PPTX
Part II LGU Accreditation of CSOs and Selection of Reps to LSBs ver2.pptx
PDF
PPT Item # 9 - FY 2025-26 Proposed Budget.pdf
PPTX
Workshop introduction and objectives. SK.pptx
PPTX
International Tracking Project Unloading Guidance Manual V1 (1) 1.pptx
PPTX
Empowering Teens with Essential Life Skills 🚀
PPTX
Presentation on CGIAR’s Policy Innovation Program _18.08.2025 FE.pptx
PDF
Concept_Note_-_GoAP_Primary_Sector_-_The_Great_Rural_Reset_-_Updated_18_June_...
PPTX
Reactivity of metals with oxygen, rusting.pptx
PPT
The Central Civil Services (Leave Travel Concession) Rules, 1988, govern the ...
PDF
AAAAAAAAAAAAAAAAAaaaaaaaAAAAAAAt - ĐV.pdf
PDF
The GDP double bind- Anders Wijkman Honorary President Club of Rome
PPTX
Robotics_Presentation.pptxdhdrhdrrhdrhdrhdrrh
cpgram enivaran cpgram enivaran cpgram enivaran
4_Key Concepts Structure and Governance plus UN.pdf okay
Developing_An_Advocacy_Agenda_by_Kevin_Karuga.pptx
CXPA Finland Webinar: Rated 5 Stars - Delivering Service That Customers Truly...
Part I CSO Conference and AVP Overview.pptx
LUNG CANCER PREDICTION MODELING USING ARTIFICIAL NEURAL NETWORK.pptx
DFARS Part 252 - Clauses - Defense Regulations
UNEP/ UNEA Plastic Treaty Negotiations Report of Inc 5.2 Geneva
Part II LGU Accreditation of CSOs and Selection of Reps to LSBs ver2.pptx
PPT Item # 9 - FY 2025-26 Proposed Budget.pdf
Workshop introduction and objectives. SK.pptx
International Tracking Project Unloading Guidance Manual V1 (1) 1.pptx
Empowering Teens with Essential Life Skills 🚀
Presentation on CGIAR’s Policy Innovation Program _18.08.2025 FE.pptx
Concept_Note_-_GoAP_Primary_Sector_-_The_Great_Rural_Reset_-_Updated_18_June_...
Reactivity of metals with oxygen, rusting.pptx
The Central Civil Services (Leave Travel Concession) Rules, 1988, govern the ...
AAAAAAAAAAAAAAAAAaaaaaaaAAAAAAAt - ĐV.pdf
The GDP double bind- Anders Wijkman Honorary President Club of Rome
Robotics_Presentation.pptxdhdrhdrrhdrhdrhdrrh

ONS Local and Data Science Community Workshop 1: How to use APIs

  • 1. Introduction to Application Programming Interfaces, and ONS’ APIs Andrew Fergusson Lead Data Scientist ONS ⊃ Digital Publishing ⊃ Data Service andrew.fergusson@ons.gov.uk Teams, 6 July 2023
  • 2. Agenda • What are APIs? • Advantages of APIs • Practical demonstration of APIs
  • 3. What is an API? More importantly why should you care?
  • 5. Data wrangling sucks • Spreadsheets are presentational, not designed for analysis • Cross tabs typically only have two dimensions • Got to re-interpret the column headers, unpivot the data • Contains more data than you need • Not value add!
  • 6. Application Programming Interfaces • A set of rules and protocols that allows software and data sources to communicate • Standards-backed, e.g. HTTP Methods (information transfer), HTTP Status Codes (like 200 Okay 401 Unauthorized), JSON, XML • Can be accessed using URLs which contain your request details (a HTTP GET) or with a JSON file a (HTTP PUT)
  • 7. Some useful APIs (Not just for reading data!) • The ONS Census and CMD API: https://developer.ons.gov.uk/ • The NHS Fingertips API: https://fingertips.phe.org.uk/api • HMRC’s suite of APIs: https://developer.service.hmrc.gov.uk/api- documentation/docs/api • DWP’s suite of APIs: https://www.api.gov.uk/dwp/#department-for-work-and- pensions
  • 8. APIs are a set of procedures to access data There may be lots of new terms here, but consuming APIs is risk- free. The worst outcome of a bad API call you’ll experience from an ONS API is that it didn’t understand your query. Photo by Kevin Fitzgerald on Unsplash
  • 9. Advantages of APIs Why should you use APIs?
  • 10. Why you should use APIs • Formatted for analysis • Filtered for your patch • No transformation errors • Automated updates • Real-time data (depends!) • Enriched data sources • Increased efficiency • Enhanced quality • Collaboration and sharing • Agility and adaptability
  • 11. Using or not using an API is your choice Configuring a service to use an API may take a bit more effort but you’ll get all of that time back and then some. Photo by Bernd 📷 Dittrich on Unsplash
  • 13. Notes about this demonstration • This demonstration is using Visual Studio Code, a free Integrated Developer Environment, and Python a programming language • The examples are configurable, and the presentational document will be available after this session • This example is more advanced than the autumn sessions, but it is necessary to demonstrate how the ONS Census API works • PowerBI and Tableau can consume APIs directly, and interpret the API’s responses in JSON for you • Programming in Python will not be required • Being familiar with how the API structures data helps you think about your requests

Editor's Notes

  • #11: Formatted for analysis: no more wrangling and copy/pasting from excel spreadsheets Filtered for your patch: no more downloading all of England’s data to report on Salford No transformation errors: the API returns data in the format you request, meaning you won’t make a mistake wrangling and get incorrect analysis Automated updates: when new data is released, the connections still work so you just need to refresh the API; if you are working with time series this is especially good Real-time data: It may be true that real-time data is available from an API most analysis ONS Local performs isn’t real time (i.e. live), it’s generally a programmatic view of a static set of observations which get updated monthly, etc. An example of a realtime dataset is Manchester’s Oxford Road Cycle Counter which is updated each time a cyclist passes a set point Enriched data sources: APIs can return detailed information and notes at almost any level: so instead of a warning on the note section about a set of observations, it’s specific to the exact scope but doesn’t ruin your spreadsheet with symbols or footnotes in an observation cell with the value you want. You can’t sum up observations when the values 3, 4, 5, and x. Increased efficiency: set it and forget it. APIs are versioned, which means when you program against a version of an API, it will continue to work even if the data updates; no more broken spreadsheets. API developers will release a whole new API version (i.e. v2 after v1) if they’re going to introduce any changes which will break v1 functionality Enhanced quality: The Census API has perturbation, and there are other advantages Collaboration and sharing: Imagine being able to provide access to all of the UK’s census information but just with a link, the power you get with an internet connection and not having to download the large amounts of data locally – not that you would be allowed to access the microdata – means it’s easier to collaborate Agility and adaptability: As these datasets are filterable fully custom, ad hoc analysis is just selecting the new analysis. Is the report originally ethnicity vs age for a local authority’s wards, but someone wants to see highest level of education obtained vs age, it’s just changing one parameter!