23 KiB
API v1 Documentation
Base endpoint is: /ocs/v2.php/apps/spreed/api/v1
Constants
Room types
1"one to one"2group3public
Read-only states
0read-write1read-only
Participant types
1owner2moderator3user4guest5user following a public link
Capabilities
3.0 (Initial Talk release)
audio- audio is supportedvideo- video + screensharing is supportedchat- simple text chat is supported, superseded bychat-v2
3.1
guest-signaling- Guests can do signaling via api endpointsempty-group-room- Group rooms can be created without inviting a Nextcloud user group by default
3.2
guest-display-names- Display names of guests are stored in the database, can be set via API (not WebRTC only) and are used on returned comments/participants/etc.multi-room-users- Users can be in multiple rooms at the same time now, therefor signaling now also requires the room/call token on the URL.chat-v2- Chat messages are now Rich Object Strings and pagination is available, the previouschatis not available anymore.
4.0
favorites- Rooms can be marked as favorites which will pin them to the top of the room list.last-room-activity- Rooms have thelastActivityattribute and should be sorted by that instead of the last ping of the user.no-ping- The ping endpoint has been removed. Ping is updated with a call to fetch the signaling or chat messages instead.system-messages- Chat messages have asystemMessageattribute and can be generated by the systemmention-flag- The room list populates the booleanunreadMentionwhen the user was mentioned since their last visitin-call-flags- A new flagparticipantFlagshas been introduced and is replacing theparticipantInCallboolean.
5.0
invite-by-mail- Replaced byinvite-groups-and-mailsGuests can be invited with their email addressnotification-levels- Users can select when they want to be notified in conversationsinvite-groups-and-mails- Groups can be added to existing conversations via the add participant endpoint
6.0
locked-one-to-one-rooms- One-to-one conversations are now locked to the users. Neither guests nor other participants can be added, so the options to do that should be hidden as well. Also a user can only leave a one-to-one room (not delete). It will be deleted when the other participant left too. If the other participant posts a new chat message or starts a call, the left-participant will be re-added.read-only-rooms- Rooms can be inread-onlymode which means people can not do calls or write chat messages.
Room management
Creating a new room
-
Method:
POST -
Endpoint:
/room -
Data:
field type Description roomTypeint invitestring user id ( roomType = 1), group id (roomType = 2- optional)roomNamestring room name (Not available for roomType = 1) -
Response:
-
Header:
200 OKwhen the "one to one" room already exists201 Createdwhen the room was created400 Bad Requestwhen an invalid room type was given401 Unauthorizedwhen the user is not logged in404 Not Foundwhen the user or group does not exist
-
Data:
field type Description tokenstring Token identifier of the room which is used for further interaction namestring Name of the room (can also be empty) displayNamestring nameif non empty, otherwise it falls back to a list of participants
-
Get user´s rooms
-
Method:
GET -
Endpoint:
/room -
Response:
-
Header:
200 OK401 Unauthorizedwhen the user is not logged in
-
Data: Array of rooms, each room has at least:
field type Description tokenstring Token identifier of the room which is used for further interaction typeint namestring Name of the room (can also be empty) displayNamestring nameif non empty, otherwise it falls back to a list of participantsparticipantTypeint Permissions level of the current user participantInCallbool Flag if the current user is in the call (deprecated, use participantFlagsinstead)participantFlagsint Flags of the current user (only available with in-call-flagscapability)readOnlyint Read-only state for the current user (only available with read-only-roomscapability)countint Number of active users numGuestsint Number of active guests lastPingint Timestamp of the last ping of the current user (should be used for sorting) sessionIdstring '0'if not connected, otherwise a 512 character long stringhasPasswordbool Flag if the room has a password hasCallbool Flag if the room has an active call lastActivityint Timestamp of the last activity in the room, in seconds and UTC time zone isFavoritebool Flag if the room is favorited by the user notificationLevelint The notification level for the user (one of Participant::NOTIFY_*(1-3))unreadMessagesint Number of unread chat messages in the room (only available with chat-v2capability)unreadMentionbool Flag if the user was mentioned since their last visit lastMessagemessage Last message in a room if available, otherwise empty objectTypestring The type of object that the room is associated with; "share:password" if the room is used to request a password for a share, otherwise empty objectIdstring Share token if "objectType" is "share:password", otherwise empty
-
Get single room (also for guests)
-
Method:
GET -
Endpoint:
/room/{token} -
Response:
-
Header:
200 OK404 Not FoundWhen the room could not be found for the participant
-
Data: See array definition in
Get user´s rooms
-
Rename a room
-
Method:
PUT -
Endpoint:
/room/{token} -
Data:
field type Description roomNamestring New name for the room (1-200 characters) -
Response:
- Header:
200 OK400 Bad RequestWhen the name is too long or empty403 ForbiddenWhen the current user is not a moderator/owner404 Not FoundWhen the room could not be found for the participant405 Method Not AllowedWhen the room is a one to one room
- Header:
Set password for a room
-
Method:
PUT -
Endpoint:
/room/{token}/password -
Data:
field type Description passwordstring New password for the room -
Response:
- Header:
200 OK403 ForbiddenWhen the current user is not a moderator/owner or the room is not a public room404 Not FoundWhen the room could not be found for the participant
- Header:
Delete a room
-
Method:
DELETE -
Endpoint:
/room/{token} -
Response:
- Header:
200 OK403 ForbiddenWhen the current user is not a moderator/owner404 Not FoundWhen the room could not be found for the participant
- Header:
Allow guests in a room (public room)
-
Method:
POST -
Endpoint:
/room/{token}/public -
Response:
- Header:
200 OK403 ForbiddenWhen the current user is not a moderator/owner404 Not FoundWhen the room could not be found for the participant
- Header:
Disallow guests in a room (group room)
-
Method:
DELETE -
Endpoint:
/room/{token}/public -
Response:
- Header:
200 OK403 ForbiddenWhen the current user is not a moderator/owner404 Not FoundWhen the room could not be found for the participant
- Header:
Set room password
-
Method:
PUT -
Endpoint:
/room/{token}/password -
Data:
field type Description passwordstring Set a new password for the room -
Response:
- Header:
200 OK403 ForbiddenWhen the current user is not a moderator/owner403 ForbiddenWhen the room is not a public room404 Not FoundWhen the room could not be found for the participant
- Header:
Add room to favorites
-
Method:
POST -
Endpoint:
/room/{token}/favorite -
Response:
- Header:
200 OK404 Not FoundWhen the room could not be found for the participant or the participant is a guest
- Header:
Remove room from favorites
-
Method:
DELETE -
Endpoint:
/room/{token}/favorite -
Response:
- Header:
200 OK404 Not FoundWhen the room could not be found for the participant or the participant is a guest
- Header:
Set notification level
-
Method:
POST -
Endpoint:
/room/{token}/notify -
Data:
field type Description levelint The notification level (one of Participant::NOTIFY_*(1-3)) -
Response:
- Header:
200 OK400 Bad RequestWhen the the given level is invalid404 Not FoundWhen the room could not be found for the participant or the participant is a guest
- Header:
Participant management
Get list of participants in a room
-
Method:
GET -
Endpoint:
/room/{token}/participants -
Response:
-
Header:
200 OK404 Not FoundWhen the room could not be found for the participant
-
Data: Array of participants, each participant has at least:
field type Description userIdstring Is empty for guests displayNamestring Can be empty for guests participantTypeint Permissions level of the participant lastPingint Timestamp of the last ping of the user (should be used for sorting) sessionIdstring '0'if not connected, otherwise a 512 character long string
-
Add a participant to a room
-
Method:
POST -
Endpoint:
/room/{token}/participants -
Data:
field type Description newParticipantstring User, group or email to add sourcestring Source of the participant(s) as returned by the autocomplete suggestion endpoint (default is users) -
Response:
-
Header:
200 OK403 ForbiddenWhen the current user is not a moderator/owner400 Bad RequestWhen the source type is unknown404 Not FoundWhen the room could not be found for the participant404 Not FoundWhen the user or group to add could not be found
-
Data:
field type Description typeint In case the room type changed, the new value is returned
-
Delete a participant from a room
-
Method:
DELETE -
Endpoint:
/room/{token}/participants -
Data:
field type Description participantstring User to remove -
Response:
- Header:
200 OK400 Bad RequestWhen the participant is a moderator/owner and there are no other moderators/owners left.403 ForbiddenWhen the current user is not a moderator/owner403 ForbiddenWhen the participant to remove is an owner404 Not FoundWhen the room could not be found for the participant404 Not FoundWhen the participant to remove could not be found
- Header:
Remove a guest from a room
-
Method:
DELETE -
Endpoint:
/room/{token}/participants/guests -
Data:
field type Description participantstring Session ID of the guest to remove -
Response:
- Header:
200 OK403 ForbiddenWhen the current user is not a moderator/owner403 ForbiddenWhen the target participant is not a guest404 Not FoundWhen the room could not be found for the participant404 Not FoundWhen the target participant could not be found
- Header:
Remove yourself from a room
-
Method:
DELETE -
Endpoint:
/room/{token}/participants/self -
Response:
- Header:
200 OK400 Bad RequestWhen the participant is a moderator/owner and there are no other moderators/owners left.404 Not FoundWhen the room could not be found for the participant
- Header:
Join a room (available for call and chat)
-
Method:
POST -
Endpoint:
/room/{token}/participants/active -
Data:
field type Description passwordstring Optional: Password is only required for users which are of type 4or5and only when the room hashasPasswordset to true. -
Response:
-
Header:
200 OK403 ForbiddenWhen the password is required and didn't match404 Not FoundWhen the room could not be found for the participant
-
Data:
field type Description sessionIdstring 512 character long string
-
Leave a room (not available for call and chat anymore)
-
Method:
DELETE -
Endpoint:
/room/{token}/participants/active -
Response:
- Header:
200 OK404 Not FoundWhen the room could not be found for the participant
- Header:
Promote a user to a moderator
-
Method:
POST -
Endpoint:
/room/{token}/moderators -
Data:
field type Description participantstring User to promote -
Response:
- Header:
200 OK400 Bad RequestWhen the participant to promote is not a normal user (type3)403 ForbiddenWhen the current user is not a moderator/owner403 ForbiddenWhen the participant to remove is an owner404 Not FoundWhen the room could not be found for the participant404 Not FoundWhen the participant to remove could not be found
- Header:
Demote a moderator to a user
-
Method:
DELETE -
Endpoint:
/room/{token}/moderators -
Data:
field type Description participantstring User to promote -
Response:
- Header:
200 OK400 Bad RequestWhen the participant to demote is not a moderator (type2)403 ForbiddenWhen the current user is not a moderator/owner404 Not FoundWhen the room could not be found for the participant404 Not FoundWhen the participant to demote could not be found
- Header:
Call management
Get list of connected participants
-
Method:
GET -
Endpoint:
/call/{token} -
Response:
-
Header:
200 OK404 Not FoundWhen the room could not be found for the participant
-
Data: Array of participants, each participant has at least:
field type Description userIdstring Is empty for guests lastPingint Timestamp of the last ping of the user (should be used for sorting) sessionIdstring 512 character long string
-
Join a call
-
Method:
POST -
Endpoint:
/call/{token} -
Response:
- Header:
200 OK404 Not FoundWhen the room could not be found for the participant
- Header:
Leave a call (but staying in the room for future calls and chat)
-
Method:
DELETE -
Endpoint:
/call/{token} -
Response:
- Header:
200 OK404 Not FoundWhen the room could not be found for the participant
- Header:
Chat
Receive chat messages of a room
-
Method:
GET -
Endpoint:
/chat/{token} -
Data:
field type Description lookIntoFutureint 1Poll and wait for new message or0get history of a roomlimitint Number of chat messages to receive (100 by default, 200 at most) timeoutint $lookIntoFuture = 1only, Number of seconds to wait for new messages (30 by default, 60 at most)lastKnownMessageIdint Serves as an offset for the query. The lastKnownMessageId for the next page is available in the X-Chat-Last-Givenheader. -
Response:
-
Status code:
200 OK304 Not ModifiedWhen there were no older/newer messages404 Not FoundWhen the room could not be found for the participant
-
Header:
field type Description X-Chat-Last-Givenint Offset (lastKnownMessageId) for the next page. -
Data: Array of messages, each message has at least:
field type Description idint ID of the comment tokenstring Room token actorTypestring guestsorusersactorIdstring User id of the message author actorDisplayNamestring Display name of the message author timestampint Timestamp in seconds and UTC time zone systemMessagestring empty for normal chat message or the type of the system message (untranslated) messagestring Message string with placeholders (see Rich Object String) messageParametersarray Message parameters for message(see Rich Object String)
-
Sending a new chat message
-
Method:
POST -
Endpoint:
/chat/{token} -
Data:
field type Description messagestring The message the user wants to say actorDisplayNamestring Guest display name (ignored for logged in users) -
Response:
-
Header:
201 Created400 Bad RequestIn case of any other error404 Not FoundWhen the room could not be found for the participant413 Payload Too LargeWhen the message was longer than the allowed limit of 1000 characters
-
Data: The full message array of the new message, as defined in Receive chat messages of a room
-
Get mention autocomplete suggestions
-
Method:
GET -
Endpoint:
/chat/{token}/mentions -
Data:
field type Description searchstring Search term for name suggestions (should at least be 1 character) limitint Number of suggestions to receive (20 by default) -
Response:
-
Status code:
200 OK404 Not FoundWhen the room could not be found for the participant
-
Data: Array of suggestions, each suggestion has at least:
field type Description idstring The user id which should be sent as @<id>in the messagelabelstring The displayname of the user sourcestring The type of the user, currently only users
-
System messages
conversation_created- {actor} created the conversationconversation_renamed- {actor} renamed the conversation from "foo" to "bar"call_started- {actor} started a callcall_joined- {actor} joined the callcall_left- {actor} left the callcall_ended- Call with {user1}, {user2}, {user3}, {user4} and {user5} (Duration 30:23)guests_allowed- {actor} allowed guests in the conversationguests_disallowed- {actor} disallowed guests in the conversationpassword_set- {actor} set a password for the conversationpassword_removed- {actor} removed the password for the conversationuser_added- {actor} added {user} to the conversationuser_removed- {actor} removed {user} from the conversationmoderator_promoted- {actor} promoted {user} to moderatormoderator_demoted- {actor} demoted {user} from moderatorguest_moderator_promoted- {actor} promoted {user} to moderatorguest_moderator_demoted- {actor} demoted {user} from moderator
Guests
Set display name
-
Method:
POST -
Endpoint:
/guest/{token}/name -
Data:
field type Description displayNamestring The new display name -
Response:
- Header:
200 OK404 Not FoundWhen the room is not found or the session does not exist in the room403 ForbiddenWhen the user is logged in
- Header:
Signaling
Get signaling settings
-
Method:
GET -
Endpoint:
/signaling/settings -
Data:
field type Description stunserversarray STUN servers turnserversarray TURN servers serverstring URL of the external signaling server ticketstring Ticket for the external signaling server -
STUN server
field type Description urlstring STUN server URL -
TURN server
field type Description urlarray One element array with TURN server URL urlsarray One element array with TURN server URL usernamestring User name for the TURN server credentialstring User password for the TURN server
-
-
Response:
- Header:
200 OK404 Not Found
- Header:
External signaling API
See External Signaling API Draft in the wiki…