Works/Publisher filter?

98 views
Skip to first unread message

Jason Friedman

unread,
Jul 12, 2024, 5:42:14 PM7/12/24
to OpenAlex Community
Hi All,

I am trying to replicate this query via the API, but am struggling:


I can filter by Works,. I can filter by Publisher. What I can't figure out is how to include both in the same query. At the moment, I'm using pyAlex, but I'm open to other solutions.

I apologize in advance if this is a very obvious question. I'm an API/Python newbie.

Thanks!

-Jason

Jason Portenoy

unread,
Jul 12, 2024, 6:07:38 PM7/12/24
to OpenAlex Community
Hi Jason,

On any results page in the web interface, you have the option to generate the API query that will get you the same results set:

Screenshot 2024-07-12 180340.png
Here's the api query given for your example:


Does this answer your question?

Cheers,
Jason Portenoy

Jason Friedman

unread,
Jul 15, 2024, 10:24:21 AM7/15/24
to OpenAlex Community

Hi fellow Jason,

 

Well, don’t I feel stupid?! I am puzzled though. The count is 78,037, but I only see 42172 lines/25 works, even when I remove the page part:

 

https://api.openalex.org/works?filter=primary_location.source.publisher_lineage:p4310320990,publication_year:2020,type:types/article,best_oa_location.is_published:false

 

Am I missing something obvious again?

 

Thank you so much!

 

-Jason

 

• • • • • • • • • • • • •

 

Jason Friedman (He/Him)
Senior Manager, Heritage Services Gestionnaire principal des services du patrimoine

T: 613.907.7032 | M: 613.851.9911

 https://orcid.org/0000-0001-8478-8402

 

Canadian Research Knowledge Network

Réseau canadien de documentation pour la recherche

 

CRKN respectfully acknowledges that its offices are located on the traditional, unceded territory of the Algonquin Anishnaabeg People.

Le RCDR tient à reconnaître respectueusement que ses bureaux sont situés sur le territoire traditionnel non cédé du peuple anishinabé algonquin.

 

From: openalex-...@googlegroups.com <openalex-...@googlegroups.com> On Behalf Of Jason Portenoy
Sent: Friday, July 12, 2024 4:08 PM
To: OpenAlex Community <openalex-...@googlegroups.com>
Subject: [openalex-community-group] Re: Works/Publisher filter?

 

Hi Jason,

 

On any results page in the web interface, you have the option to generate the API query that will get you the same results set:

 

Here's the api query given for your example:

 

 

Does this answer your question?

 

Cheers,

Jason Portenoy

 

On Friday, July 12, 2024 at 5:42:14PM UTC-4 jfri...@crkn.ca wrote:

Hi All,

 

I am trying to replicate this query via the API, but am struggling:

 

 

I can filter by Works,. I can filter by Publisher. What I can't figure out is how to include both in the same query. At the moment, I'm using pyAlex, but I'm open to other solutions.

 

I apologize in advance if this is a very obvious question. I'm an API/Python newbie.

 

Thanks!

 

-Jason

--
You received this message because you are subscribed to a topic in the Google Groups "OpenAlex Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openalex-community/h03Pm3F7XyE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openalex-commun...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openalex-community/81af1582-2c12-4cc1-94f0-1fce1b187ed8n%40googlegroups.com.

Jason Portenoy

unread,
Jul 15, 2024, 10:28:11 AM7/15/24
to OpenAlex Community
Hi Jason,

You can't get that many results with a single API call. The default is 25; the maximum is 200. Beyond that, you will have to use paging with multiple API calls. See all of the details in the documentation here: https://docs.openalex.org/how-to-use-the-api/get-lists-of-entities/paging

Cheers!
Jason Portenoy
Reply all
Reply to author
Forward
0 new messages