f37167cdcd2bba6cc702ce76ef80f68ffbee9f45
[akkoma] / docs / ap_extensions.md
1 # AP Extensions
2 ## Actor endpoints
3
4 The following endpoints are additionally present into our actors.
5
6 - `oauthRegistrationEndpoint`
7 - `uploadMedia`
8
9 ### oauthRegistrationEndpoint
10
11 Points to MastodonAPI `/api/v1/apps` for now.
12
13 See <https://docs.joinmastodon.org/methods/apps/>
14
15 ### uploadMedia
16
17 Inspired by <https://www.w3.org/wiki/SocialCG/ActivityPub/MediaUpload>
18
19 Content-Type: multipart/form-data
20
21 Parameters:
22 - (required) `file`: The file being uploaded
23 - (optionnal) `description`: A plain-text description of the media, for accessibility purposes.
24
25 Response: HTTP 201 Created with the object into the body, no `Location` header provided as it doesn't have an `id`
26
27 The object given in the reponse should then be inserted into an Object's `attachment` field.
28
29 ## ChatMessages
30
31 ChatMessages are the messages sent in 1-on-1 chats. They are similar to
32 `Note`s, but the addresing is done by having a single AP actor in the `to`
33 field. Addressing multiple actors is not allowed. These messages are always
34 private, there is no public version of them. They are created with a `Create`
35 activity.
36
37 Example:
38
39 ```json
40 {
41 "actor": "http://2hu.gensokyo/users/raymoo",
42 "id": "http://2hu.gensokyo/objects/1",
43 "object": {
44 "attributedTo": "http://2hu.gensokyo/users/raymoo",
45 "content": "You expected a cute girl? Too bad.",
46 "id": "http://2hu.gensokyo/objects/2",
47 "published": "2020-02-12T14:08:20Z",
48 "to": [
49 "http://2hu.gensokyo/users/marisa"
50 ],
51 "type": "ChatMessage"
52 },
53 "published": "2018-02-12T14:08:20Z",
54 "to": [
55 "http://2hu.gensokyo/users/marisa"
56 ],
57 "type": "Create"
58 }
59 ```
60
61 This setup does not prevent multi-user chats, but these will have to go through
62 a `Group`, which will be the recipient of the messages and then `Announce` them
63 to the users in the `Group`.