# Get Room UUID via C#

**URL:** <https://discuss.dev.twitch.com/t/get-room-uuid-via-c/20196>\
**Category:** Chat and IRC\
**Created:** [February 24, 2019, 3:35pm UTC](https://discuss.dev.twitch.com/t/get-room-uuid-via-c/20196 "2019-02-24T15:35:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thatch\_Castle](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@Thatch\_Castle](https://discuss.dev.twitch.com/u/Thatch_Castle)\
**Post date:** [February 24, 2019, 3:35pm UTC](https://discuss.dev.twitch.com/t/get-room-uuid-via-c/20196/1 "2019-02-24T15:35:15Z")

</div>

I am primarily a C# developer, I see in the documentation that if I want to have a chat bot join a custom room on my channel it needs to be through the room UUID.

It also says that to get this room uuid I can use the Get Chat Rooms by Channel endpoint. The sample code looks to be in some sort of Java that returns the info as JSON data.

My question is how could I achieve this same request with C#?

---

<div class="post-metadata">

**Author:** ![Dist](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/dist/32/7192_2.png) [@Dist](https://discuss.dev.twitch.com/u/Dist)\
**Post date:** [February 24, 2019, 3:48pm UTC](https://discuss.dev.twitch.com/t/get-room-uuid-via-c/20196/2 "2019-02-24T15:48:29Z")

</div>

The API is just HTTP requests. So just google for a HTTP library/module for your language, C# in this case, and send a request with the URL/headers specified in the docs. The result is JSON, so you’ll have to parse that into whatever data structure is appropriate.

---

<div class="post-metadata">

**Author:** ![Thatch\_Castle](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@Thatch\_Castle](https://discuss.dev.twitch.com/u/Thatch_Castle)\
**Post date:** [March 23, 2019, 8:59pm UTC](https://discuss.dev.twitch.com/t/get-room-uuid-via-c/20196/3 "2019-03-23T20:59:43Z")

</div>

Thank you @Dist, I was able to find examples of this in C#.

For instance, for me to send a request to the Root URL like is shown under the Requests section at [https://dev.twitch.tv/docs/v5](https://dev.twitch.tv/docs/v5)

The block of code that worked for me was as follows:

private const string TWITCH\_ENDPOINT = “[https://api.twitch.tv/kraken/](https://api.twitch.tv/kraken/)”;  
public void SendRequest() {  
WWWForm form = new WWWForm();  
Dictionary\<string, string\> headers = form.headers;  
headers[“Accept”] = “application/vnd.twitchtv.v5+json”;  
headers[“Authorization”] = “OAuth [My OAuth token without the brackets]”;

```
    WWW request = new WWW(TWITCH_ENDPOINT, null, headers);
    StartCoroutine(OnResponse(request));

```

}

private IEnumerator OnResponse(WWW req) {  
yield return req;  
print(req.text);  
}

That works fine, and the response I got back is in the same format as the documentation shows. However, when I modified this to get the room UUID, adding in the Client-ID header, and changing the endpoint string to ‘[https://api.twitch.tv/kraken/chat/thatchcastle/rooms](https://api.twitch.tv/kraken/chat/thatchcastle/rooms)’ the response is {"\_total":0,“rooms”:[]}.

I made an extra room while testing this, so I expected to see either one or two rooms in the response, any thoughts on why it’s coming back zero?

---

<div class="post-metadata">

**Author:** ![Dist](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/dist/32/7192_2.png) [@Dist](https://discuss.dev.twitch.com/u/Dist)\
**Post date:** [March 23, 2019, 9:21pm UTC](https://discuss.dev.twitch.com/t/get-room-uuid-via-c/20196/4 "2019-03-23T21:21:04Z")

</div>

The reason it’s showing 0 rooms is because you’re using the Channel Name in the URL when v5 uses channel ID. So your request is working but it’s requesting for a channel that doesn’t exist.

If you use your ID instead the URL will be `https://api.twitch.tv/kraken/chat/176636611/rooms` which correctly shows the room.

---

<div class="post-metadata">

**Author:** ![Thatch\_Castle](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@Thatch\_Castle](https://discuss.dev.twitch.com/u/Thatch_Castle)\
**Post date:** [March 23, 2019, 9:29pm UTC](https://discuss.dev.twitch.com/t/get-room-uuid-via-c/20196/5 "2019-03-23T21:29:22Z")

</div>

Why yes it does! Thank you again for all your help!

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [April 22, 2019, 9:29pm UTC](https://discuss.dev.twitch.com/t/get-room-uuid-via-c/20196/6 "2019-04-22T21:29:24Z")

</div>

Closed on April 22, 2019, 9:29pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
