# Creating Meeting with httpclient getting Message 400 Bad Request

**URL:** <https://devforum.zoom.us/t/creating-meeting-with-httpclient-getting-message-400-bad-request/86958>\
**Category:** Meeting SDK\
**Created:** [April 19, 2023, 3:41am UTC](https://devforum.zoom.us/t/creating-meeting-with-httpclient-getting-message-400-bad-request/86958 "2023-04-19T03:41:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomas.coon](https://avatars.discourse-cdn.com/v4/letter/t/c6cbf5/32.png) [@thomas.coon](https://devforum.zoom.us/u/thomas.coon)\
**Post date:** [April 19, 2023, 3:41am UTC](https://devforum.zoom.us/t/creating-meeting-with-httpclient-getting-message-400-bad-request/86958/1 "2023-04-19T03:41:48Z")

</div>

I’m working with the example from Zoom Developer Postman examples for creating meetings. I can get a bearer token using OAuth and use is in the Auth section in Postman. Below is the C# httpclient code created by postman. I know the Bad Request typically means bad JSON, but the below is just taking the example code and adjusting. I have also tried the url using email address also.

var client = new HttpClient();  
var request = new HttpRequestMessage(HttpMethod.Post, “[https://api.zoom.us/v2/users/me/meetings](https://api.zoom.us/v2/users/me/meetings)”);  
request.Headers.Add(“Authorization”, “Bearer eyJzdiI6IjAwMDAwMSIsImFsZyI6IkhTNTEyIiwidiI6IjIuMCIsImtpZCI6ImQwZGQ4YjFlLTE1NTEtND1Ny1iYTM2LTYwOGE2YWZhZGQ5YSJ9.eyJhdWQiOiJodHRwczovL29hdXRoLnpvb20udXMiLCJ1aWQiOiJlaTF6QzFYWlR0S0RVRkV1TVpYaTVBIiwidmVyIjo5LCJhdWlkIjoiMDQxMTEyNThjNzcwMWM3ZGRjZGE2ZmMxZGU1NzFiYjIiLCJuYmYiOjE2ODE4NzEzNDksImNvZGUiOiJ6MG92ajN1R1NSQzlSaFphNmRxSFF3Rm1UNERkV2Q5WFMiLCJpc3MiOiJ6bTpjaWQ6aUVpUFlDVGJUZzZxSlVmWlR0X0JTdyIsImdubyI6MCwiZXhwIjoxNjgxODc0OTQ5LCJ0eXBlIjozLCJpYXQiOjE2ODE4NzEzNDksImFpZCI6IlBVVDhzOHB0VGJpR2FiVVRTQ0tMbHcifQ.b0M6ZH7EIGYxglmcS1B7wBaMMtJNr\_YhNNq\_rg2Y-gzNDp-ZiRIolYkPkJNKPiaw8Fw\_y37NupjHUZ3rQg0E-A”);  
var content = new StringContent(“{\n "agenda": "My Meeting",\n "duration": 60,\n "start\_time": "2022-04-19T07:32:55Z",\n "topic": "My Meeting",\n "type": 2\n}”, null, “application/json”);  
request.Content = content;  
var response = await client.SendAsync(request);  
response.EnsureSuccessStatusCode();

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [April 19, 2023, 11:56am UTC](https://devforum.zoom.us/t/creating-meeting-with-httpclient-getting-message-400-bad-request/86958/2 "2023-04-19T11:56:10Z")

</div>

Some difference I’ve realised

- there are missing headers in your bearer token  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/8/f/8fe34991bdc3b9d4925240bd74feed05959d53e7.png)
- content type should be set to “application/json” in the request header

---

<div class="post-metadata">

**Author:** ![thomas.coon](https://avatars.discourse-cdn.com/v4/letter/t/c6cbf5/32.png) [@thomas.coon](https://devforum.zoom.us/u/thomas.coon)\
**Post date:** [April 19, 2023, 10:50pm UTC](https://devforum.zoom.us/t/creating-meeting-with-httpclient-getting-message-400-bad-request/86958/3 "2023-04-19T22:50:43Z")

</div>

> [@thomas.coon](#):
>

Thank you for the response. I believe the content type is being set in this line:

var content = new StringContent(“{\n “agenda”: “My Meeting”,\n “duration”: 60,\n “start\_time”: “2022-04-19T07:32:55Z”,\n “topic”: “My Meeting”,\n “type”: 2\n}”, null, “application/json”);

If I switch the language in Postman to something other than C# httpclient it does show the request.AddHeader(“Content-Type”, “application/json”).

I’m not exactly sure what your image is showing me here. This is my first attempt and Zoom, so be gentle LOL.

---

<div class="post-metadata">

**Author:** ![thomas.coon](https://avatars.discourse-cdn.com/v4/letter/t/c6cbf5/32.png) [@thomas.coon](https://devforum.zoom.us/u/thomas.coon)\
**Post date:** [April 20, 2023, 5:39pm UTC](https://devforum.zoom.us/t/creating-meeting-with-httpclient-getting-message-400-bad-request/86958/4 "2023-04-20T17:39:08Z")

</div>

I changed accounts and used this Zoom video ([How to create and use a Server to Server OAuth app - YouTube](https://www.youtube.com/watch?v=OkBE7CHVzho)) to recreate Server to Server OAuth. It works fine and I get the bearer token. I used the bearer token to get Userid info and that worked. I then setup the Create Meeting as shown in the video, validated the body JSON, and still am getting 400 Bad Request response:

Here is the Postman code for RestSharp:

var options = new RestClientOptions(“[https://api.zoom.us](https://api.zoom.us)”)  
{  
MaxTimeout = -1,  
};  
var client = new RestClient(options);  
var request = new RestRequest(“/v2/users/me/meetings”, Method.Post);  
request.AddHeader(“Accept”, “application/json”);  
request.AddHeader(“Content-Type”, “application/json”);  
request.AddHeader(“Authorization”, “Bearer eyJzdiI6IjAwMDAwMSIsImFsZyI6IkhTNTEyIiwidiI6IjIuMCIsImtpZCI6Ijk2YTRhYmZjLTdhNjgtNDhlZi05M2U2LTI3MDcwMmUyMTAzMSJ9.eyJhdWQiOiJodHRwczovL29hdXRoLnpvb20udXMiLCJ1aWQiOiI2cF9neUNEU1I4Q2xnY0hBNHZqUE13IiwidmVyIjo5LCJhdWlkIjoiYjkyOTUzZGViYTc2YmVmMjY1MmJjOTRmN2YxODZlNDYiLCJuYmYiOjE2ODIwMTEyOTIsImNvZGUiOiJvQlhKZTYxOFNJeTY2VkFVcjZUNHVBejVudkJaU0tPVjYiLCJpc3MiOiJ6bTpjaWQ6bjluV1pYblZSU2VfcFV5MnZpT3pJdyIsImdubyI6MCwiZXhwIjoxNjgyMDE0ODkyLCJ0eXBlIjozLCJpYXQiOjE2ODIwMTEyOTIsImFpZCI6Inp1Ukw0NDBxU2NPcmU3Z0RjX2xvR1EifQ.fcstsmVupRDcUY5OThiAu0mzFaDutFPF31CzyAXXNLsDs69njvJJjclCcTxMIIHbaplyw4bEfIRScM6dTf4jng”);  
var body = @“{  
" + “\n” +  
@” ““topic””: ““Testing 01"”,  
" + “\n” +  
@” ““type””: 2,  
" + “\n” +  
@" ““start\_time””: ““2023-04-20T05:02:00Z””,  
" + “\n” +  
@" ““duration””: ““60"”,  
" + “\n” +  
@” ““timezone””: ““American/Mexico\_City””,  
" + “\n” +  
@" ““password””: ““123"”,  
" + “\n” +  
@” ““agenda””: ““Testing Testing””,  
" + “\n” +  
@" ““settings””: {  
" + “\n” +  
@" ““host\_video””: ““true””,  
" + “\n” +  
@" ““participant\_video””: ““true””,  
" + “\n” +  
@" ““join\_before\_host””: ““true””  
" + “\n” +  
@" }  
" + “\n” +  
@“}”;  
request.AddStringBody(body, DataFormat.Json);  
RestResponse response = await client.ExecuteAsync(request);  
Console.WriteLine(response.Content);
