How to do a search

21 views
Skip to first unread message

Nicholas Timmins

unread,
Nov 21, 2025, 10:55:06 AMNov 21
to Guardian Open Platform API Forum
I am trying to establish how many headlines mentioned the benefit Universal Credit for each year between 2010 and 2025.

I have registered for a key but the skills needed are beyond me. Can anybody help?

Guardian Open Platform API Forum

unread,
Nov 21, 2025, 11:23:26 AMNov 21
to Guardian Open Platform API Forum
Hi, Nicholas.

I've tested this query string which seems to return results with "Universal Credit" in the headline: 

> https://content.guardianapis.com/search?q=%22Universal%20Credit%22&query-fields=headline&api-key=your-key-goes-here

Running that query in the browser gives us a return which indicates 509 articles have the words "Universal Credit" (case insensitive) in the article title. To get the relevant articles on a per-year basis, you can try appending &from-date= and &to-date= to the URL string:


The total number of articles found for the given year will appear in the "total" field near the start of the response.

Best wishes,
Rik



James Allen-Robertson

unread,
Nov 21, 2025, 11:41:15 AMNov 21
to guardian...@googlegroups.com
I have also run the query and got 480 results. Using the link Rik provided also shows 480 so I'm not sure on why Nik says 509. I may have missed something.

My call parameters were 

'q':'"universal credit"',
'page-size':200,
'query-fields':'headline',
'from-date':'2010-01-01',
'to-date':'2025-12-31'

I have per year figures if helpful.

|    |   Year |   Freq |
|---:|-------:|-------:|
|  0 |   2010 |      2 |
|  1 |   2011 |      7 |
|  2 |   2012 |     23 |
|  3 |   2013 |     54 |
|  4 |   2014 |     26 |
|  5 |   2015 |     15 |
|  6 |   2016 |     21 |
|  7 |   2017 |     90 |
|  8 |   2018 |     84 |
|  9 |   2019 |     41 |
| 10 |   2020 |     40 |
| 11 |   2021 |     51 |
| 12 |   2022 |     13 |
| 13 |   2023 |      7 |
| 14 |   2024 |      6 |

and a chart attached.
newplot.png

--
You received this message because you are subscribed to the Google Groups "Guardian Open Platform API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guardian-api-t...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/guardian-api-talk/1772014d-e153-4134-a8b6-a6c9002e8c0an%40googlegroups.com.

James Allen-Robertson

unread,
Nov 21, 2025, 11:47:26 AMNov 21
to guardian...@googlegroups.com

Nicholas Timmins

unread,
Nov 21, 2025, 11:55:39 AMNov 21
to Guardian Open Platform API Forum
Brilliant ..... thank you all!

More than grateful  ......

Nick

James Allen-Robertson

unread,
Nov 21, 2025, 12:20:04 PMNov 21
to guardian...@googlegroups.com
No problem! I teach this to social science students so I had most of the code ready to roll. Happy to help. 

Reply all
Reply to author
Forward
0 new messages