diff --git a/src/components/api-section.js b/src/components/api-section.js index b832924..c33a191 100644 --- a/src/components/api-section.js +++ b/src/components/api-section.js @@ -133,6 +133,7 @@ export default function APISection({ APISection.propTypes = { id: PropTypes.oneOf([ 'get-preprints', + 'get-reviews', 'get-review', 'get-request', 'post-request', diff --git a/src/components/api.js b/src/components/api.js index 17c3d43..c2caefa 100644 --- a/src/components/api.js +++ b/src/components/api.js @@ -44,6 +44,34 @@ export default function API() { curl https://outbreaksci.prereview.org/api/preprint?q=name%3ACOVID-19&include_docs=true&limit=2

+

+ Example to return many preprints, sorted by date of last review: +
+ + curl https://outbreaksci.prereview.org/api/preprint/?q=*:*&sort=[%22-dateLastReview%3Cnumber%3E%22%2C%22-score%3Cnumber%3E%22%2C%22-datePosted%3Cnumber%3E%22]&include_docs=true + +

+ + + + GET /api/action?q=@type:RapidPREreviewAction + + } + > +

+ Get all reviews, sorted from oldest to newest. +

+

+ Example to retrieve all reviews, including the preprint associated with each review: +
+ + curl https://outbreaksci.prereview.org/api/action?q=@type:RapidPREreviewAction&include_docs=true + +

+
req.query.key), async (req, res, next) => { - console.log('in async.....'); switch (req.query.key) { case 'demo:get-preprints': { try { @@ -452,6 +451,27 @@ router.get( break; } + case 'demo:get-reviews': { + try { + const body = await req.db.docs.view('ddoc-docs', 'byType', { + key: 'RapidPREreviewAction', + include_docs: true, + reduce: false + }); + const row = body.rows[0]; + if (!row) { + return next(createError(404)); + } + + const payload = row.doc; + req.cache(payload); + res.json(payload); + } catch (err) { + return next(err); + } + break; + } + case 'demo:get-review': { try { const body = await req.db.docs.view('ddoc-docs', 'byType', {