Watch2Gether API Documentation

Hi! Temporary rooms are deleted after about 36 hours. At the moment the API is limited to the create method. But I’m collecting suggestions for the next development steps!

2 Likes

I think he meant as “limit” a ratelimit example: maximum 5 request per hour or so?

I’m having the same issue. Have you found a solution?

I’m having the same issue. I recieve the JSON response, extract the stream key for it, and add it to the end of “https://w2g.tv/rooms/” and when I click the link, it opens to a room with no videos loaded.

Here is the code my discord bot is using to retrieve and process the JSON ( is replaced with my actual key)

fetch("https://w2g.tv/rooms/create.json", {method: 'POST', 
    body: { 
	   "w2g_api_key" : "<api key>",
	   "share" : link,
	   "bg_color" : "#00ff00",
	   "bg_opacity" : "50"
}})
.then(response => response.json())
.then(function(data) {
	key = data.streamkey;
	console.log(data);
	console.log("W2G: Here is your room! \n https://w2g.tv/rooms/" + key);
	message.channel.send("Here is your room! \n https://w2g.tv/rooms/" + key + "?lang=en");
	});

I receive this JSON, but the link my program (above) spits out doesn’t work. Doing so manually doesn’t work either. The room exists but the video isn’t preloaded.
{ id: *********,
streamkey: 'hnby2ctr0w7doup9iq',
created_at: '2021-03-01T22:23:26.962Z',
persistent: false,
persistent_name: null,
deleted: false,
moderated: false,
location: 'NA',
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: 179536885,
members_only: false,
moderated_suggestions: false,
moderated_chat: false,
moderated_user: false,
moderated_cam: false }
`

Thanks a lot for your input! I will investigate this tommorow and get back to you ASAP!

Okay, i just had a look. You have to set the content type of your POST data correctly. The following example should work. Hope this helps!

fetch("https://w2g.tv/rooms/create.json", {
    method: 'POST',
    headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        "w2g_api_key": "<api_key>",
        "share": "https://www.youtube.com/watch?v=8Wdp35Z-fRs",
        "bg_color": "#00ff00",
        "bg_opacity": "50"
    })
})
.then(response => response.json())
.then(function (data) {
    console.log("W2G: Here is your room! \n https://w2g.tv/rooms/" + data.streamkey);
});

I think it was mentioned previously in this thread. Regarding the ability to create rooms via the API with an array of videos added upon creation. Is this something you see coming in the near future? :slight_smile:

Florian just replied to me with a solution to this problem. Here it is. I have yet to test it, but I will when I get home and I hope it’ll work for you. Figured I’d send a notification your way.

Yo, any updates on API? I’m working on some Telegram bot but the functionality is so limited…

Thanks for your input. What would be your “most wanted” feature?

Hey Florian, first of all, thanks for all the work with the site, i just love it.
But about the API, how about the ability to add videos to rooms that already exists?

Me and my friends use it almost everyday so the room never closes, if we could use a bot or webhook on discord to give us update on the channels that we usually see, then use a bot to send the url to that specific room would be awesome.

Is it possible? Thanks.

Thanks a lot for your feedback! There is already an internal API used by the browser extension. I’m planing to make this officially available but i need to refactor some parts and and stabilize it before i can move forward with that.

1 Like

I see. I’m looking forward to it.

I am pretty sorry for starting a contention with you @user_95f53b7185f71fb and not replying at all, but I had a lot of work to do. So the crucial part is rooms list associated with the account (obv existing ones), possibility to add a new movie to existing rooms, and prolly some kind of moderating tools like delete method (or time-to-destroy if unused or something) - maybe some kind of password, so as unwanted people won’t join our film show would be a good idea :slight_smile:

Thanks!

Hey @user_95f53b7185f71fb is it possible to create a room with multiple videos in the playlist? I want to create a room with the correct video for a traning session :slight_smile:

Thanks for your input. This is currently not possible. But we are working on room templates which will be introduced within the next 2 months.

Is there a a way to help you with it? :slight_smile: Would like help to enhance the api.

I also found something out: Should it be possible to create a room with an empty api key in the body or is this a bug?

Thanks for your feedback. The API was usable without API key before and for legacy reasons that’s still possible. But it will change soon. What other improvements would you like to see?

Ah okay :slight_smile:

Like I said: I would like to add a playlist to a new room and maybe also with my api key and the room id add videos via a put method? :slight_smile:

1 Like

Just another idea: Instead of just creating a room with one video in the json, you can add an array of video links