Added attachment API examples during manual testing · AdamLien/BookStack@60d4c59 · GitHub
Skip to content

Commit 60d4c59

Browse files
committed
Added attachment API examples during manual testing
1 parent 2409d18 commit 60d4c59

8 files changed

Lines changed: 94 additions & 1 deletion

File tree

app/Http/Controllers/Api/AttachmentApiController.php

Lines changed: 5 additions & 0 deletions

app/Uploads/Attachment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Attachment extends Model
2929
use HasCreatorAndUpdater;
3030

3131
protected $fillable = ['name', 'order'];
32-
protected $hidden = ['path'];
32+
protected $hidden = ['path', 'page'];
3333
protected $casts = [
3434
'external' => 'bool',
3535
];
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "My uploaded attachment",
3+
"uploaded_to": 8,
4+
"link": "https://link.example.com"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "My updated attachment",
3+
"uploaded_to": 4,
4+
"link": "https://link.example.com/updated"
5+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"id": 5,
3+
"name": "My uploaded attachment",
4+
"extension": "",
5+
"uploaded_to": 8,
6+
"external": true,
7+
"order": 2,
8+
"created_by": 1,
9+
"updated_by": 1,
10+
"created_at": "2021-10-20 06:35:46",
11+
"updated_at": "2021-10-20 06:35:46"
12+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"data": [
3+
{
4+
"id": 3,
5+
"name": "datasheet.pdf",
6+
"extension": "pdf",
7+
"uploaded_to": 8,
8+
"external": false,
9+
"order": 1,
10+
"created_at": "2021-10-11 06:18:49",
11+
"updated_at": "2021-10-20 06:31:10",
12+
"created_by": 1,
13+
"updated_by": 1
14+
},
15+
{
16+
"id": 4,
17+
"name": "Cat reference",
18+
"extension": "",
19+
"uploaded_to": 9,
20+
"external": true,
21+
"order": 1,
22+
"created_at": "2021-10-20 06:30:11",
23+
"updated_at": "2021-10-20 06:30:11",
24+
"created_by": 1,
25+
"updated_by": 1
26+
}
27+
],
28+
"total": 2
29+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"id": 5,
3+
"name": "My link attachment",
4+
"extension": "",
5+
"uploaded_to": 4,
6+
"external": true,
7+
"order": 2,
8+
"created_by": {
9+
"id": 1,
10+
"name": "Admin",
11+
"slug": "admin"
12+
},
13+
"updated_by": {
14+
"id": 1,
15+
"name": "Admin",
16+
"slug": "admin"
17+
},
18+
"created_at": "2021-10-20 06:35:46",
19+
"updated_at": "2021-10-20 06:37:11",
20+
"links": {
21+
"html": "<a target=\"_blank\" href=\"https://bookstack.local/attachments/5\">My updated attachment</a>",
22+
"markdown": "[My updated attachment](https://bookstack.local/attachments/5)"
23+
},
24+
"content": "https://link.example.com/updated"
25+
}
Lines changed: 12 additions & 0 deletions

0 commit comments

Comments
 (0)