zotero / translation-server

A Node.js-based server to run Zotero translators
Other
121 stars 50 forks source link

Incompatible fields #78

Closed shuklaalok7 closed 5 years ago

shuklaalok7 commented 5 years ago

I am using latest build from master branch 3d11fc9af4e2fe026a084722bb5388bd2994a86a.

I am running into an issue that the translation server is giving incomaptible fields that Zotero Web API is rejecting. See the following URL for example.

When I call /web endpoint with URL http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1664467, I get following output,

[{
    "itemType": "webpage",
    "abstractNote": "",
    "libraryCatalog": "",
    "language": "",
    "shortTitle": "",
    "title": "SSRN Electronic Library",
    "publicationTitle": "",
    "dateAdded": "2019-01-18 16:45:13",
    "url": "https://papers.ssrn.co m/sol3/papers.cfm?abstract_id=1664467",
    "tags": [],
    "journalAbbreviation": "",
    "volume": 0,
    "pages": "",
    "accessDate": "2019-01-18 16:45:13",
    "issn": "",
    "collections": [],
    "extra": "",
    "issue": 0,
    "relations": {},
    "doi": ""
}]

But Zotero Web API v3 is giving me 400 with following message,

"'issue' is not a valid field for type 'webpage'"

Similar message is thrown for 'volume' field as well.

My question is why transaltion-server is providing incompatible fields.

My application log is following for more information,

> Calling translation server for URL http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1664467...
> Received response:
[{"key":"2XFIMXBW","version":0,"itemType":"webpage","url":"https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1664467","title":"SSRN Electronic Library","accessDate":"2019-01-18T16:45:13Z"}]
> Total items found: 1
> Response from translation server for URL http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1664467:
[{"itemType":"webpage","accessDate":"2019-01-18T16:45:13Z","title":"SSRN Electronic Library","version":0,"key":"2XFIMXBW","url":"https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1664467"}]
> Converting this response to Zotero items...
> Returning 1 zotero items for URL http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1664467
> Got items extracted from the URL http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1664467
> Total 1 items to create.
> Sending following items data to Zotero Web-API to create items in the library.
[{"itemType":"webpage","abstractNote":"","libraryCatalog":"","language":"","shortTitle":"","title":"SSRN Electronic Library","publicationTitle":"","dateAdded":"2019-01-18 16:45:13","url":"https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1664467","tags":[],"journalAbbreviation":"","volume":0,"pages":"","accessDate":"2019-01-18 16:45:13","issn":"","collections":[],"extra":"","relations":{},"doi":""}]
> Creating 1 items in Zotero account 1399473.
> HTTP status code 200 while creating items in Zotero account 1399473.
> Response from Zotero:
{"success":{},"unchanged":{},"failed":{"0":{"code":400,"message":"'volume' is not a valid field for type 'webpage'"}},"successful":{}}
> Successfully created 0 objects:
> 400 'volume' is not a valid field for type 'webpage'
shuklaalok7 commented 5 years ago

I can add a lot of if-elses to remove such incompatible fields, but that's far from ideal. I believe the translation-server must provide the Zotero-item JSON that Zotero Web API accepts in a CREATE call.

Any help is appreciated.

shuklaalok7 commented 5 years ago

I figured what mistake I made.