doc/README: update list of endpoints, SDK usage

This commit is contained in:
mappu 2023-05-17 19:09:36 +12:00
parent 6cef907cf9
commit 660038b897

View File

@ -57,19 +57,26 @@ The server responds on the following URLs:
URL |Method |Description URL |Method |Description
---------------------|-------|--- ---------------------|-------|---
`/get/{ID}` |`GET` |Download item content `/get/{ID}` |`GET` |Download item content
`/p/{ID}` |`GET` |Preview item content (HTML)
`/p/{ID}-{ID}-...` |`GET` |Preview multiple item content (HTML)
`/info/{ID}` |`GET` |Get item content metadata (JSON) `/info/{ID}` |`GET` |Get item content metadata (JSON)
`/thumb/{Type}/{ID}` |`GET` |Get item thumbnail image `/thumb/{Type}/{ID}` |`GET` |Get item thumbnail image (JPEG). "Type" should match `[sbtmlh]`.
`/about` |`GET` |Get server metadata (JSON) `/about` |`GET` |Get server metadata (JSON)
## Usage (Embedding for web) ## Usage (Embedding for web)
Your webpage should load the SDK from the contented server, then call the `contented.init` function to display the upload widget over the top of an existing DOM element. Your callback will be passed an array of file IDs of any uploaded items. Your webpage should load the SDK from the contented server, then call the `contented.init` function to display the upload widget over the top of an existing DOM element:
```html ```html
<script type="text/javascript" src="SERVER_ADDR/sdk.js"></script> <script type="text/javascript" src="SERVER_ADDR/sdk.js"></script>
contented.init("#target", function(/* String[] */ items) {}); contented.init("#target");
``` ```
You can optionally supply additional ordered parameters to `contented.init`:
1. A callback, that will be passed an array of file IDs of any uploaded items
2. A callback, that will be called if the SDK widget is closed
## Changelog ## Changelog
2020-07-25: 1.3.1 2020-07-25: 1.3.1