Watch2Gether API Documentation

Hey guys, does anybody know how to use this in Eclipse? Im new and dont really understand how to use it :slight_smile:

Finn

It’s now possible to add items to a playlist. Please see updated docs above.

2 Likes

noice an api update :slight_smile:

Just search how to make a post request on java

Hey is it possible to have it add a url to a given specific playlist instead of the active playlist?
Like for example say I have 3 playlists Test1, Test2 and Test3 and I want to add a url to the Test2 playlist.

That’s some nice update Florian.

The only problem is that it makes impossible to know which video is.
It doesn’t give us a nickname or gets the name of the video like adding normaly does.

@user_95f53b7185f71fb Like others already said if you add videos to the playlist the name of the video is the given URL and not the video title.
Is there a way to change this? It should probably be a quick fix but would be a big QOL change for us users.

I added 50 music videos to the playlist and don’t know what any of these are until I click them which is quite annoying

You are right, this is annoying. There is actually the option to add a title string to each item. I updated the example above, please have a look!

1 Like

Thank you! That’s what I call good customer service!

1 Like

Hi!

Thank you for creating W2G and it’s API, it is truly great!

Currently I have built a CLI to quickly create rooms and even copy the URL into the clipboard of the user.
I am thinking of possibly extending this project a little bit soon, although I feel like I am missing an endpoint to get my current rooms so that I can list any rooms I already have and not endlessly creating new ones.

Is this possible right now? Is it exposed?
I might have missed it and I am sorry if I have!

Thanks a lot for your input. It exists internaly but it’s not yet stable enough to expose it externally. I’ll update the Docs once it’s available!

Hey,

Thank you so much for the w2g API! It works great! Do you have any plans on adding the option to create rooms with custom backgrounds?

Thanks!

Thanks for your feedback! You are talking about background images? The current API allows you to change the color already…

A feature I’d love to see would be to get the list of videos in the active playlist - or a particular playlist, if and when playlist addressing functionality becomes available. It’d be even better if it returns both the URL and title!

Edit: I looked around the community some more and figured having this together with what’s currently in the API would allow anyone to implement their own version of the much-requested playlist export feature. Not my original intention, but a nice bonus.

Здравствуйте,простите, я новичок в программировании но меня заинтересовала возможность работы с вашим АПИ,но к сожалению при попытке добавить видео в плейлист выдает ошибку “HTTP Error 500: Internal Server Error”

Вот кусок кода:

payload= {
   'w2g_api_key': watchTogether_api_key,
    "add_items":[{
        "url":"https://www.youtube.com/watch?v=m9EX0f6V11Y",
        "title":"Marvel Studios’ Ms. Marvel | Official Trailer | Disney+",
        "thumb":"https://i.ytimg.com/vi/m9EX0f6V11Y/mqdefault.jpg"
        }]
    }

data = urllib.parse.urlencode(payload).encode()
print(data)
req = urllib.request.Request(f"https://w2g.tv/rooms/{streamkey}/playlists/current/playlist_items/sync_update", data=data)
resp = urllib.request.urlopen(req)

Надеюсь кто-то сможет помочь и объяснить что здесь не так и как это исправить

Thanks for getting in touch! Make sure that you are sending a POST request with the correct content type headers as shown in the example at the top of the page. Does that help?

1 Like

When I add these headers get “Error 400: Bad Request”

headers = {
    'Accept': 'application/json',
    'Content-Type': 'application/json'
    }

Upd.
After reading several forums and literature on a similar topic, I still found a solution … maybe someone will need it, so I’ll leave it below…Python

import json
import urllib.request

headers = {'Accept': 'application/json','Content-Type': 'application/json'}
w2g_api_key = {'w2g_api_key': '{watchTogether_api_key}'}



url_playlists = 'https://w2g.tv/rooms/{streamkey}/playlists/{keyplaylists}/playlist_items/sync_update'
video_playlists = [{"url":"https://www.youtube.com/watch?v=m9EX0f6V11Y","title":"Marvel Studios’ Ms. Marvel | Official Trailer | Disney+","thumb":"https://i.ytimg.com/vi/m9EX0f6V11Y/mqdefault.jpg"},
                   {"url":"https://www.youtube.com/watch?v=m9EX0f6V11Y","title":"Marvel Studios’ Ms. Marvel | Official Trailer | Disney+","thumb":"https://i.ytimg.com/vi/m9EX0f6V11Y/mqdefault.jpg"},
                   {"url":"https://www.youtube.com/watch?v=m9EX0f6V11Y","title":"Marvel Studios’ Ms. Marvel | Official Trailer | Disney+","thumb":"https://i.ytimg.com/vi/m9EX0f6V11Y/mqdefault.jpg"},
                   {"url":"https://www.youtube.com/watch?v=m9EX0f6V11Y","title":"Marvel Studios’ Ms. Marvel | Official Trailer | Disney+","thumb":"https://i.ytimg.com/vi/m9EX0f6V11Y/mqdefault.jpg"},
                   {"url":"https://www.youtube.com/watch?v=m9EX0f6V11Y","title":"Marvel Studios’ Ms. Marvel | Official Trailer | Disney+","thumb":"https://i.ytimg.com/vi/m9EX0f6V11Y/mqdefault.jpg"}
                    ]
playlists_load = w2g_api_key|{'add_items':video_playlists}



url_run_video = 'https://w2g.tv/rooms/{streamkey}/sync_update'
video_url = "https://www.youtube.com/watch?v=7biUABNj92E"       
payload = w2g_api_key|{"item_url":video_url}


data = json.dumps(payload).encode('utf-8')
req = urllib.request.Request(url_run_video,data,headers)
resp = urllib.request.urlopen(req)
print(resp.status)
1 Like

is adding to playlist bugged atm?
tried everything but it wont work, can create room and start a video without any problems, but adding to playlist will not work in any way

Thanks for your input. Are the other methods (create, share) working for you? Can you share some context and code?

create and share are working for me

using python
code i use for share

URL = "https://w2g.tv/rooms/" + streamkey + "/sync_update"
            PARAMS = {  'Accept': 'application/json',
                        'Content-Type': 'application/json',
                        "w2g_api_key": "<api_key>",
                        "item_url" : message.content
            }

            requests.post(url = URL, params = PARAMS)

code for add to playlist

URL = "https://w2g.tv/rooms/" + streamkey + "/playlists/current/playlist_items/sync_update"
        PARAMS = {      'Accept': 'application/json',
                        'Content-Type': 'application/json',
                        "w2g_api_key": "<api_key>",
                        "add_items": [{"url": "https://www.youtube.com/watch?v=dMH0bHeiRNg", "title": "Hello World"}]
        }

        requests.post(url = URL, params = PARAMS)