Skip to content

Paste API v1

Ryan Voots edited this page Apr 26, 2017 · 8 revisions

All API calls live under a base url of /api/v1/

POST /paste

Create a new paste

Parameters

Use standard form encoding

  • username - Username that's pasting this
  • channel - channel announcement identifier, optional
  • description - Subject/title of the paste
  • language - language of the paste, currently stored but unused. qw/perl perl4 perl5.5 perl5.6 perl5.8 perl 5.10 perl 5.12 perl5.14 perl5.16 perl5.18 perl5.20 perl5.22 perl5.24 text/
  • expire - How many hours should this paste be alive for, optional
  • paste - Contents of the paste itself

Returns

{
  "url": "https://perlbot.pl/pastebin/foobar", 
  "id": "foobar"
}

GET /paste/:id

Get contents of a paste

Returns

{
 "paste": "paste contents...", 
 "when": "2017-01-01T00:00:00Z", 
 "username": "simcop2387", 
 "description": "I broke this", 
 "output": "hello world",
 "language": "perl4"
}

GET /languages

Gives a list of supported languages by the pastebin. Each language is described by

  • name - The name to give to the pastebin
  • description - A proper name for the language, as some may be abbreviated or non-obvious. Will contain spaces and special characters
  • mode - This is the mode that syntax highlighting will be put into on the editor/viewer for this language.

Returns

{
  languages => [
   {
         "mode" : "perl",
         "description" : "Perl 5.5",
         "name" : "perl5.5"
   },
   ...,
  ]
}
Clone this wiki locally