Skip to content

Commit ca801d1

Browse files
committed
s2s/query: clarify profile behaviour and API responses
Signed-off-by: famfo <famfo@famfo.xyz>
1 parent be21886 commit ca801d1

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Clarify the s2s profile query behaviour and responses.

data/api/server-server/query.yaml

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -111,47 +111,51 @@ paths:
111111
summary: Query for profile information about a given user
112112
description: |-
113113
Performs a query to get profile information, such as a display name or avatar,
114-
for a given user. Homeservers should only query profiles for users that belong
114+
for a given user. Homeservers MUST only query profiles for users that belong
115115
to the target server (identified by the [server name](/appendices/#server-name)
116116
in the user ID).
117117
118-
Servers may wish to cache the response to this query to avoid requesting the
119-
information too often.
118+
Responding servers MAY
119+
- allow users to set arbitrary key/value pairs in their profile in addition to the
120+
specified pairs
121+
- deny profile look-up over federation by responding with 403 and an error code of
122+
`M_FORBIDDEN`
123+
- omit certain key/value pairs in the response
120124
121-
Servers MAY deny profile look-up over federation by responding with 403 and an
122-
error code of `M_FORBIDDEN`.
125+
Requesting servers MAY wish to cache the response to this query to avoid requesting the
126+
information too often.
123127
operationId: queryProfile
124128
security:
125129
- signedRequest: []
126130
parameters:
127131
- in: query
128132
name: user_id
129-
description: The user ID to query. Must be a user local to the receiving homeserver.
133+
description: The user ID to query. MUST be a user local to the receiving homeserver.
130134
required: true
131135
example: "@someone:example.org"
132136
schema:
133137
type: string
134138
- in: query
135139
name: field
136140
description: |-
137-
The field to query. If specified, the server will only return the given field
138-
in the response. If not specified, the server will return the full profile for
139-
the user.
141+
The field of the profile to query. If specified, the server MUST only return the
142+
given field in the response. If not specified, the server MUST return the full,
143+
public, profile for the user.
144+
145+
Defined values are `displayname`, `avatar_url` and `m.tz`. In addition to these
146+
servers MAY allow users to set additional key/value pairs.
140147
schema:
141148
type: string
142-
enum:
143-
- displayname
144-
- avatar_url
145149
responses:
146150
"200":
147151
description: |-
148152
The profile for the user. If a `field` is specified in the request, only the
149-
matching field should be included in the response. If no `field` was specified,
150-
the response should include the fields of the user's profile that can be made
153+
matching field MUST included in the response. If no `field` was specified,
154+
the response MUST include the fields of the user's profile that can be made
151155
public, such as the display name and avatar.
152156
153157
If the user does not have a particular field set on their profile, the server
154-
should exclude it from the response body or give it the value `null`.
158+
MUST either exclude it from the response body or give it the value `null`.
155159
content:
156160
application/json:
157161
schema:
@@ -160,20 +164,20 @@ paths:
160164
displayname:
161165
type: string
162166
description: |-
163-
The display name of the user. May be omitted if the user does not have a
164-
display name set.
167+
The display name of the user. MUST either be omitted or set to `null` if
168+
the user does not have a display name set.
165169
example: John Doe
166170
avatar_url:
167171
type: string
168172
description: |-
169-
The avatar URL for the user's avatar. May be omitted if the user does not
170-
have an avatar set.
171-
example: mxc://matrix.org/MyC00lAvatar
173+
The avatar URL for the user's avatar. MUST either be omitted or set to
174+
`null` if the user does not have an avatar set.
175+
example: mxc://example.org/MyC00lAvatar
172176
examples:
173177
response:
174178
value: {
175179
"displayname": "John Doe",
176-
"avatar_url": "mxc://matrix.org/MyC00lAvatar"
180+
"avatar_url": "mxc://example.org/MyC00lAvatar"
177181
}
178182
"403":
179183
x-addedInMatrixVersion: "1.12"
@@ -190,7 +194,7 @@ paths:
190194
"error": "Profile lookup over federation is disabled on this homeserver"
191195
}
192196
"404":
193-
description: The user does not exist or does not have a profile.
197+
description: The user does not exist, does not have a profile or the queried field does not exist.
194198
content:
195199
application/json:
196200
schema:

0 commit comments

Comments
 (0)