# Create meeting working fine in Postman but not in webapi C#

**URL:** <https://devforum.zoom.us/t/create-meeting-working-fine-in-postman-but-not-in-webapi-c/7505>\
**Category:** API and Webhooks\
**Created:** [January 14, 2020, 12:34pm UTC](https://devforum.zoom.us/t/create-meeting-working-fine-in-postman-but-not-in-webapi-c/7505 "2020-01-14T12:34:06Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![meetings1](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@meetings1](https://devforum.zoom.us/u/meetings1)\
**Post date:** [January 14, 2020, 12:34pm UTC](https://devforum.zoom.us/t/create-meeting-working-fine-in-postman-but-not-in-webapi-c/7505/1 "2020-01-14T12:34:06Z")

</div>

While running create api with token working fine in POSTMAN  
but when i was trying from web api it is getting 401 not found error.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [January 14, 2020, 5:30pm UTC](https://devforum.zoom.us/t/create-meeting-working-fine-in-postman-but-not-in-webapi-c/7505/2 "2020-01-14T17:30:31Z")

</div>

Hey @meetings1, thanks for posting and using Zoom!

Please share your C# code, as well as the endpoint url, and request body you are using.

Please also share how you are authenticating (JWT or OAuth)?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![meetings1](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@meetings1](https://devforum.zoom.us/u/meetings1)\
**Post date:** [January 17, 2020, 6:34am UTC](https://devforum.zoom.us/t/create-meeting-working-fine-in-postman-but-not-in-webapi-c/7505/3 "2020-01-17T06:34:15Z")

</div>

```auto
      //method for GenerateZoomToken
public string GenerateZoomToken(){
		// Token will be good for 20 minutes
        DateTime Expiry = DateTime.UtcNow.AddMinutes(20);

        string ApiKey = "xyz";//(your apiKey)
        string ApiSecret = "abc";//(your ApiSecret)

		int ts = (int)(Expiry - new DateTime(1970, 1, 1)).TotalSeconds;

		// Create Security key using private key above:
		var securityKey = new Microsoft.IdentityModel.Tokens.SymmetricSecurityKey(Encoding.UTF8.GetBytes(ApiSecret));

		// length should be >256b
		var credentials = new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256);

		//Finally create a Token
		var header = new JwtHeader(credentials);

		//Zoom Required Payload
		var payload = new JwtPayload
		{
			{ "iss", ApiKey},
			{ "exp", ts },
		};

		var secToken = new JwtSecurityToken(header, payload);
		var handler = new JwtSecurityTokenHandler();

		// Token to String so you can use it in your client
		var tokenString = handler.WriteToken(secToken);
		
        return tokenString;
        }

 [HttpPost]
         public ActionResult CreateMeeting(CreateZoomModel ZoomModel)
         {
             using (var client = new HttpClient())
             {
//Here calling GenerateZoomToken method
                 var token = GenerateZoomToken();
                            
                 client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token);                             
                 client.BaseAddress = new Uri("https://api.zoom.us/v2/users/{abc@gmail.com}/meetings")             
                 client.DefaultRequestHeaders.Accept.Add(
                     new MediaTypeWithQualityHeaderValue("application/json"));

                 var postTask = client.PostAsJsonAsync<object>("meetings", ZoomModel);
                 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                 postTask.Wait();

                 var result = postTask.Result;
                 if (result.IsSuccessStatusCode)
                 {
                    //todo
                 }
             }

             return null;
             
         }

```

---

<div class="post-metadata">

**Author:** ![meetings1](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@meetings1](https://devforum.zoom.us/u/meetings1)\
**Post date:** [January 17, 2020, 6:42am UTC](https://devforum.zoom.us/t/create-meeting-working-fine-in-postman-but-not-in-webapi-c/7505/4 "2020-01-17T06:42:02Z")

</div>

We are using JWT authenticating

---

<div class="post-metadata">

**Author:** ![meetings1](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@meetings1](https://devforum.zoom.us/u/meetings1)\
**Post date:** [January 17, 2020, 1:08pm UTC](https://devforum.zoom.us/t/create-meeting-working-fine-in-postman-but-not-in-webapi-c/7505/5 "2020-01-17T13:08:28Z")

</div>

Requested Body

```auto
{
            topic: "API Test",
            type: 2,
            start_time: "2020-08-30T12:00:00Z",
            duration: 60,
            timezone: "Asia/Calcutta",
            password: "abc",
            agenda: "Meeting description",
            recurrence : {
                type: 2,
                repeat_interval: 3,
                weekly_days: "2",
                monthly_day: 2,
                monthly_week: 2,
                monthly_week_day:2,
                end_times: 2,
                end_date_time: "2020-08-30T12:00:00Z"
            },
            settings: {
                host_video: false,
                participant_video: false,
                cn_meeting: false,
                in_meeting: false,
                join_before_host: false,
                mute_upon_entry: false,
                watermark: false,
                use_pmi: false,
            approval_type: 2,
                registration_type: 1,
                audio:"both",
                auto_recording: "local",
                enforce_login: false,
                enforce_login_domains: "sd",
                alternative_hosts: "abc@gmail.com"
            },
            global_dial_in_countries: [
  {
      items:"india"
  }
  
            ],
            meeting_authentication: true,
           
            registrants_email_notification: true

        };

```

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [January 17, 2020, 5:43pm UTC](https://devforum.zoom.us/t/create-meeting-working-fine-in-postman-but-not-in-webapi-c/7505/6 "2020-01-17T17:43:53Z")

</div>

Hey @meetings1,

Are you actually passing `{abc@gmail.com}` in your request?

`https://api.zoom.us/v2/users/{abc@gmail.com}/meetings`

The email used must be a user on your account.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![meetings1](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@meetings1](https://devforum.zoom.us/u/meetings1)\
**Post date:** [January 18, 2020, 5:30am UTC](https://devforum.zoom.us/t/create-meeting-working-fine-in-postman-but-not-in-webapi-c/7505/7 "2020-01-18T05:30:51Z")

</div>

Hi @tommy  
Yes we are passing correct emailid. It is working in postman but when i raise a request from c# web api ([mvc.net](http://mvc.net)) program it is throwing below exception.For your reference code snippet added in previously.

We are getting **BadRequest Error**

 ![Error Msg](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/3/3c3785f3fe02e40ff09499ede03cb4fb0240efa3.png)

Also let me know if requested body sent is correct or not.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [January 21, 2020, 5:22pm UTC](https://devforum.zoom.us/t/create-meeting-working-fine-in-postman-but-not-in-webapi-c/7505/8 "2020-01-21T17:22:03Z")

</div>

Hey @meetings1,

Please try sending the email without the `{}` surrounding it.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [August 21, 2020, 7:11pm UTC](https://devforum.zoom.us/t/create-meeting-working-fine-in-postman-but-not-in-webapi-c/7505/9 "2020-08-21T19:11:43Z")

</div>

Closed on August 21, 2020, 7:11pm UTC


