Skip to content

Instantly share code, notes, and snippets.

@zuphilip
Last active May 28, 2016 12:12
Show Gist options
  • Save zuphilip/3f434ed6681e28bd19db6bfa6f2a8b45 to your computer and use it in GitHub Desktop.
Save zuphilip/3f434ed6681e28bd19db6bfa6f2a8b45 to your computer and use it in GitHub Desktop.
swagger: '2.0'
# This is your document metadata
info:
version: "0.0.0"
title: Translation Server API
description: |
https://github.com/zotero/translation-server
by zuphilip
schemes:
- http
host: localhost:1969
basePath: /
securityDefinitions: {}
consumes:
- application/json
produces:
- application/json
####################
# define PATHS #
####################
paths:
/refresh:
get:
description: |
Refreshes the translator directory
responses:
200:
description: Success
400:
description: Failure, depending upon git exit status
/web:
post:
description: |
Translates a web page
parameters:
-
name: webrequest
in: body
description: a URL to translate
required: true
schema:
$ref: '#/definitions/Url'
responses:
200:
description: Ok
/import:
post:
description: |
Converts input in any format Zotero can import to items in Zotero server JSON format
parameters:
-
name: importrequest
in: body
description: File to import
required: true
schema:
$ref: '#/definitions/File'
responses:
200:
description: Ok
/export:
post:
description: |
Converts input in Zotero server JSON format to items Zotero can import
parameters:
-
name: exportrequest
in: body
required: true
schema:
$ref: '#/definitions/Export'
responses:
200:
description: Ok
400:
description: Not ok
##################################
# define reusable things #
##################################
definitions:
Url:
type: object
properties:
url:
type: string
sessionid:
type: string
example: |
{
"url":"http://www.tandfonline.com/doi/abs/10.1080/15424060903167229",
"sessionid":"abc123"
}
File:
type: string
example: |
"TY - JOUR
TI - Die Grundlage der allgemeinen Relativitätstheorie
AU - Einstein, Albert
PY - 1916
SP - 769
EP - 822
JO - Annalen der Physik
VL - 49
ER -"
Export:
type: array
items:
type: object
example: |
'[[{"itemKey":"QXJRT3QB","itemVersion":0,"itemType":"journalArticle","creators":[{"firstName":"Jessica","lastName":"Trinoskey","creatorType":"author"},{"firstName":"Frances A.","lastName":"Brahmi","creatorType":"author"},{"firstName":"Carole","lastName":"Gall","creatorType":"author"}],"tags":[],"title":"Zotero: A Product Review","publicationTitle":"Journal of Electronic Resources in Medical Libraries","volume":"6","issue":"3","pages":"224-229","date":"September 9, 2009","DOI":"10.1080/15424060903167229","url":"http://dx.doi.org/10.1080/15424060903167229","abstractNote":"Zotero is a free and open source Firefox extension that exists within the Web browser and allows one to collect, manage, store, and cite resources in a single location. 1 Zotero automatically imports citation information from a number of sources, including nonsubscription, newspaper, and commercial Web sites, and Web-based databases such as PubMed and MedlinePlus. Zotero offers more options for note taking than the better-known citation management system EndNote. Sixteen citation styles are available when Zotero is initially downloaded, with many more freely available. Users can install a plug-in that allows Zotero to integrate with Microsoft Word. Even though Zotero does not have an on-demand customer support service, its Web site offers a wealth of information for users. The authors highly recommend Zotero.","ISSN":"1542-4065","libraryCatalog":"Taylor and Francis+NEJM","accessDate":"CURRENT_TIMESTAMP","shortTitle":"Zotero"}]]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment