How to push a PDF file obtained from ZU.doGet to an attachment?

I am trying to add the following as the last step in doImport for PubMedXML:

var jsonURL = "https://public-api.thirdiron.com/public/v1/libraries/61/articles/pmid/"
+ PMID + "?access_token=a9ff5066-cccc-4436-be12-8364b4c8f1da";
ZU.doGet(jsonURL, function(jsonFile) {
var article = JSON.parse(jsonFile);
pdfURL = "https://api.thirdiron.com/v2/libraries/61/articles/"
+ article.data.id + "/fullTextFile?access_token=e91ccd18-4871-4a0d-9eda-c96e279b1eee";
ZU.doGet(pdfURL, function(pdfFile) {
Z.debug(pdfFile);
newItem.attachments.push({
title: "Full Text PDF",
mimeType: "application/pdf",
document: pdfFile
});
});
});

I can confirm pdfFile does contain the content of the actual pdfFile. If I tried pushing pdfURL to the attachment instead, Zotero will only obtain the EZproxy login page or the ScienceDirect intermediate page if I used VPN to connect to the institutional network.
Sign In or Register to comment.