Watch2Gether API Documentation

it is a normal JSON, i Know how it works, In fact I get response from server, like this:

{
    "id": *******,
    "streamkey": "bb0nd8zxautpii2qxd",
    "created_at": "2020-11-09T10:53:42.080Z",
    "persistent": false,
    "persistent_name": null,
    "deleted": false,
    "moderated": false,
    "location": "EU",
    "stream_created": false,
    "background": null,
    "moderated_background": false,
    "moderated_playlist": false,
    "bg_color": "FFFFFF",
    "bg_opacity": 100,
    "moderated_item": false,
    "theme_bg": null,
    "playlist_id": 156089702,
    "members_only": false,
    "moderated_suggestions": false
}

the problem is when I insert de StreamKey in the URL

How do you check that it’s not working? Please keep in mind that the video is only loaded on the first load of the room.

I put the streamkey in https://w2g.tv/rooms/${streamkey}

And nothing. I tested with a lot of videos, and nothing. can u check pls

You mean with nothing that your selected video is not starting?

This looks great and I love that I can use this in my discord bot. I also love the added ability to set the background colour and opacity. Some in my community have asked me if I could include an option to set the volume level from the start though, as they think it is somewhat loud. Is it possible to get this implemented into the API or is there already a workaround? Regardless, I love the ability to interact with w2g through this API, so thanks for that.

Thanks for your feedback. Im glad you like the API! At the moment it’s not possible to set the volume. Please keep in mind that the volume setting is an individual setting and not synced across the room.

Ohh, ok that’s good to know. Thank you for replying so swiftly, it is really appreciated.

Hi,

I am trying to implent this API in my code as I was previously using a custom request rather than the API.
I am using your exact request in Postman and cURL, and I am getting a 400 Bad Request response.

Is the API down or am I missing something? My request body is below.

{ 
"w2g_api_key" : "myApiKey",
"share" : "https://www.youtube.com/watch?v=tpiyEe_CqB4",
"bg_color" : "#00ff00",
"bg_opacity" : "50"
}

I am sending no headers (should I be?), any combination of ‘common’ headers I use seems to give me a 500 Server Error instead of a 400 Bad Request.

Thank you.

Make sure you are posting to https://w2g.tv/rooms/create.json and set the header “content-type:
application/json; charset=utf-8”

I assume you have a valid API key instead of “myApiKey”?

Thanks for the fast reply. I do have a API key in place of myApiKey. My cURL request now looks like this and still is failing with a 400 Bad Request

curl --location --request POST 'https://w2g.tv/rooms/create.json' \
--header 'charset: utf-8' \
--header 'Content-Type: application/json' \
--data-raw '{
    "w2g_api_key": "myApiKey",
    "share": "https://www.youtube.com/watch?v=tpiyEe_CqB4",
    "bg_color": "#00ff00",
    "bg_opacity": "50"
}'

Seems to be working now! Not sure what was wrong :slight_smile:

I think I should add more videos from iframe

I’m not sure what you mean. Can you explain?

Could you add a feature, so I can put a video into an existing room?

Would be cool if we could request with an array of urls to create a room with a playlist.

1 Like

pls look at my feature request :wink: @user_7b975f67c4b2a3e
API feature request

2 Likes

I seem to be having some minor problem using the API, I get a valid streamkey when fetching the stringified JSON data but the “bg_color” object doesn’t work for me. I console logged the response and everything else seems to be working fine. “share” also doesn’t work althought the video is playable in rooms when queued manually. With postman and exactly the same input everything works right. Would greatly appreciate some help. :slight_smile:

Is it in html notation? like “#FF5733

the exact json is:
…,
“bg_color” : “#131313”,

Hey :slight_smile: Thanks for the api :slight_smile: I use it in my discord bot for creating rooms. I see all these rooms in my own profile. How long does the rooms exist before they are deleted and is there a limit on how many rooms I can create?

Also: Is there a way to get a room by id or delete a room by id? I would like to implement a job, that checks and deletes a room automatically if noone is in this room anymore.