zotxt icon indicating copy to clipboard operation
zotxt copied to clipboard

Add a function for getting the non-deprecated Zotero link.

Open NorwegianRockCat opened this issue 2 years ago • 7 comments

This adds functionality for getting the current "non-deprecated" form of the link (See Issue #30). I did this with a new format (zoteroLink) since I don't want to break the current keys or workflows.

This is mostly just adapted from Zutilo, but it seems to be considered the "blessed" version, so I'm keeping it for now.

I have never written a Zotero extension, so I don't know if I'm following everything. For example, I'm assuming that passing a bad key is caught before the zoteroLink function is called. Suggestions welcome.

Otherwise, this seems to work well enough for me. So, I'd like it to be in the actual plugin.

NorwegianRockCat avatar Mar 12 '23 06:03 NorwegianRockCat

Hi @NorwegianRockCat , I met the issue about zotero link, too. The issue is discussed here: egh/zotxt-emacs#53.

I wonder how to use the function buildZoteroLink() you wrote here. Thank you.

zzeitt avatar Sep 15 '23 10:09 zzeitt

There's not much to it.

Since I figured there were others that were dependent on previous behavior, I created a new query (zoteroLink) so passing that instead of the others queries (like citekey or bibtex) will return the "new" link.

So, you can still do everything that zotxt had before, it's just a new call. I still use this from time-to-time with some custom emacs code and find it very useful.

NorwegianRockCat avatar Sep 15 '23 11:09 NorwegianRockCat

I created a new query (zoteroLink) so passing that instead of the others queries (like citekey or bibtex) will return the "new" link.

Could you explain more about how to pass the query? I haven't written code to interact with Zotero before. Thanks.

zzeitt avatar Sep 15 '23 12:09 zzeitt

Sorry this slipped through the cracks. I will review soon.

egh avatar Sep 16 '23 03:09 egh

@zzeitt: In general, Zotxt creates a little HTTP server that runs from Zotero that only accepts requests from localhost (http://127.0.0.1:23119/zotxt). This is a REST endpoint. You can then point a REST client from a web browser or use CURL to ask for things.

For example, asking for http://127.0.0.1:23119/zotxt/items should return a JSON structure with the current selected items and their keys.

So you aren't using an API from Zotero, you are using the REST API defined by the zotxt extension (the zotxt extension is using the Zotero's API). You can do a web search for "REST Client" and your browser (e.g., Firefox) to get something to help you experiment with creating your REST queries.

Hope that helps.

NorwegianRockCat avatar Sep 17 '23 09:09 NorwegianRockCat

Thank you sir! Your explanation is quite clear.

I happen to know a little bit about REST API or something, so I think it might not be too hard for me to experiment with the new method.

Again, thank you for your help:)

zzeitt avatar Sep 17 '23 15:09 zzeitt

@egh Any chance for a review? This extra functionality is handy, even though it the "zotero://" url conflicts with zotxt's other URL. Still, it is very useful in my workflow.

NorwegianRockCat avatar Feb 02 '24 18:02 NorwegianRockCat