Skip to content

Commit 1d91622

Browse files
committed
Update attachment api documentation
Updates the date of the contribution Adds missing parameter documentation Adds example curl requests how to call the API Use term attachment instead of image to make more generic Resolves review comment nextcloud#1600 (comment) Signed-off-by: oli-ver <[email protected]>
1 parent cc83bb3 commit 1d91622

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

docs/api/v1.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ In this document, the Notes API major version 1 and all its minor versions are d
1515
| **1.1** | Notes 3.4 (May 2020) | Filter "Get all notes" by category |
1616
| **1.2** | Notes 4.1 (June 2021) | Preventing lost updates, read-only notes, settings |
1717
| **1.3** | Notes 4.5 (August 2022) | Allow custom file suffixes |
18-
| **1.4** | Notes 4.9 (November 2023) | Add external image api |
18+
| **1.4** | Notes 4.9 (August 2025) | Add external image api |
1919

2020

2121

@@ -285,9 +285,17 @@ No valid authentication credentials supplied.
285285
*(since API v1.4)*
286286

287287
#### Request parameters
288-
| Parameter | Type | Description |
289-
|:----------|:------------------------|:-----------------------------------|
290-
| `path` | string, required (path) | Path or name of the image to load. |
288+
| Parameter | Type | Description |
289+
|:----------|:-----------------------------|:-------------------------------------------|
290+
| `id` | integer, required (path) | ID of the note to load the attachment from |
291+
| `path` | string, required (request) | Path or name of the attachment to load. |
292+
293+
Example:
294+
295+
```bash
296+
curl -u "user:password" "https://yournextcloud.com/index.php/apps/notes/api/v1.4/attachment/<id>?path=<path>" -o <outputfilename>.jpg
297+
```
298+
291299

292300
#### Response
293301
##### 200 OK
@@ -307,7 +315,21 @@ No valid authentication credentials supplied.
307315
*(since API v1.4)*
308316

309317
#### Request parameters
310-
None.
318+
| Parameter | Type | Description |
319+
|:----------|:------------------------|:------------------------------------------------|
320+
| `id` | integer, required (path)| ID of the note to upload the attachment to |
321+
322+
Example:
323+
324+
```bash
325+
curl -u "user:password" \
326+
-X POST \
327+
-F "file=@/path/to/image.png" \
328+
"https://yournextcloud.com/index.php/apps/notes/api/v1.4/attachment/<id>"
329+
330+
# The post request will return the filename that was generated:
331+
{"filename":"d8aef2005b4f815fec8ade5388240f2c.png"}
332+
```
311333

312334
#### Response
313335
##### 200 OK

0 commit comments

Comments
 (0)