Mvolz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/138349

Change subject: Supplies methods to send requests to a Zotero serv
......................................................................

Supplies methods to send requests to a Zotero serv

Zotero.js added to supply methods for sending req-
uests to a Zotero server.

Currently prints to screen a response body for a
given url.

Change-Id: I35df72899364fea3c1c888250fe15c2e6ef573de
---
A zotero.js
1 file changed, 37 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/cite-from-id 
refs/changes/49/138349/1

diff --git a/zotero.js b/zotero.js
new file mode 100644
index 0000000..4fc4fdd
--- /dev/null
+++ b/zotero.js
@@ -0,0 +1,37 @@
+#!/usr/bin/env node
+/**
+ * https://www.mediawiki.org/wiki/cite-from-id
+* 
+* Supplies methods to send requests to a Zotero server
+ */
+
+var request = require('request');
+
+var zotero_url = 'http://localhost:1969/web' //assumes zotero already started
+
+var zotero_request  = function(requested_url, sessionid, callback){
+       var options = {
+               url: zotero_url,
+               method: 'POST',
+               json: {
+                       "url": requested_url,
+                       "sessionid": sessionid
+               }
+       };
+
+       request(options, function (error, response, body) {
+               if (!error && response.statusCode == 200) {
+                       callback(body);
+               }
+       });
+};
+
+/*testing below*/
+test_url = "http://www.tandfonline.com/doi/abs/10.1080/15424060903167229";
+test_sessionid = "abc123"
+
+zotero_request(test_url, test_sessionid, function(body){
+       console.log(body);
+
+});
+

-- 
To view, visit https://gerrit.wikimedia.org/r/138349
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I35df72899364fea3c1c888250fe15c2e6ef573de
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cite-from-id
Gerrit-Branch: master
Gerrit-Owner: Mvolz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to