summaryrefslogtreecommitdiff
path: root/doc/api/http_api.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/api/http_api.md')
-rw-r--r--doc/api/http_api.md50
1 files changed, 25 insertions, 25 deletions
diff --git a/doc/api/http_api.md b/doc/api/http_api.md
index 93a9b399..cacefb53 100644
--- a/doc/api/http_api.md
+++ b/doc/api/http_api.md
@@ -3,42 +3,42 @@
## What can I do with this API?
The API gives another web application control of the pads. The basic functions are
-* create/delete pads
+* create/delete pads
* 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. 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.
+Take a look at [HTTP API client libraries](https://github.com/ether/etherpad-lite/wiki/HTTP-API-client-libraries) to check if a library in your favorite programming language is available.
## Examples
### Example 1
-A portal (such as WordPress) wants to give a user access to a new pad. Let's assume the user have the internal id 7 and his name is michael.
+A portal (such as WordPress) wants to give a user access to a new pad. Let's assume the user have the internal id 7 and his name is michael.
-Portal maps the internal userid to an etherpad author.
+Portal maps the internal userid to an etherpad author.
> Request: `http://pad.domain/api/1/createAuthorIfNotExistsFor?apikey=secret&name=Michael&authorMapper=7`
->
+>
> Response: `{code: 0, message:"ok", data: {authorID: "a.s8oes9dhwrvt0zif"}}`
Portal maps the internal userid to an etherpad group:
> Request: `http://pad.domain/api/1/createGroupIfNotExistsFor?apikey=secret&groupMapper=7`
->
+>
> Response: `{code: 0, message:"ok", data: {groupID: "g.s8oes9dhwrvt0zif"}}`
Portal creates a pad in the userGroup
> Request: `http://pad.domain/api/1/createGroupPad?apikey=secret&groupID=g.s8oes9dhwrvt0zif&padName=samplePad&text=This is the first sentence in the pad`
->
+>
> Response: `{code: 0, message:"ok", data: null}`
Portal starts the session for the user on the group:
> Request: `http://pad.domain/api/1/createSession?apikey=secret&groupID=g.s8oes9dhwrvt0zif&authorID=a.s8oes9dhwrvt0zif&validUntil=1312201246`
->
+>
> Response: `{"data":{"sessionID": "s.s8oes9dhwrvt0zif"}}`
Portal places the cookie "sessionID" with the given value on the client and creates an iframe including the pad.
@@ -50,7 +50,7 @@ A portal (such as WordPress) wants to transform the contents of a pad that multi
Portal retrieves the contents of the pad for entry into the db as a blog post:
> Request: `http://pad.domain/api/1/getText?apikey=secret&padID=g.s8oes9dhwrvt0zif$123`
->
+>
> Response: `{code: 0, message:"ok", data: {text:"Welcome Text"}}`
Portal submits content into new blog post
@@ -86,35 +86,35 @@ Responses are valid JSON in the following format:
* **2** internal error
* **3** no such function
* **4** no or wrong API Key
-* **message** a status message. Its ok if everything is fine, else it contains an error message
+* **message** a status message. It's ok if everything is fine, else it contains an error message
* **data** the payload
### Overview
-![API Overview](http://i.imgur.com/d0nWp.png)
+![API Overview](https://i.imgur.com/d0nWp.png)
## Data Types
* **groupID** a string, the unique id of a group. Format is g.16RANDOMCHARS, for example g.s8oes9dhwrvt0zif
* **sessionID** a string, the unique id of a session. Format is s.16RANDOMCHARS, for example s.s8oes9dhwrvt0zif
* **authorID** a string, the unique id of an author. Format is a.16RANDOMCHARS, for example a.s8oes9dhwrvt0zif
-* **readOnlyID** a string, the unique id of an readonly relation to a pad. Format is r.16RANDOMCHARS, for example r.s8oes9dhwrvt0zif
+* **readOnlyID** a string, the unique id of a readonly relation to a pad. Format is r.16RANDOMCHARS, for example r.s8oes9dhwrvt0zif
* **padID** a string, format is GROUPID$PADNAME, for example the pad test of group g.s8oes9dhwrvt0zif has padID g.s8oes9dhwrvt0zif$test
### Authentication
-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.
+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
-All functions will also be available through a node module accessable from other node.js applications.
+All functions will also be available through a node module accessible from other node.js applications.
### JSONP
The API provides _JSONP_ support to allow requests from a server in a different domain.
Simply add `&jsonp=?` to the API call.
-Example usage: http://api.jquery.com/jQuery.getJSON/
+Example usage: https://api.jquery.com/jQuery.getJSON/
## API Methods
@@ -123,7 +123,7 @@ Pads can belong to a group. The padID of grouppads is starting with a groupID li
#### createGroup()
* API >= 1
-
+
creates a new group
*Example returns:*
@@ -132,7 +132,7 @@ creates a new group
#### createGroupIfNotExistsFor(groupMapper)
* API >= 1
-this functions helps you to map your application group ids to Etherpad 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}}`
@@ -175,7 +175,7 @@ lists all existing groups
* `{code: 0, message:"ok", data: {groupIDs: []}}`
### Author
-These authors are bound to the attributes the users choose (color and name).
+These authors are bound to the attributes the users choose (color and name).
#### createAuthor([name])
* API >= 1
@@ -188,7 +188,7 @@ creates a new author
#### createAuthorIfNotExistsFor(authorMapper [, name])
* API >= 1
-this functions helps you to map your application author ids to Etherpad 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"}}`
@@ -213,7 +213,7 @@ Returns the Author Name of the author
-> can't be deleted cause this would involve scanning all the pads where this author was
### Session
-Sessions can be created between a group and an author. This allows an author to access more than one group. The sessionID will be set as a cookie to the client and is valid until a certain date. The session cookie can also contain multiple comma-seperated sessionIDs, allowing a user to edit pads in different groups at the same time. Only users with a valid session for this group, can access group pads. You can create a session after you authenticated the user at your web application, to give them access to the pads. You should save the sessionID of this session and delete it after the user logged out.
+Sessions can be created between a group and an author. This allows an author to access more than one group. The sessionID will be set as a cookie to the client and is valid until a certain date. The session cookie can also contain multiple comma-separated sessionIDs, allowing a user to edit pads in different groups at the same time. Only users with a valid session for this group, can access group pads. You can create a session after you authenticated the user at your web application, to give them access to the pads. You should save the sessionID of this session and delete it after the user logged out.
#### createSession(groupID, authorID, validUntil)
* API >= 1
@@ -307,7 +307,7 @@ returns the text of a pad formatted as HTML
#### setHTML(padID, html)
* API >= 1
-sets the text of a pad based on HTML, HTML must be well formed. Malformed HTML will send a warning to the API log.
+sets the text of a pad based on HTML, HTML must be well-formed. Malformed HTML will send a warning to the API log.
*Example returns:*
* `{code: 0, message:"ok", data: null}`
@@ -411,7 +411,7 @@ creates a chat message, saves it to the database and sends it to all connected c
* `{code: 1, message:"text is no string", data: null}`
### Pad
-Group pads are normal pads, but with the name schema GROUPID$PADNAME. A security manager controls access of them and its forbidden for normal pads to include a $ in the name.
+Group pads are normal pads, but with the name schema GROUPID$PADNAME. A security manager controls access of them and it's forbidden for normal pads to include a $ in the name.
#### createPad(padID [, text])
* API >= 1
@@ -543,7 +543,7 @@ return true of false
#### setPassword(padID, password)
* API >= 1
-returns ok or a error message
+returns ok or an error message
*Example returns:*
* `{code: 0, message:"ok", data: null}`
@@ -575,7 +575,7 @@ returns the timestamp of the last revision of the pad
*Example returns:*
* `{code: 0, message:"ok", data: {lastEdited: 1340815946602}}`
* `{code: 1, message:"padID does not exist", data: null}`
-
+
#### sendClientsMessage(padID, msg)
* API >= 1.1
@@ -598,7 +598,7 @@ returns ok when the current api token is valid
#### listAllPads()
* API >= 1.2.1
-
+
lists all pads on this epl instance
*Example returns:*