Develop
Develop
Select your platform

Server APIs for Moderated Rooms (Deprecated)

Rooms API Deprecated
As of April 2023 the Rooms API is deprecated and is no longer included in the list of available Platform APIs for integration. For more information click here.
Third-party solutions, such as Photon, can be used as an alternative to implement Rooms in your app. For an example of how Photon, and other third-party solutions integrate with the Platform API, check here.
Moderated rooms are created through S2S REST calls. A client app should not create or maintain moderated rooms. Only your trusted servers can create or make changes to moderated rooms.
Note: The server APIs in this topic are for creating system-moderated rooms. For user-created rooms, see User-Owned Private Rooms in the Rooms topic.

Message Basics

Server-to-Server API requirements

Calls to these APIs must meet the following requirements:

Endpoint

Make all server-to-server requests to this endpoint:
https://graph.oculus.com

Access token

Include an access token with every request to authenticate it either as a valid server request or on behalf of a specific user. The access token can be one of the following:

App credentials

App credentials authenticate your server’s back-end as a trusted resource. Never share these credentials with any client-side application.
The access token with app credentials includes the App ID and App Secret from the API page on the Meta Horizon Developer Dashboard. It follows this format: OC|$APPID|$APPSECRET.
If your credentials are compromised or you need new API credentials, generate a new app secret. Changing the app secret will revoke the permissions of the previous one. Accessing the app secret requires an administrator account.

User access token

A user access token authenticates requests on behalf of a user. Use this token type when actions relate to a specific user. An example case is updating a client-authoritative leaderboard with the results of a server-hosted multiplayer match. For each user, you would use the user access token to authenticate your server as you make requests to update their leaderboards.
Retrieve the user token with the ovr_User_GetAccessToken() method.
Alternatively, use the following blueprint function:
Blueprint function with User Access Tokens
The token will be returned as a response and can be passed from the client to your server.A user access token contains FRL or OC and a long alpha numeric string similar to the following: FRL12342GhFccWvUBxPMR4KXzM5s2ZCMp0mlWGq0ZBrOMXyjh4EmuAPvaXiMCAMV9okNm9DXdUA2EWNplrQ.
Additionally, you can retrieve your user token for testing purposes at the ‘User Token’ section of the API page of the Meta Horizon Developer Dashboard, which is at the left navigation bar.

App ID

Some server calls require an app ID, which you can find on the API page of the Meta Horizon Developer Dashboard.

Create a Moderated Room

Calling this endpoint will create a new moderated room.
URL: https://graph.oculus.com/room_moderated_create
METHOD: POST
Example cURL Request:
curl -d "access_token=OC|$APP_ID|$APP_SECRET"  -d "max_users=MY_MAX_USER_COUNT" https://graph.oculus.com/room_moderated_create
You’ll need to include the max_users parameter which identifies the max simultaneous users for the room. The maximum number of users supported per room is 1,024.
Example response:
{"id": 963119010431337}
In response the API will return the moderated_room_id as the id value. Call this id when adding users to the room.

Update a Moderated Room’s Metadata

Calling this endpoint sets up to 2,000 key/value pairs in the room datastore. Key and value data can only be accepted as string values, any other value type will return an error. The ROOM_ID is the value returned from the API when you created the room.
URL: https://graph.oculus.com/room_update_data_store
METHOD: POST
Example cURL Request:
curl -d "access_token=OC|$APP_ID|$APP_SECRET" -d "room_id=$ROOM_ID" -d "data_store=[{'key':'KEY','value':'VALUE'},{'key':'KEY2','value':'VALUE2'}]"
https://graph.oculus.com/room_update_data_store
Example response:
{"success": true}

Retrieve Information about a Moderated Room

Calling this endpoint will retrieve information about a specified moderated room. The ROOM_ID is the value returned from the API when you created the room. The parameters in the example below are all optional, information will only be returned for the parameters identified in the request.
URL: https://graph.oculus.com/$ROOM_ID
METHOD: GET
Example cURL Request:
curl -d "access_token=OC|$APP_ID|$APP_SECRET" -d "fields=max_users,owner{id,alias,presence,presence_status,profile_url,profile_url_small}, users{id,alias,presence,presence_status,profile_url,profile_url_small},
data_store,name,description,join_policy,type,joinability,version,is_membership_locked" -G https://graph.oculus.com/$ROOM_ID

Delete a Moderated Room

Calling this endpoint will delete a moderated room.
URL: https://graph.oculus.com/$ROOM_ID
METHOD: DELETE
Example cURL Request:
curl  -X DELETE -d "access_token=OC|$APP_ID|$APP_SECRET" https://graph.oculus.com/$MODERATED_ROOM_ID
Example response:
{"success": true}

Join Users to System-Moderated Rooms

Once system-moderated rooms are created, you use client APIs so that users can find, join and leave rooms. For a list of these APIs, see Get, Join and Leave Rooms in the Rooms topic.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon