Duplicate keys in API

I have noticed that numerous citations in my database are split into several records in the API with the same key. Why is it organized in this way? Is there any way to keep the API as one key per citation? That would make it a lot easier to retrieve/use the API data in other applications.
  • could you say more about what you mean by that? What type of API call are you talking about? You can get the full item information as JSON in a single call using the item key such as https://api.zotero.org/users/475425/items/X42A7DEE?v=3 from the documentation.
  • edited April 12, 2023
    I am trying to take a specific collection and bring its contents into a different app

    So I am using an API call of this format:

    https://api.zotero.org/users/123456/collections/ABC123ABC/items

    I am parsing the data as such:


    for (let i=1; i<citations.length; i++)
    {
    results.push({
    key:citations[i].data.key,
    title:citations[i].data.title,
    abstractNote:citations[i].data.abstractNote,
    });

    In doing so there are multiple records which match data.key, each with different metadata.

    Am I parsing this wrong? Do I have to first get an array of keys within a collection and then do a separate API call for each key?

  • edited April 12, 2023
    You're almost certainly misunderstanding something, but we'd need to see the actual API response (posted to a Gist or similar) and the specific thing you think is wrong to say more. The code you're running isn't relevant to us — you can just look at the response and see what data is there.
  • I have it running as a demo in postman and can email you privately the full API query and the output as a .json file. Where do I email it?
  • support@zotero.org if you can't post it publicly, but again, you should actually look at it and make sure you can articulate what you think is the problem. The output is very unlikely to be wrong, so the point is more for you to look at the raw output yourself rather than relying on possibly incorrect parsing code.
  • edited April 12, 2023
    @rkaplan@umrpc.com: Again, you need to say exactly what you think is wrong in the JSON output. Saying "there are multiple JSON records for each key" isn't sufficient.
Sign In or Register to comment.