diff options
author | John McLear <john@mclear.co.uk> | 2013-12-09 21:55:04 +0000 |
---|---|---|
committer | John McLear <john@mclear.co.uk> | 2013-12-09 21:55:04 +0000 |
commit | 58bbfd8a65e16581bc13b89f5898fdceb2563e0a (patch) | |
tree | 5539101a7c55e366556f564d1ab92152fe2fc61b /doc/api/http_api.md | |
parent | 7c03bc2610a2d8f0e752bc9796bb460d50166fe9 (diff) | |
parent | 24e96c4f8bc2b7b72644d0f2e68d8a58726c3cf9 (diff) | |
download | etherpad-lite-58bbfd8a65e16581bc13b89f5898fdceb2563e0a.zip |
resolve merge conflict
Diffstat (limited to 'doc/api/http_api.md')
-rw-r--r-- | doc/api/http_api.md | 92 |
1 files changed, 86 insertions, 6 deletions
diff --git a/doc/api/http_api.md b/doc/api/http_api.md index 575b2c98..281cc975 100644 --- a/doc/api/http_api.md +++ b/doc/api/http_api.md @@ -7,7 +7,7 @@ The API gives another web application control of the pads. The basic functions a * grant/forbid access to pads * get/set pad content -The API is designed in a way, so you can reuse your existing user system with their permissions, and map it to etherpad lite. Means: Your web application still has to do authentication, but you can tell etherpad lite via the api, which visitors should get which permissions. This allows etherpad lite to fit into any web application and extend it with real-time functionality. You can embed the pads via an iframe into your website. +The API is designed in a way, so you can reuse your existing user system with their permissions, and map it to Etherpad. Means: Your web application still has to do authentication, but you can tell Etherpad via the api, which visitors should get which permissions. This allows Etherpad to fit into any web application and extend it with real-time functionality. You can embed the pads via an iframe into your website. Take a look at [HTTP API client libraries](https://github.com/ether/etherpad-lite/wiki/HTTP-API-client-libraries) to see if a library in your favorite language. @@ -61,7 +61,9 @@ Portal submits content into new blog post ## Usage ### API version -The latest version is `1.2` +The latest version is `1.2.8` + +The current version can be queried via /api. ### Request Format @@ -101,7 +103,7 @@ Responses are valid JSON in the following format: ### Authentication -Authentication works via a token that is sent with each request as a post parameter. There is a single token per Etherpad-Lite deployment. This token will be random string, generated by Etherpad-Lite at the first start. It will be saved in APIKEY.txt in the root folder of Etherpad Lite. Only Etherpad Lite and the requesting application knows this key. Token management will not be exposed through this API. +Authentication works via a token that is sent with each request as a post parameter. There is a single token per Etherpad deployment. This token will be random string, generated by Etherpad at the first start. It will be saved in APIKEY.txt in the root folder of Etherpad. Only Etherpad and the requesting application knows this key. Token management will not be exposed through this API. ### Node Interoperability @@ -130,7 +132,7 @@ creates a new group #### createGroupIfNotExistsFor(groupMapper) * API >= 1 -this functions helps you to map your application group ids to etherpad lite group ids +this functions helps you to map your application group ids to Etherpad group ids *Example returns:* * `{code: 0, message:"ok", data: {groupID: g.s8oes9dhwrvt0zif}}` @@ -186,7 +188,7 @@ creates a new author #### createAuthorIfNotExistsFor(authorMapper [, name]) * API >= 1 -this functions helps you to map your application author ids to etherpad lite author ids +this functions helps you to map your application author ids to Etherpad author ids *Example returns:* * `{code: 0, message:"ok", data: {authorID: "a.s8oes9dhwrvt0zif"}}` @@ -302,6 +304,66 @@ returns the text of a pad formatted as HTML * `{code: 0, message:"ok", data: {html:"Welcome Text<br>More Text"}}` * `{code: 1, message:"padID does not exist", data: null}` +#### setHTML(padID, text) + * API >= 1 + +sets the html of a pad + +*Example returns:* + * `{code: 0, message:"ok", data: null}` + * `{code: 1, message:"padID does not exist", data: null}` + * `{code: 1, message:"text too long", data: null}` + +#### getAttributePool(padID) + * API >= 1.2.8 + +returns the attribute pool of a pad + +*Example returns:* + * `{ "code":0, + "message":"ok", + "data": { + "pool":{ + "numToAttrib":{ + "0":["author","a.X4m8bBWJBZJnWGSh"], + "1":["author","a.TotfBPzov54ihMdH"], + "2":["author","a.StiblqrzgeNTbK05"], + "3":["bold","true"] + }, + "attribToNum":{ + "author,a.X4m8bBWJBZJnWGSh":0, + "author,a.TotfBPzov54ihMdH":1, + "author,a.StiblqrzgeNTbK05":2, + "bold,true":3 + }, + "nextNum":4 + } + } + }` + * `{"code":1,"message":"padID does not exist","data":null}` + +#### getRevisionChangeset(padID, [rev]) + * API >= 1.2.8 + +get the changeset at a given revision, or last revision if 'rev' is not defined. + +*Example returns:* + * `{ "code" : 0, + "message" : "ok", + "data" : "Z:1>6b|5+6b$Welcome to Etherpad!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nGet involved with Etherpad at http://etherpad.org\n" + }` + * `{"code":1,"message":"padID does not exist","data":null}` + * `{"code":1,"message":"rev is higher than the head revision of the pad","data":null}` + +#### createDiffHTML(padID, startRev, endRev) + * API >= 1.2.7 + +returns an object of diffs from 2 points in a pad + +*Example returns:* + * `{"code":0,"message":"ok","data":{"html":"<style>\n.authora_HKIv23mEbachFYfH {background-color: #a979d9}\n.authora_n4gEeMLsv1GivNeh {background-color: #a9b5d9}\n.removed {text-decoration: line-through; -ms-filter:'progid:DXImageTransform.Microsoft.Alpha(Opacity=80)'; filter: alpha(opacity=80); opacity: 0.8; }\n</style>Welcome to Etherpad!<br><br>This pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!<br><br>Get involved with Etherpad at <a href=\"http://etherpad.org\">http://etherpad.org</a><br><span class=\"authora_HKIv23mEbachFYfH\">aw</span><br><br>","authors":["a.HKIv23mEbachFYfH",""]}}` + * `{"code":4,"message":"no or wrong API Key","data":null}` + ### Chat #### getChatHistory(padID, [start, end]) * API >= 1.2.7 @@ -377,6 +439,24 @@ deletes a pad * `{code: 0, message:"ok", data: null}` * `{code: 1, message:"padID does not exist", data: null}` +#### copyPad(sourceID, destinationID[, force=false]) + * API >= 1.2.8 + +copies a pad with full history and chat. If force is true and the destination pad exists, it will be overwritten. + +*Example returns:* + * `{code: 0, message:"ok", data: null}` + * `{code: 1, message:"padID does not exist", data: null}` + +#### movePad(sourceID, destinationID[, force=false]) + * API >= 1.2.8 + +moves a pad. If force is true and the destination pad exists, it will be overwritten. + +*Example returns:* + * `{code: 0, message:"ok", data: null}` + * `{code: 1, message:"padID does not exist", data: null}` + #### getReadOnlyID(padID) * API >= 1 @@ -466,4 +546,4 @@ returns ok when the current api token is valid lists all pads on this epl instance *Example returns:* - * `{code: 0, message:"ok", data: ["testPad", "thePadsOfTheOthers"]}` + * `{code: 0, message:"ok", data: {padIDs: ["testPad", "thePadsOfTheOthers"]}}` |