Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
179 lines (113 sloc) 5.81 KB

XML-RPC Interface Description for paste.debian.net

Preface

paste.debian.net supports submitting, retrival and deleting of paste entries via XML-RPC. This documents describes the available methods. The Server can be reached via http://paste.debian.net/server.pl. An example implementation of a client (written in Perl) can be found in the git repository.

Submitting entries (addPaste)

paste.addPaste(pastetext[,name,expire,lang,hidden]) returns rc, id, statusmessage, digest, base_url

expects
  • pastetext: a string that contains the pastetext including \n or \r\n.

  • name (optional): a string that contains the name of the submitter. If not submitted or empty "anonymous" is choosen.

  • expire (optional): an integer which is the time in seconds from now when the entry should expire. If not submitted or empty 172800 (72 hours) is choosen. Maximum is 604800 (7 days). Use -1 for post that shouldn’t expire.

  • lang (optional): a string the indicates which hilighting should be choosen for an entry. If not submitted or empty no hilighting happens.

  • hidden (optional): if non-zero/non-empty the entry will be created as an hidden entry and is therefore not shown on the frontpage.

returns
  • rc (integer): The returncode - anything nonzero indicates that there is an error in submitting the entry. See statusmessage for details.

  • statusmessage (string): This string either contains an error message or some other informations. If the entry could be submitted there will be something like the following returned.

    Your entry has been added to the database
    To download your entry use: http://localhost/paste.pl/38
    To delete your entry use:
    http://localhost/paste.pl/b08c09a0a71d651b202035944573735f314c10a6

    You can use this message in your application.

  • id (integer): The id of the new entry. This can be use for retrival (see getPaste) of paste entrys.

  • digest (sha1 hex): The digest of the entry. This can be used for deleting an entry (see deletePaste).

  • base_url (string): This string is the url_base of the paste. Use base_url+id to call the paste.

Deleting entries (deletePaste)

paste.deletePaste(digest) returns rc, statusmessage

expects
  • digest: the digest of the entry that should be deleted

returns
  • rc (integer): The returncode - anything nonzero indicates that there is an error in deleting the entry. See statusmessage for details.

  • statusmessage (string): This string either contains an error message or some other informations.

  • id (integer): The id of the deleted entry.

Getting entries (getPaste)

paste.getPaste(id) returns rc, statusmessage, code, submitter, submitdate, expiredate

expects
  • id: the id of the entry that should be retrived

returns
  • rc (integer): The returncode - anything nonzero indicates that there is an error in getting the entry. See statusmessage for details.

  • statusmessage (string): This string either contains an error message or some other informations.

  • code (string): The pasteentry with lines separated by \n

  • submitter (string): The name of the submitter. Maximum length allowed is 30 chars. Some special chars like <>,:; are also not allowed.

  • submitdate (string): A timestamp when the entry has been submitted

  • expiredate (string): A timestamp when the entry expires

  • base_url (string): This string is the url_base of the paste. Use base_url+id to call the paste.

Getting Languages (getLanguages)

paste.getLanguages - returns rc, statusmessage, langs

returns
  • rc (integer): The returncode - anything nonzero indicates that there is an error in getting the entry. See statusmessage for details.

  • statusmessage (string): This string either contains an error message or some other informations.

  • langs (arrayref): returns a list a supported languages

Add short url (addShortURL)

paste.addShortURL (url) returns rc, statusmessage, hash, url

returns
  • rc (integer): The returncode - anything nonzero indicates that there is an error in getting the entry. See statusmessage for details.

  • statusmessage (string): This string either contains an error message or some other informations.

  • hash (string): The hash computed for the url.

  • url (string): The new short url

Resolve short url (resolveShortURL)

paste.resolveShortURL (hash) returns rc, statusmessage, hash, url

returns
  • rc (integer): The returncode - anything nonzero indicates that there is an error in getting the entry. See statusmessage for details.

  • statusmessage (string): This string either contains an error message or some other informations.

  • hash (string): The hash for the url.

  • url (string): The original url of the hash

Get click counter for ShortURL (paste.ShortURLClicks)

paste.ShortURLClicks (hash) returns rc, statusmessage, count

returns
  • rc (integer): The returncode - anything nonzero indicates that there is an error in getting the entry. See statusmessage for details.

  • statusmessage (string): This string either contains an error message or some other informations.

  • hash (string): The hash you feeded.

  • count (integer): The click counter for the url