1
0
Эх сурвалжийг харах

doc: document share endpoints

KernelDeimos 11 сар өмнө
parent
commit
1389298f8c
1 өөрчлөгдсөн 40 нэмэгдсэн , 0 устгасан
  1. 40 0
      doc/api/share.md

+ 40 - 0
doc/api/share.md

@@ -0,0 +1,40 @@
+# Share Endpoints
+
+Share endpoints allow sharing files with other users.
+
+
+## POST `/share/item-by-username` (auth required)
+
+### Description
+
+The `/share/item-by-username` endpoint grants access permission
+for an item to the specified user. This user will also receive an
+email about the shared item.
+
+### Parameters
+
+| Name | Description | Default Value |
+| ---- | ----------- | -------- |
+| path | Location of the item | **required** |
+| username | Username of the user to share to | **required** |
+| access_level | Either `'read'` or `'write'` | `'write'` |
+
+### Response
+
+This endpoint responds with an empty object (`{}`).
+
+### Request Example
+
+```javascript
+await fetch("https://api.puter.local/share/item-by-username", {
+  headers: {
+    "Content-Type": "application/json",
+    "Authorization": `Bearer ${puter.authToken}`,
+  },
+  body: JSON.stringify({
+    path: "/my-username/Desktop/some-file.txt",
+    username: "other-username",
+  }),
+  method: "POST",
+});
+```