CollectionID/CollectionKey
I'm sure this is Zotero 101, but can someone please tell me how to find my CollectionKey/CollectionID (they the same thing, right?). When I go to the folders in my library I see nothing that gives me a collectionkey.
My userID is clearly visible in the settings->api/feeds, but I'm not able to find anything that gives me different keys for each collection. Please help.
My userID is clearly visible in the settings->api/feeds, but I'm not able to find anything that gives me different keys for each collection. Please help.
The API documentation seems to be missing this crucial information.
I tried to create an export translator using both group and library id as the var to retrieve the collection key without success. My goal is to be able to generate and URI to specific item in an specific collection in the new beta.
https://forums.zotero.org/discussion/73893/zotero-select-for-collections#latest
But my attempt at a translator below gave me an error when I tried to use it for export.
The #a1# and such is to use it with the word macro to turn the generated uri into an hyperlink as shared here (originally for citations).
https://forums.zotero.org/discussion/77079/ms-word-macro-to-convert-zotero-citations-into-clickable-hyperlinks
function doExport() {
var item;
while(item = Zotero.nextItem()) {
const title = item.itemType === 'note' ? Zotero.write(item.note.replace(/<[^>]*>/g, '').replace(/\n/g, ' ').split(/\s+/).slice(0,4).join(' ')+"#c1#"+"LINK"+"#c2#") : Zotero.write(item.title+"#c1#"+"LINK"+"#c2#")
Zotero.write("#a1#"+"zotero://select/groups");
var group_id = item.groupID ? item.groupID : 0;
Zotero.write(group_id+"/collections/"+collection.key+"/items/"+item.key+"#a2#"+"\n");
}
}
I'm having the same problem -- nextCollection() doesn't seem to return anything for a given item.
zotero://select/library/collections/[collectionKey]
to the clipboard, see here. (Note that the link format on this site needs to be corrected.)If you're looking for links to items within a collection, there's an open issue for it here: https://github.com/willsALMANJ/Zutilo/issues/105. You can create such links manually by combining the collection link with Zutilo's "Copy select item links", which return links of the form
zotero://select/library/items/[itemKey]
. A link to an item within a collection would have this form:zotero://select/library/collections/[collectionKey]/items/[itemKey]
.See also this discussion:
https://forums.zotero.org/discussion/73893/zotero-select-for-collections
If this is not what you're looking for, it might help to explain what you're trying to achieve.
Basically what I'm trying to achieve is to get the names of the collections an item is in, for use in an export translator. Unfortunately I don't think it's possible because of the translator sandbox not having access to other collection-related methods (we have access to the IDs/keys, but AFAIK there's no way to derive the names from them). See https://forums.zotero.org/discussion/comment/356661/#Comment_356661