Skip to content

Commit 1389298

Browse files
committed
doc: document share endpoints
1 parent 2f6c428 commit 1389298

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

doc/api/share.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Share Endpoints
2+
3+
Share endpoints allow sharing files with other users.
4+
5+
6+
## POST `/share/item-by-username` (auth required)
7+
8+
### Description
9+
10+
The `/share/item-by-username` endpoint grants access permission
11+
for an item to the specified user. This user will also receive an
12+
email about the shared item.
13+
14+
### Parameters
15+
16+
| Name | Description | Default Value |
17+
| ---- | ----------- | -------- |
18+
| path | Location of the item | **required** |
19+
| username | Username of the user to share to | **required** |
20+
| access_level | Either `'read'` or `'write'` | `'write'` |
21+
22+
### Response
23+
24+
This endpoint responds with an empty object (`{}`).
25+
26+
### Request Example
27+
28+
```javascript
29+
await fetch("https://api.puter.local/share/item-by-username", {
30+
headers: {
31+
"Content-Type": "application/json",
32+
"Authorization": `Bearer ${puter.authToken}`,
33+
},
34+
body: JSON.stringify({
35+
path: "/my-username/Desktop/some-file.txt",
36+
username: "other-username",
37+
}),
38+
method: "POST",
39+
});
40+
```

0 commit comments

Comments
 (0)