tpoisot / autocomplete-citeproc

Autocomplete references from JSON files when writing in markdown
MIT License
2 stars 2 forks source link

feature request: use optionally HTTP GET API of Zotero #15

Open rriemann opened 6 years ago

rriemann commented 6 years ago

The Zotero Better BibLatex plugin tegrated recently code that allows to retrieve suggestions via a JSON-RPC API: https://github.com/retorquere/zotero-better-bibtex/issues/852

I have tested it. Please find the example below. I suggest to add a new option (tick box) to the settings to activate as additional source this API to fetch suggestions for a given search query.

This solution allows setups where the json file is not locally available, e.g. in the case that a group shares in Zotero a common library that is later on directly downloaded as bibtex file from a latex toolchain.

POST request (with curl) for the search term Helios:

curl http://localhost:23119/better-bibtex/json-rpc -X POST -H "Content-Type: application/json" -H "Accept: application/json" --data-binary '{"jsonrpc": "2.0", "method": "item.search", "params": ["Helios"] }'

Beautified Response:

{
  "jsonrpc": "2.0",
  "result": [
    {
      "id": "http://zotero.org/users/2043877/items/IWN9RADQ",
      "type": "article-journal",
      "title": "Electing a university president using open-audit voting: Analysis of real-world use of Helios",
      "container-title": "EVT/WOTE",
      "volume": "9",
      "source": "Google Scholar",
      "URL": "https://www.usenix.org/event/evtwote09/tech/full_papers/adida-helios.pdf",
      "shortTitle": "Electing a university president using open-audit voting",
      "author": [
        {
          "family": "Adida",
          "given": "Ben"
        },
        {
          "family": "De Marneffe",
          "given": "Olivier"
        },
        {
          "family": "Pereira",
          "given": "Olivier"
        },
        {
          "family": "Quisquater",
          "given": "Jean-Jacques"
        },
        {
          "literal": "others"
        }
      ],
      "issued": {
        "date-parts": [
          [
            "2009"
          ]
        ]
      },
      "accessed": {
        "date-parts": [
          [
            "2014",
            9,
            2
          ]
        ]
      },
      "library": "My Library",
      "citekey": "AdidaElectinguniversitypresident2009"
    },
    {
      "id": "http://zotero.org/users/2043877/items/XC6XBRK9",
      "type": "article-journal",
      "title": "Helios: Web-based Open-Audit Voting.",
      "container-title": "USENIX Security Symposium",
      "page": "335–348",
      "volume": "17",
      "source": "Google Scholar",
      "abstract": "Voting with cryptographic auditing, sometimes called\nopen-audit voting, has remained, for the most part, a theoretical endeavor. In spite of dozens of fascinating pro-\ntocols and recent ground-breaking advances in the field,\nthere exist only a handful of specialized implementations\nthat few people have experienced directly. As a result, the benefits of cryptographically audited elections have remained elusive.\nWe present Helios, the first web-based, open-audit\nvoting system. Helios is publicly accessible today: any-\none can create and run an election, and any willing observer can audit the entire process. Helios is ideal for online software communities, local clubs, student government, and other environments where trustworthy, secret-ballot elections are required but coercion is not a serious concern. With Helios, we hope to expose many to the power of open-audit elections.",
      "URL": "https://www.usenix.org/legacy/confadmin/sec08/papers/S97/content.pdf",
      "shortTitle": "Helios",
      "author": [
        {
          "family": "Adida",
          "given": "Ben"
        }
      ],
      "issued": {
        "date-parts": [
          [
            "2008"
          ]
        ]
      },
      "accessed": {
        "date-parts": [
          [
            "2014",
            9,
            2
          ]
        ]
      },
      "library": "My Library",
      "citekey": "AdidaHeliosWebbasedOpenAudit2008"
    }
  ],
  "id": null
}

See also:

tpoisot commented 5 years ago

I missed this issue... I think it's cool, but my time to invest in this package is limited. Do you have some code to share?

rriemann commented 5 years ago

No, I haven't used this setup recently. It was for a techdemo.