Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Latest commit

 

History

History
70 lines (47 loc) · 1.86 KB

API.md

File metadata and controls

70 lines (47 loc) · 1.86 KB

ScienceBeam API

/api/convert

The currently the only API is /api/convert e.g. http://localhost:8075/api/convert.

It supports three modes of use.

GET

A GET request will show a very simple submission form that allows the user to select a file which will be submitted to the API.

POST PDF as data

The PDF can be posted as data to the API. The API will respond with the JATS XML.

e.g.

curl -X POST --show-error -H "Content-Type: application/pdf" \
  --data-binary @test.pdf \
  http://localhost:8075/api/convert?filename=test.pdf

The filename parameter is optional.

POST PDF as a file

The PDF can also be posted as a file. The effect will be the same as posting it as data.

e.g.

curl -X POST --show-error --form \
  "file=@test.pdf;filename=test.pdf" \
  http://localhost:8075/api/convert

Specify which fields to process

Add the includes URL parameter. Currently the valid values are:

  • title
  • abstract
  • authors
  • affiliations
  • references
  • full-text
curl -X POST --show-error -H "Content-Type: application/pdf" \
  --data-binary @test.pdf \
  'http://localhost:8075/api/convert?filename=test.pdf&includes=title,abstract,authors,affiliations'

Note: This currently does not filter the response but is considered when deciding whether to perform more expensive operations (e.g. references and full-text will be more expensive).

Other Content Types

The API currently supports the following file types:

  • .pdf (application/pdf)
  • .doc (application/msword)
  • .docx (application/vnd.openxmlformats-officedocument.wordprocessingml.document)
  • .dotx (application/vnd.openxmlformats-officedocument.wordprocessingml.template)
  • .rtf (application/rtf)

The content type is inferred from the filename if the content is submitted with the content type application/octet-stream.