docs/honk.3 (view raw)
1.\"
2.\" Copyright (c) 2019 Ted Unangst
3.\"
4.\" Permission to use, copy, modify, and distribute this software for any
5.\" purpose with or without fee is hereby granted, provided that the above
6.\" copyright notice and this permission notice appear in all copies.
7.\"
8.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15.\"
16.Dd $Mdocdate$
17.Dt HONK 3
18.Os
19.Sh NAME
20.Nm honk
21.Nd API access
22.Sh DESCRIPTION
23In addition to the standard web interface, some functionality is
24available via the
25.Nm
26HTTP API.
27.Pp
28With the exception of login, all requests should contain
29the following form values.
30.Bl -tag -width action
31.It Fa action
32The desired action.
33See below.
34.It Fa token
35An authorization token.
36Alternatively, may be passed in the
37.Dq Authorization
38HTTP header.
39.El
40.Pp
41The API URL for all actions other than login and logout is
42.Pa /api .
43.Ss login
44Send a POST request to
45.Pa /dologin
46with the following form values.
47.Bl -tag -width username
48.It Fa username
49User name.
50.It Fa password
51Pass phrase.
52.It Fa gettoken
53Must be
54.Dq 1 .
55.El
56.Pp
57This will return a token to be used for future requests.
58The token is valid for one year.
59.Ss logout
60Send a request to
61.Pa /logout
62with the
63.Fa token
64to be expired.
65.Ss honk
66The
67.Fa action
68value should be
69.Dq honk .
70Content type must be multipart/form-data.
71The following values are recognized:
72.Bl -tag -width placename
73.It Fa noise
74The contents of the honk.
75.It Fa format
76The format of noise.
77Defaults to markdown.
78May also be html.
79.It Fa donk
80A file to attach.
81.It Fa donkdesc
82A description for the attached file.
83.It Fa donkxid
84The XID of a previously uploaded attachment.
85.It Fa placename
86The name of an associated location.
87.It Fa placeurl
88The url of an associated location.
89.It Fa placelat
90The latitude of an associated location.
91.It Fa placelong
92The longitude of an associated location.
93.It Fa timestart
94The start time of an event.
95.It Fa rid
96The ActivityPub ID that this honk is in reply to.
97.El
98.Pp
99Upon success, the honk action will return the URL for the created honk.
100.Ss donk
101Upload just an attachment using
102.Fa donk
103and
104.Fa donkdesc .
105Content type must be multipart/form-data.
106Will return the XID.
107.Ss gethonks
108The
109.Dq gethonks
110.Fa action
111can be used to query for honks.
112The following parameters are used.
113.Bl -tag -width placename
114.It Fa page
115Should be one of
116.Dq home
117or
118.Dq atme .
119.It Fa after
120Only return honks after the specified ID.
121.It Fa wait
122If there are no results, wait this many seconds for something to appear.
123.El
124.Pp
125The result will be returned as json.
126.Ss sendactivity
127Send anything.
128No limits, no error checking.
129.Bl -tag -width public
130.It Fa rcpt
131An actor to deliver the message to to.
132May be specified more than once.
133An inbox may be specified directly by prefixing with %.
134.It Fa msg
135The message.
136It should be a valid json activity, but yolo.
137.It Fa public
138Set to 1 to use shared inboxes for delivery.
139.El
140.Sh EXAMPLES
141Refer to the sample code in the
142.Pa toys
143directory.
144.Sh SEE ALSO
145.Xr vim 3