# Trying to use create a meeting api with javascript

**URL:** <https://devforum.zoom.us/t/trying-to-use-create-a-meeting-api-with-javascript/59864>\
**Category:** API and Webhooks\
**Created:** [November 5, 2021, 6:32pm UTC](https://devforum.zoom.us/t/trying-to-use-create-a-meeting-api-with-javascript/59864 "2021-11-05T18:32:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![brandonh](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/brandonh/32/20575_2.png) [@brandonh](https://devforum.zoom.us/u/brandonh)\
**Post date:** [November 5, 2021, 6:32pm UTC](https://devforum.zoom.us/t/trying-to-use-create-a-meeting-api-with-javascript/59864/1 "2021-11-05T18:32:07Z")

</div>

HI, I was tasked with making an HTML and javascript page so that people could just type in some information and then just be given a link to their scheduled meeting.

I am using JWT as it seemed to be easier for the two to use.

I know fetch() is throwing me an error. that error being TypeError: NetworkError when attempting to fetch resource. but at this point, I am just wondering if I am calling it correctly.

I would use a screenshot of the code, but I can’t upload pictures. so I am just going to copy-paste it here. I have removed my methods of creating the JWT token for safety reasons

var date

var time

var topics

var Password

var Dura

var josnbody

var combine

var url

var email

var sJWT

document.getElementById(“myBtn”).onclick = function () { GrabV };

document.getElementById(“myBtn”).addEventListener(“click”, GrabV)

function GrabV() {

email = document.getElementById(“email”).value

date = document.getElementById(“date”).value

time = document.getElementById(“time”).value

topics = document.getElementById(“topic”).value

Password = document.getElementById(“Password”).value

Dura = document.getElementById(“duration”).value

Dura = parseInt(Dura)

combine = date + “T” + time

MakeToken()

}

function MakeToken() {

MakeJson()

}

function MakeJson() {

jsonbody = {

```
"topic": topics,

"type": 2,

"start_time": combine,

"duration": Dura,

"password": Password,

"timezone": 'America/New_York',

"settings": {

  "host_video": true,

  "participant_video": true,

  "join_before_host": false,

  "mute_upon_entry": true,

}

```

}

Func()

}

function Func() {

url = ‘[https://api.zoom.us/v2/users/](https://api.zoom.us/v2/users/)’ + email + ‘/meetings’

var jboy = JSON.stringify(josnbody)

var head = new Headers();

head.append(‘Content-Type’, ‘application/json’);

head.append(‘authorization’, ‘Bearer’ + sJWT);

var initObject = {

```
method: 'POST', headers: head, body: jboy

```

}

var input = new Request(url, initObject)

fetch(input)

```
.then(function (repsonse) {

  return response.json();

})

.then(function (data) {

  console.log(data);

})

.catch(function (err) {

  console.log("Something went wrong!", err);

});

```

}

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [November 9, 2021, 12:11am UTC](https://devforum.zoom.us/t/trying-to-use-create-a-meeting-api-with-javascript/59864/2 "2021-11-09T00:11:46Z")

</div>

Hey @brandonh,

Thank you for reaching out to the Zoom Developer Forum. When you the TypeError is there an HTTP status returned from the API or is your application unable to contact the endpoint at all?

Have you tried making that same request from a REST client like Postman? What are the results?

Thanks,  
Max

---

<div class="post-metadata">

**Author:** ![brandonh](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/brandonh/32/20575_2.png) [@brandonh](https://devforum.zoom.us/u/brandonh)\
**Post date:** [November 15, 2021, 7:01pm UTC](https://devforum.zoom.us/t/trying-to-use-create-a-meeting-api-with-javascript/59864/3 "2021-11-15T19:01:19Z")

</div>

The TypeError is TypeError: NetworkError when attempting to fetch resources. I believe this means that it is not even getting a return from the API and just cannot contact it. For Postman I am very much new to it. Before writing the code I did mess with making a meeting using O2Auth on Postman. I got that to work. I did not try to do JWT with Postman as I am new to it and O2Auth seems easier with Postman, But harder to do with code.

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [November 17, 2021, 11:18pm UTC](https://devforum.zoom.us/t/trying-to-use-create-a-meeting-api-with-javascript/59864/4 "2021-11-17T23:18:15Z")

</div>

Hey @brandonh,

Thank you for following up on this. I would make sure there isn’t a firewall, VPN or other network configuration on the device you’re testing with. You can also try making the request on a different network and device to rule out either as a factor.

Thanks,  
Max

---

<div class="post-metadata">

**Author:** ![brandonh](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/brandonh/32/20575_2.png) [@brandonh](https://devforum.zoom.us/u/brandonh)\
**Post date:** [November 18, 2021, 7:19pm UTC](https://devforum.zoom.us/t/trying-to-use-create-a-meeting-api-with-javascript/59864/5 "2021-11-18T19:19:41Z")

</div>

I will check my network setting and try other devices to see if that works. Not sure if you know but is my code good or should I try to rewrite it. Kind of my first time trying something like that.

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [November 23, 2021, 10:41pm UTC](https://devforum.zoom.us/t/trying-to-use-create-a-meeting-api-with-javascript/59864/6 "2021-11-23T22:41:31Z")

</div>

Hey @brandonh,

I’ll note that you’ll want to make sure that you are making these API calls from the back-end of your app. Calling them from client-side javascript will result in a CORS error which could be the cause of what you’re seeing here.

In other words, it might be best to test this out on a REST client like Postman and then try making the calls from Node and Express.

Let me know if that helps.

Thanks,  
Max

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [December 24, 2021, 8:42am UTC](https://devforum.zoom.us/t/trying-to-use-create-a-meeting-api-with-javascript/59864/7 "2021-12-24T08:42:09Z")

</div>

Closed on December 24, 2021, 8:42am UTC

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