Custom style csl with zotero API

103 views
Skip to first unread message

Stuart Bowden

unread,
Jan 29, 2018, 4:20:13 PM1/29/18
to zotero-dev
Is it possible to use a custom CSL file when accessing Zotero via the API? The API documentation for styles states: Citation style to use for formatted references. Can be either the file name (without the .csl extension) of one of the styles in the Zotero Style Repository (e.g., apa) or the URL of a remote CSL file. I can use the standard styles but can't get it to work with my own files (GET error). Does anyone have an example?

I am using the API via the wrapper pyzotero to generate the HTML for a webpage. I tweak the IEEE csl so it has all the authors and includes the DOI.

BTW: I use biblio in Drupal. It can pull from zotero but it always seems like having two systems.  If there is a better way to use Drupal with Zotero I'd like to know.

Dan Stillman

unread,
Jan 29, 2018, 7:09:21 PM1/29/18
to zoter...@googlegroups.com
On 1/29/18 4:06 PM, Stuart Bowden wrote:
Is it possible to use a custom CSL file when accessing Zotero via the API? The API documentation for styles states: Citation style to use for formatted references. Can be either the file name (without the .csl extension) of one of the styles in the Zotero Style Repository (e.g., apa) or the URL of a remote CSL file. I can use the standard styles but can't get it to work with my own files (GET error). Does anyone have an example?

Stephan Hügel

unread,
Jan 30, 2018, 12:59:16 PM1/30/18
to zotero-dev


On Tuesday, 30 January 2018 00:09:21 UTC, Dan Stillman wrote:

Make sure you're URL-encoding the remote URL.

I've just pushed Pyzotero v1.3.1 – 1.3.0 had an error because the API doesn't allow a limit parameter when format is set to 'bib'. It should work now, and you don't have to URL-encode your style string:

zot.top(

   format="bib",

   style="https://raw.githubusercontent.com/citation-style-language/styles/master/frontiers.csl"

)


Works for me.

Stuart Bowden

unread,
Jan 30, 2018, 8:34:21 PM1/30/18
to zotero-dev

Thanks to both of you for your replies. They both work great and I can happily use my own styles from another source either directly or via pyzotero.

Reply all
Reply to author
Forward
0 new messages