rst2a API

Overview

A key goal for rst2a is to lower the barrier of entry for using reStructuredText. rst2a's API provides rendering as a web service. This makes it possible to render reStructuredText documents without having to install a heap of packages locally, or working out how to glue it all together.

rst2a's API is versioned so that updates to the API can be released in a backwards compatible way. The current version of the API is version 1.0.

If you have any issues with the API, you can contact us here.

Rendering Documents

The base rendering URL for the API is: http://api.rst2a.com/1.0/rst2/<format>

There are three ways to convert a reStructuredText document.

The first is to post the contents of the file to be converted to the form variable 'rst' to the above URL for the desired output format.

Alternatively you can pass the location of a reStructuredText document to the variable 'uri'. There is currently a size limit of 250K for remote files rendered via the 'uri' option.

Finally you can pass the 'token' of a file that was previously uploaded with the rst2/token command.

html

http://api.rst2a.com/1.0/rst2/html

Converts a restructured text document to html.

Arguments

required:

  • rst: the text document to be converted to html or
  • uri: location of a document to be converted to html or
  • token: token of a file uploaded with the rst2/token command

optional:

  • style: selects the style to use for the document.

Example usage:

Post a file to the 'rst' variable:

> curl -F "rst=@resume.rst" http://api.rst2a.com/1.0/rst2/html?style=d-scheme > resume.html

Convert a remote resource with 'uri':

http://api.rst2a.com/1.0/rst2/html?uri=http://open.crngames.com/src/inuma/the-red-book.txt&style=d-scheme

http://api.rst2a.com/1.0/rst2/html/styles

Lists the available html styles.

Example response:

<styles>
  <style name="default" />
  <style name="voidspace" />
  <style name="d-scheme" />
</styles>

pdf

http://api.rst2a.com/1.0/rst2/pdf

Converts a restructured text document to pdf.

Arguments

required:

  • rst: the text document to be converted to pdf or
  • uri: location of a document to be converted to pdf or
  • token: token of a file uploaded with the rst2/token command

optional:

  • class: selects the base latex document class to use. defaults to article.
  • style: selects an additional latex style to apply.
  • use-latex-toc: if 'yes', latex will generate the table of contents, otherwise docutils will generate the table of contents. defaults to 'no'.

Example usage:

Post a file to the 'rst' variable:

> curl -F "rst=@resume.rst" http://api.rst2a.com/1.0/rst2/pdf?class=report&style=style2 > resume.pdf

Convert a remote resource with 'uri':

http://api.rst2a.com/1.0/rst2/pdf?uri=http://open.crngames.com/src/inuma/the-red-book.txt&class=scrartcl&style=zope

Have latex generate the table of contents:

http://api.rst2a.com/1.0/rst2/pdf?uri=http://open.crngames.com/src/inuma/the-red-book.txt&class=scrartcl&style=zope&use-latex-toc=yes

http://api.rst2a.com/1.0/rst2/pdf/classes

Lists the available latex document classes.

Example response:

<classes>
  <class name="article" />
  <class name="report" />
  <class name="book" />
</classes>

http://api.rst2a.com/1.0/rst2/pdf/styles

Lists the available latex styles.

Example response:

<styles>
  <style name="default" />
  <style name="style2" />
</styles>

token

http://api.rst2a.com/1.0/rst2/token

Generate a token for a reStructuredText document, which can be used to generate several renderings of a document and to create shareable links.

Arguments

required:

  • rst: the text document to be checked or
  • uri: location of a document to be checked

Example usage:

Convert the introduction to reStructuredText document to a token. An then link to a rendered view:

> TOKEN=$(curl http://api.rst2a.com/1.0/rst2/token?uri=http://docutils.sourceforge.net/docs/ref/rst/introduction.txt)
> curl http://api.rst2a.com/1.0/rst2/html?token=$TOKEN

Example response:

6c15c58148567e8690a8504eb826b8bc

check

http://api.rst2a.com/1.0/rst2/check

Checks the syntax of the supplied reStructuredText document. It returns a JSON list with an item for each error found. If the syntax is correct, an empty list is returned.

Arguments

required:

  • rst: the text document to be checked or
  • uri: location of a document to be checked

Example usage:

Post a file to the 'rst' variable:

> curl -F "rst=@resume.rst" http://api.rst2a.com/1.0/rst2/check

Check a remote resource with 'uri':

http://api.rst2a.com/1.0/rst2/check?uri=http://rst2a.com/static/examples/errors.rst

Example response:

[{
    "message": "Title underline too short.",
    "type": "warning",
    "line": 2,
    "context": "Heading\n===="
}, {
    "message": "Title underline too short.",
    "type": "warning",
    "line": 5,
    "context": "Section 1\n-------"
}]

74 Comments

Subscribe to comments

 #1

dp_wiz - 13th September, 2007 at 12:30 p.m.

Great! How about JSONp services for html?

 #2

Andy Gayton - 13th September, 2007 at 1:27 p.m.

Hey dp_wiz - were hoping to add cross domain JSON support soon.

Thanks for the reminder of Bob's proposal for standardizing cross domain calls.

http://bob.pythonmac.org/archives/200...

Does anyone know of a standard with more traction? Otherwise we will use that.

 #3

Chewie - 16th September, 2007 at 5:24 p.m.

Can't get the curl example to work when the input file (or text) is non-ASCII.

Any clue on that?

 #4

Chewie - 16th September, 2007 at 5:28 p.m.

Forgot to tell: when using the online form, it works like charm. When using curl, it returns nothing.

 #5

Andy Gayton - 16th September, 2007 at 8:41 p.m.

Chewie, could you mail through the file you are working with? I've put the details for the support contact above in the overview section. I'll check out what's going on.

 #6

Garry - 12th December, 2007 at 7:33 p.m.

Hey Andy,

You can totally do preview from vim:

:!curl -F "rst=@%" http://api.rst2a.com/1.0/rst2/html?st... > /tmp/rst2a-preview.html && open /tmp/rst2a-preview.html

Works on Mac OS X. Other OS's just need to change "open" to whatever their launcher is.

This is just a starting point, d-scheme is hardcoded, taken from your example. But I can imagine the possibilities already!

A vim mapping could be made to shorten that up ;)

 #7

the daniel - 12th December, 2007 at 7:34 p.m.

d-scheme is the best one anyway :)

 #8

Andy Gayton - 12th December, 2007 at 8:52 p.m.

@thedaniel: we're about ready for a 0.2 d-scheme? :))

 #9

bartuer - 21st April, 2008 at 6:52 p.m.

crngames stylesheet looks nice!

 #10

era - 27th April, 2008 at 6:19 a.m.

Is PDF generation broken? I just get errors. (Granted, my document might contain syntax errors if your python-docutils is more strict than the copy I have locally. I tried it on another box at one point and it complained.)

 #11

Andy Gayton - 27th April, 2008 at 3:11 p.m.

Heya era,

You can't currently convert documents to PDF which contain images:

http://rst2a.com/about/#c351

Other than that, most documents should convert fine though. Is it possible to send through the document you are trying to convert to here

cheers,

 #12

Björn Lindqvist - 30th June, 2009 at 9:59 a.m.

This is an excellent service! Is it possible to get syntax highlighting to work?

 #13

mac - 26th December, 2010 at 9:36 a.m.

Improv request: ability to get only body innerHTML

 #14

janelola - 19th April, 2011 at 9:41 p.m.

[url=http://www.airmax1.com/index.php?main_page=index&cPath=93_111]kids nike air max[/url] [url=http://www.airmax1.com/index.php?main_page=index&cPath=93_114]nike air max moto 7[/url] [url=http://www.airmax1.com/index.php?main_page=index&cPath=93_99]nike air max 2009 leather[/url] [url=http://www.airmax1.com/index.php?main_page=index&cPath=93_113]womens nike air max 2009[/url] [url=http://www.airmax1.com/index.php?main_page=index&cPath=93_99]air max 1[/url] [url=http://www.airmax1.com/index.php?main_page=index&cPath=93_96]nike air max 95[/url] [url=http://www.airmax1.com/index.php?main_page=index&cPath=93_111]nike air max moto 8[/url] [url=http://www.airmax1.com/index.php?main_page=index&cPath=93_95]nike air max classic[/url] [url=http://www.airmax1.com/index.php?main_page=index&cPath=93_105]air max 95[/url] [url=http://www.airmax1.com/index.php?main_page=index&cPath=93_103]nike air max kids[/url]

 #17

meong - 26th July, 2011 at 12:30 p.m.

Every time a spec was needed, invariably, a debate over the format of the spec would arise - with developers preferring a plain text document on a wiki, Meriahkan Pesta Ulang Tahun Bersama GarudaFood
Mivo Tv
Sms Lucu
SMADAV and business people preferring traditional tools such as Microsoft Word based on a set template

 #18

Danny - 26th July, 2011 at 1:40 p.m.

 #19

butway - 29th July, 2011 at 5:28 a.m.

 #20

ShermanCAROL - 11th August, 2011 at 12:45 p.m.

I had got a desire to begin my commerce, however I did not earn enough amount of money to do this. Thank heaven my fellow advised to take the loan. Therefore I took the credit loan and made real my old dream.

 #21

SchwartzMelinda18 - 13th August, 2011 at 2:59 p.m.

Research papers creating supposes to be not a thing to worry about at present time, because premium essay writing service should resolve even the most hard papers writing assignment.

 #22

TOP 1 OLI SINTETIK MOBIL-MOTOR INDONESIA - 16th August, 2011 at 12:42 a.m.

It's a good article, thanks for the information. Please visit my website @ TOP 1 OLI SINTETIK MOBIL-MOTOR INDONESIA and Iklan baris gratis tanpa daftar

 #23

Irene21Haney - 16th August, 2011 at 11:55 a.m.

Are you frustrated just because of custom papers writing? Don't retreat! You will be able to solve types of problems if buy affordable essay. It is truth. Furthermore, I have been done it for years.

 #24

HoustonSelena29 - 16th August, 2011 at 6:58 p.m.

There is no matter if students are experienced in term papers or expository essay accomplishing, they would have to present their essays writing skills in any case. Thus to buy essay papers at the assignment writing service could be a proper way out.

 #25

Pulsa Elektrik Termurah - 17th August, 2011 at 5:06 a.m.

It's a nice article. Please visit my website @ Pulsa Elektrik Murah

 #26

orange - 19th August, 2011 at 2:33 a.m.

Wow!The design of it is very special.Out lastest item -- air max 90 pas cher

href="http://www.airmaxs-store.com"> air max classic pas cher fellow the<

href="http://www.69sneakers.com"> air max 90 pas cher modern society 's

speed christian louboutin pas cher

closely.

 #28

robert - 21st August, 2011 at 8:33 p.m.

Nice info, thanks. ya there are interesting articles please read rcti online . firefox 6 . zivilia pintu taubat . e991 . dream high . pekalongan cheater . cheat ninja saga . facebook login

 #29

wakaka - 23rd August, 2011 at 7:54 p.m.

I had got a desire to begin my commerce, however I did not earn enough amount of money to do this. Thank heaven my fellow advised to take the Android Cellphones
Pointblank Lucu . Pointblank Lucu Sule . wallpaper Pointblank . wallpaper lucu . ninja saga news Therefore I took the credit loan and made real my old dream

 #30

NUNEZSallie - 27th August, 2011 at 12:10 p.m.

A lot of term paper writing services present intereating interesting just about this post, thus buy an essay or buy term papers to know a lot just about this topic.

 #31

CarrollCharlotte26 - 27th August, 2011 at 7:43 p.m.

There are quantities of blocks along the career building way. But, the custom essay service was invented to assist university students with custom term papers writing.

 #32

zita - 29th August, 2011 at 6:20 a.m.

I am glad to visit your blog.. I found this post is really useful one.. I love reading this kind of stuff. Your blog is one of a kind, it is highly appreciated. domain name registration | domain register

 #33

Mendoza30Caitlin - 31st August, 2011 at 2:06 a.m.

You can detect visual changes of your site's page rank if you try to utilize submitting articles company and SEO options. Your website can get you more traffic!

 #34

nicsra - 4th September, 2011 at 6:21 a.m.

It is valuable article for me where I am learning about API. Thanks. web designer web designer surabaya web design web design surabaya

 #35

asdfafa - 5th September, 2011 at 10:31 p.m.

very interesting... Azek Decking Azek Trim

 #36

yoetama - 11th September, 2011 at 8:58 p.m.

 #37

online dating - 13th September, 2011 at 7:29 a.m.

It was a great thing to have come across this post. Great job done.
internet dating

 #38

cxme1 - 15th September, 2011 at 6:55 p.m.

Great api
Superlig Maclari

 #39

Jim - 16th September, 2011 at 11:28 a.m.

very interesting post
dating site free

 #40

Nancy - 16th September, 2011 at 11:30 a.m.

interesting post on api
dating

 #42

Writessay - 5th October, 2011 at 4:15 a.m.

Great research and writing ideas all put in one blog post. Need to bookmark this page for future reference.

Model Custom Essay
Custom Term Paper
Quality Research Paper
Graduate With Honour

 #44

kedai obat - 9th October, 2011 at 3:08 a.m.


Ternyata jasa SEO murah adalah pekerjaan mulia. Dengan kerja copy paste online dan suka minum XAMthone serta meliput daftar kontes SEO terbaru membuat saya bisa merancang Souvenir Pernikahan yang pasti Souvenir Pernikahan Murah dan Undangan Pernikahan dengan mengikut sertakan situs bursa iklan, bursa promosi , serta bursa jual beli sebagai ajang promosi SEO murah membuat saya semakin semangat dalam belajar bisnis online dan melayani pesanan jasa SEO dari pelanggan saya untuk biaya kuliah. Semoga saya bisa menjadi orang yang sukses di dunia dan akhirat serta menjadi raja di dunia maya, raja virtual tentunya.

 #45

Domain Registration With Debit Card - 13th October, 2011 at 12:52 a.m.

 #46

vxdfbxd - 14th October, 2011 at 3:37 a.m.

dxfhzdfgdfg dfg dshdfhgfjfhj fghj zrsdg t
jhgfzsjdgfzs

 #47

personal statement writers - 15th October, 2011 at 2:09 a.m.

However, when files are posted as a file upload, D jingo doesn't make their contents available as a Unicode string.
personal statement writers

 #48

admissions essay - 15th October, 2011 at 2:13 a.m.

Peter Parents just sent through a style he's been using for various tech documents for a gnome.org project. Here's an example page using the style sheet..!
admissions essay

 #53

jacob - 20th October, 2011 at 5:06 a.m.

 #54

Marian Saunders - 21st October, 2011 at 1:55 a.m.

This is a very substantial post. Thank you for it can help me a lot in doing mysample essay. I have learned a lot from it.

 #55

Dono - 21st October, 2011 at 12:04 p.m.

interesting API. i love it. tx
Jasa pengiriman || Busana Muslim

 #56

Jin Budux - 21st October, 2011 at 12:08 p.m.

 #57

free date - 23rd October, 2011 at 4:33 a.m.

I like the post, these sort of quality post are always are on my list. THX
free dating site

 #58

MakWoookx - 23rd October, 2011 at 10:52 a.m.

A key jasa SEO goal for rst2a is to lower jasa SEO the barrier of entry for jasa SEO using reStructuredText. rst2a's API jasa SEO provides rendering as a web service jasa SEO. This makes it possible to render reStructuredText documents without having to install jasa SEO a heap of packages locally, or working out how to glue it all together jasa SEO.

 #60

itsme - 1st November, 2011 at 3:38 p.m.

very interesting post

aksesoris ipad
aksesoris galaxy tab

 #61

Steven Gogon - 1st November, 2011 at 7:32 p.m.

 #62

Zita - 3rd November, 2011 at 6:17 a.m.

You made certain good points there. I did a search on the subject matter and found the majority of people will have the same opinion with your blog.
website registraiton india | how to register a website

 #64

hoodiesta - 10th November, 2011 at 1:26 a.m.

Nice Sharing. keep posting such good articles.
T Shirt Printing

 #65

saaonline - 10th November, 2011 at 10:58 a.m.

dengan ini saya sampaikan pulsa murah untuk bisnis pulsa murah anda, silahkan juga pesan huruf timbul dan neon box jasa seo termurah atau jasa seo murah dari cara memperbesar penis dan juga silahkan main game di judi bola online dan juga pulsa elektrik dan jangan lupa untuk memesan jasa seo saya. yoh.. masuk sini era autorefill

 #67

Nandhini - 14th November, 2011 at 1:55 a.m.

Hi, nice post. I have been wondering about this topic,so thanks for sharing.

 #68

Help With Essay Writing - 14th November, 2011 at 4:15 a.m.

I like your working on this web, thanks for update posting i get too many useful links and information from this website.
Essay Writing Services | Write My Essay | Buy Essay | Assignment Help | Custom Paper Writing

 #69

How to register a domain - 15th November, 2011 at 5:47 a.m.

Great job!It is so lucky to read your blog I feel strongly about it and love learning more on this topic
Domain registration | Domain name registration india

 #70

John Great - 15th November, 2011 at 9:36 a.m.

Hey, i like your article about rst2a api. I believe this api will be useful

 #71

Anonymous - 16th November, 2011 at 1:16 a.m.

I really like you thought. Good article! Essay Help | Coursework Help | Assignment Help

 #72

Anonymous - 16th November, 2011 at 1:17 a.m.

I really like you thought. nice article! Thesis Help | Dissertation Help

 #73

Gedung Pernikahan di Jakarta - 16th November, 2011 at 6:48 a.m.

 #74

ashley - 16th November, 2011 at 9:05 a.m.

I reached information which it looked for at last. Thank you for a wonderful contribution. We wish to express our gratitude as one parties concerned.
butterfly

Post a comment



Hosting kindly provided by our friends at Staticloud, an experimental service for static website hosting. Give them a try and let them know what you think!