Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
dev:api_user_docs [2010/04/01 20:01] – created kd | dev:api_user_docs [2017/11/12 19:53] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Zotero | + | < |
+ | in the process of updating the documentation for | ||
+ | <a href=" | ||
+ | may be outdated in the meantime. Thanks for your understanding.</ | ||
- | ===== Setting up a simplified development environment ===== | ||
- | |||
- | The two easiest ways to set up a development environment for Zotero is either with an interactive javascript environment, | ||
- | |||
- | There are a number of suitable interactive javascript environments for interacting with Firefox' | ||
- | |||
- | - [[http:// | ||
- | - A Firefox plugin to provide MozRepl access [[http:// | ||
- | - The [[https:// | ||
- | |||
- | My feeling is that the easiest way to get some kind of working application up is to use the Plain old Webserver and server side javascript. | ||
- | |||
- | Setting up a Firefox development environment is beyond the scope of this | ||
- | document. | ||
- | |||
- | Perl programmers should be aware of the [[http:// | ||
- | related [[http:// | ||
- | from inside perl programs. | ||
- | |||
- | **A problem with MozREPL**: With a longer script I've had trouble with MozRepl timing out on me for no apparent reason. | ||
- | |||
- | ==== Zotero API Howtos ==== | ||
- | |||
- | The Zotero API is under-documented, | ||
- | |||
- | == Create new Zotero object == | ||
- | |||
- | This is the first thing that you need to do when interacting with zotero' | ||
- | internals. | ||
- | |||
- | '' | ||
- | '' | ||
- | |||
- | == Setup a Zotero search == | ||
- | |||
- | If you are focused on data access, then the first thing you will want to do | ||
- | will be to retrieve items from your zotero. | ||
- | good start. | ||
- | |||
- | '' | ||
- | |||
- | == Search for items containing a specific tag == | ||
- | |||
- | Starting with the code from "Setup a Zotero search" | ||
- | code to retrieve items with a particular tag: | ||
- | |||
- | '' | ||
- | |||
- | == Search for a Zotero subcollection == | ||
- | |||
- | TODO | ||
- | |||
- | == Select a Zotero saved search == | ||
- | |||
- | TODO | ||
- | |||
- | == Search term operators == | ||
- | |||
- | TODO | ||
- | |||
- | == Combining search terms == | ||
- | |||
- | TODO | ||
- | |||
- | == Complete list of search operators == | ||
- | |||
- | TODO (should be pretty easy) | ||
- | |||
- | == Complete list of search fields == | ||
- | |||
- | TODO (with description of what the more obscure fields mean - e.g. abstractNote for | ||
- | abstract, and how do we search the fulltext archive?) | ||
- | |||
- | == Executing the search == | ||
- | |||
- | Once the search conditions have been set up, then it's time to execute the | ||
- | results: | ||
- | |||
- | '' | ||
- | |||
- | This returns the item ids in the search as an array [I could be wrong ... ]. | ||
- | The next thing to do is to get the Zotero items for the array of IDs: | ||
- | |||
- | '' | ||
- | |||
- | =head5 Getting a bibliography for an array of items: | ||
- | |||
- | Here we use zotero' | ||
- | specified in Zotero' | ||
- | |||
- | First we start with a list of as in the previous entry. | ||
- | |||
- | '' | ||
- | var biblio = qc.getContentFromItems(new Array(item), | ||
- | z.Prefs.get(" | ||
- | var biblio_html_format = cite.html; | ||
- | var biblio_txt | ||
- | |||
- | TODO: get citations. | ||
- | especially RTF | ||
- | |||
- | == Get information about an item. == | ||
- | |||
- | TODO: need to list all the possible fields here, and what kind of entry they | ||
- | belong to. | ||
- | |||
- | To get an item's abstract, we get the ' | ||
- | |||
- | '' | ||
- | |||
- | =head5 Get fulltext for an item. | ||
- | |||
- | TODO | ||
- | |||
- | =head5 Get stored attachements for an item | ||
- | |||
- | TODO | ||
- | |||
- | == Get child notes for an item == | ||
- | |||
- | To get the child notes for an item, we use the following code: | ||
- | |||
- | '' | ||
- | |||
- | This returns an array of notes. | ||
- | in turn we just iterate through the array: | ||
- | |||
- | '' | ||
- | var note = z.Items.get(notes[j]); | ||
- | var note_html = note.getNote; | ||
- | } '' | ||
- | |||
- | == Get an item's related items == | ||
- | |||
- | This technique works for anything that can have related items attached within | ||
- | the zotero database. | ||
- | |||
- | '' | ||
- | |||
- | This returns a list of items just like in the search examples. | ||
- | |||
- | === Generic XUL Javascript to provide support functions === | ||
- | |||
- | == Writing out a file: == | ||
- | |||
- | This function will write out a file to a specified filename. | ||
- | already exists it will be silently overwritten. | ||
- | be cleaned up, talk about append mode as well, and failure if file already | ||
- | exists ...] | ||
- | |||
- | Note that Plain Old Webserver contains quite a few simplified support functions for reading, writing and deleting files, including new bits of javascript, and generally making things nice and easy. | ||
- | |||
- | |||
- | '' | ||
- | var file = Components.classes[" | ||
- | var foStream = Components.classes[" | ||
- | file.initWithPath(filename); | ||
- | foStream.init(file, | ||
- | foStream.write(data, | ||
- | foStream.close(); | ||
- | }; | ||
- | |||
- | writeFile("/ | ||
- | |||
- | == TODO == | ||
- | |||
- | many other things :) | ||
+ | See [[dev/ |