Here I will explain you step by step on how to create a Zoom Meeting Link with Zoom API using Asp.net Core Razor Page.

Create Zoom App to get API Key and Secret

To get Zoom API, we need to create an Account on Zoom Marketplace. Click this link to create one.

Zoom Marketplace

Once you created the Zoom account. Go to the Build App page and select the JWT to generate your API Key & Secret.

By using JWT, you don’t need a user authorization and it supports server to server integration.

zoom JWT- techussain
Zoom JWT

You can see the detailed documentation about JWT through this link.

Also see on How to create a Zoom Meeting Link with Zoom API using Asp.net C# and VB

Now create an Asp.net Core Razor Page on Visual Studio and name it as ZoomAPI.

Now right click Pages folder on Solution Explorer and add a new Razor Page and name it as Zoom.cshtml

Add the code below on Zoom.cshtml

@page
@model ZoomModel
@{
    ViewData["Title"] = "Create Zoom Meeting";
}

<h2>Host URL</h2>
<span>@Model.Host</span>

<h2>Join URL</h2>
<span>@Model.Join</span>

<h2>Response Code</h2>
<span>@Model.Code</span>

NuGet Packages needed to run the application.

System.IdentityModel.Tokens.Jwt
Newtonsoft.Json
RestSharp

To install NuGet Packages, right click ZoomAPI from the solution Explorer and click Manage Nuget packages.

Now open the Code Behind and add the code.

Required Namespaces

C#
using Newtonsoft.Json.Linq;
using RestSharp;
using System;
using System.Text;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.IdentityModel.Tokens;
using Microsoft.AspNetCore.Mvc;
using System.Net;

Now BindProperty with the following strings

public string Host { get; set; }
public string Join { get; set; }
public string Code { get; set; }

Now declare the variables

C#
var tokenHandler = new System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler();
var now = DateTime.UtcNow;
var apiSecret = "Your API secret";
byte[] symmetricKey = Encoding.ASCII.GetBytes(apiSecret);

Create the Token Descriptor and change it to Token String for the Authorization Header

C#
var tokenDescriptor = new SecurityTokenDescriptor
{
Issuer = "Your API Key",
Expires = now.AddSeconds(300),
SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(symmetricKey), SecurityAlgorithms.HmacSha256),
};
var token = tokenHandler.CreateToken(tokenDescriptor);
var tokenString = tokenHandler.WriteToken(token);

Create Request

Now use the code for the Request

C#
var client = new RestClient("https://api.zoom.us/v2/users/{userid}/meetings");
var request = new RestRequest(Method.POST);
request.RequestFormat = DataFormat.Json;
request.AddJsonBody(new { topic = "Meeting with Ussain", duration = "10", start_time = "2021-05-20T05:00:00", type = "2" });
request.AddHeader("authorization", String.Format("Bearer {0}", tokenString));

{userid}: you can use your Zoom Username.

host_email: Host Email

topic: Topic for the meeting

duration: Duration of the meeting

start_time: Set the start time for the meeting

type: We use 2 for Scheduled meeting

For more objects like above please refer this link

Here we use DataFormat.Json for format as we created JWT.

Get Response

Now use the code to get the Response

C#
IRestResponse restResponse = client.Execute(request);
HttpStatusCode statusCode = restResponse.StatusCode;
int numericStatusCode = (int)statusCode;
var jObject = JObject.Parse(restResponse.Content);
Host = (string)jObject["start_url"];
Join = (string)jObject["join_url"];
Code = Convert.ToString(numericStatusCode);

That’s it.

Now you can generate the link.

Output

Download

How to create a Zoom Meeting Link with Zoom API using Asp.net C# and VB
Simple way to create asp.net repeater pagination control without using Sessions or Stored Procedure

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.