# Get Bad request (status 400) using JWT Token in call to API

**URL:** <https://devforum.zoom.us/t/get-bad-request-status-400-using-jwt-token-in-call-to-api/13289>\
**Category:** API and Webhooks\
**Created:** [April 15, 2020, 10:26am UTC](https://devforum.zoom.us/t/get-bad-request-status-400-using-jwt-token-in-call-to-api/13289 "2020-04-15T10:26:42Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![hkdave95](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/hkdave95/32/6122_2.png) [@hkdave95](https://devforum.zoom.us/u/hkdave95)\
**Post date:** [April 15, 2020, 10:26am UTC](https://devforum.zoom.us/t/get-bad-request-status-400-using-jwt-token-in-call-to-api/13289/1 "2020-04-15T10:26:42Z")

</div>

**Description**

I am using JWT Auth.

The same token I use connects ok on a GET. When I use the same token on a POST later in my code I get the following error.

I am within a .NET WinService using HttpRequest methods.

The request is:

{Method: POST, RequestUri: ‘[https://api.zoom.us/v2/users/](https://api.zoom.us/v2/users/){ user }/meetings’, Version: 1.1, Content: PieceBook.Library.NET.Zoom.JsonContent, Headers:  
{  
Accept: application/json  
Authorization: Bearer { token }  
Content-Type: application / json; charset=utf-8  
Content-Length: 963  
}}

**Error**

{StatusCode: 400, ReasonPhrase: ‘’, Version: 1.1, Content: System.Net.Http.StreamContent, Headers:  
{  
Connection: keep-alive  
x-zm-trackingid: WEB\_8c20192beaa66678fc05b908eff2e58f  
X-Content-Type-Options: nosniff  
Pragma: no-cache  
Cache-Control: no-store, no-transform, must-revalidate, no-cache  
Date: Wed, 15 Apr 2020 03:30:51 GMT  
Set-Cookie: zm\_aid=""; Domain=.zoom . us; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly  
Set-Cookie: zm\_haid=""; Domain=.zoom . us; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly  
Set-Cookie: cred=CC8625D1ECE8CF392DE6F0C383A0D8B8; Path=/; Secure; HttpOnly  
Set-Cookie: \_zm\_ctaid=""; Domain=.zoom . us; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly  
Set-Cookie: \_zm\_chtaid=""; Domain=.zoom . us; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly  
Server: ZOOM  
Content-Length: 109  
Content-Type: application / json; charset=UTF-8  
Expires: Thu, 01 Jan 1970 00:00:00 GMT  
}}

**Which App Type (OAuth / Chatbot / JWT / Webhook)?**  
JWT

**Which Endpoint/s?**  
Please see above

**How To Reproduce (If applicable)**  
You could try the token I supplied above…

**Screenshots (If applicable)**  
N/a at this stage

**Additional context**  
Please note the JWT token gets existing meetings on same endpoint, just not posting a new scheduled meeting 🙂

---

<div class="post-metadata">

**Author:** ![michael.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael.zoom/32/37213_2.png) [@michael.zoom](https://devforum.zoom.us/u/michael.zoom)\
**Post date:** [April 15, 2020, 3:26pm UTC](https://devforum.zoom.us/t/get-bad-request-status-400-using-jwt-token-in-call-to-api/13289/2 "2020-04-15T15:26:45Z")

</div>

Hi @hkdave95, we’ll help you figure this out but I wanted to quickly note I’ve edited your post to remove some personal data.

---

<div class="post-metadata">

**Author:** ![michael.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael.zoom/32/37213_2.png) [@michael.zoom](https://devforum.zoom.us/u/michael.zoom)\
**Post date:** [April 15, 2020, 3:30pm UTC](https://devforum.zoom.us/t/get-bad-request-status-400-using-jwt-token-in-call-to-api/13289/3 "2020-04-15T15:30:48Z")

</div>

@hkdave95, could you provide us with the body of the request you’re making?

Are you generating JWT on each request? (this is suggested)

---

<div class="post-metadata">

**Author:** ![hkdave95](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/hkdave95/32/6122_2.png) [@hkdave95](https://devforum.zoom.us/u/hkdave95)\
**Post date:** [April 15, 2020, 3:38pm UTC](https://devforum.zoom.us/t/get-bad-request-status-400-using-jwt-token-in-call-to-api/13289/4 "2020-04-15T15:38:31Z")

</div>

Dear Michael

I thought I should not put some of that out / much obliged….

Quite a lot of things on my list as you might imagine.

Appreciate the help.

KR

David

---

<div class="post-metadata">

**Author:** ![hkdave95](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/hkdave95/32/6122_2.png) [@hkdave95](https://devforum.zoom.us/u/hkdave95)\
**Post date:** [April 15, 2020, 3:42pm UTC](https://devforum.zoom.us/t/get-bad-request-status-400-using-jwt-token-in-call-to-api/13289/5 "2020-04-15T15:42:01Z")

</div>

Actually I tried both methods…

1. Generating for first Get which works, then following bit of code Post same JWT access token.

2. Then I tried generated new access token for 2nd call (Post)

3. In both methods Get works and post does not.

KR

---

<div class="post-metadata">

**Author:** ![hkdave95](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/hkdave95/32/6122_2.png) [@hkdave95](https://devforum.zoom.us/u/hkdave95)\
**Post date:** [April 15, 2020, 3:43pm UTC](https://devforum.zoom.us/t/get-bad-request-status-400-using-jwt-token-in-call-to-api/13289/6 "2020-04-15T15:43:33Z")

</div>

Httprequest…

```
    public async static Task<PieceBook.Library.NET.Zoom.JWTData.CreatedMeeting> ScheduleMeeting(string lsEndPoint, string lsAccessToken, PieceBook.Library.NET.Data.PieceBook.CalendarItem loCalendarItem, string lsEmail, string lsName, string lsPassword)

```

{

```
        PieceBook.Library.NET.Zoom.JWTData.CreatedMeeting loCreatedMeeting = null;

        try

```

{

```
            PieceBook.Library.NET.Zoom.JWTData.CreateAMeeting loCreateAMeeting = new JWTData.CreateAMeeting();

            loCreateAMeeting.created_at = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ssZ");

            loCreateAMeeting.start_time = loCalendarItem.Start.ToString("yyyy-MM-ddTHH:mm:ssZ");

            loCreateAMeeting.duration = (int)(loCalendarItem.End - loCalendarItem.Start).TotalMinutes;

```

loCreateAMeeting.topic = loCalendarItem.Title;

loCreateAMeeting.agenda = loCalendarItem.Description;

loCreateAMeeting.host\_id = lsEmail;

loCreateAMeeting.password = lsPassword;

loCreateAMeeting.type = 2;

```
            loCreateAMeeting.settings.close_registration = false;

```

loCreateAMeeting.settings.contact\_email = lsEmail;

loCreateAMeeting.settings.contact\_name = lsName;

```
            loCreateAMeeting.settings.enforce_login = false;

            loCreateAMeeting.settings.host_video = true;

            loCreateAMeeting.settings.in_meeting = true;

            loCreateAMeeting.settings.join_before_host = false;

            loCreateAMeeting.settings.meeting_authentication = true;

            loCreateAMeeting.settings.mute_upon_entry = false;

            loCreateAMeeting.settings.participant_video = true;

            loCreateAMeeting.settings.registrants_email_notification = false;

```

loCreateAMeeting.settings.registration\_type = 2;

```
            loCreateAMeeting.settings.use_pmi = false;

            loCreateAMeeting.settings.waiting_room = false;

            HttpRequestBuilder loHttpRequestBuilder = new HttpRequestBuilder();

```

loHttpRequestBuilder.AddBearerToken(lsAccessToken);

```
            loHttpRequestBuilder.AddRequestUri(lsEndPoint + string.Format("/users/{0}/meetings", PieceBook.Library.NET.Classes.Encryption.UrlEncode(lsEmail)));

```

loHttpRequestBuilder.AddMethod(HttpMethod.Post);

JToken json = JObject.FromObject(loCreateAMeeting);

```
            loHttpRequestBuilder.AddContent(new JsonContent(json));

            HttpResponseMessage loHttpResponseMessage = await loHttpRequestBuilder.SendAsync();

            if (loHttpResponseMessage.IsSuccessStatusCode)

```

{

loCreatedMeeting = HttpResponseExtensions.ContentAsType\<PieceBook.Library.NET.Zoom.JWTData.CreatedMeeting\>(loHttpResponseMessage);

}

}

```
        catch (Exception loException)

```

{

```
            PieceBook.Library.NET.Classes.Utility.MakeExceptionMessage(loException, "<br /><br />", "JWTLib.cs -> ScheduleMeeting");

```

}

```
        return loCreatedMeeting;

```

}

---

<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:** [April 16, 2020, 5:28am UTC](https://devforum.zoom.us/t/get-bad-request-status-400-using-jwt-token-in-call-to-api/13289/7 "2020-04-16T05:28:35Z")

</div>

Hey @hkdave95,

There is something wrong with your request body.

To make it easier for me to debug, can you reproduce this in Postman, and share your request body in JSON format?

Or just recreate your request body in JSON format.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![hkdave95](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/hkdave95/32/6122_2.png) [@hkdave95](https://devforum.zoom.us/u/hkdave95)\
**Post date:** [April 16, 2020, 9:14am UTC](https://devforum.zoom.us/t/get-bad-request-status-400-using-jwt-token-in-call-to-api/13289/8 "2020-04-16T09:14:55Z")

</div>

Dear Tommy

Here is the JSON….

Would the null values cause a problem?

David

{{

“host\_id”: “[david@dar-jader.com](mailto:david@dar-jader.com)”,

“topic”: “Event 7”,

“type”: 2,

“start\_time”: “2020-03-09T18:00:00Z”,

“duration”: 120,

“password”: “ipsa”,

“timezone”: null,

“created\_at”: “2020-04-16T10:08:25Z”,

“agenda”: “Event 7”,

“tracking\_fields”: ,

“recurrence”: {

“type”: 0,

“repeat\_interval”: 0,

“weekly\_days”: null,

“monthly\_day”: 0,

“monthly\_week”: 0,

“monthly\_week\_day”: 0,

“end\_times”: 0,

“end\_date\_time”: null

},

“settings”: {

“host\_video”: true,

“participant\_video”: true,

“cn\_meeting”: false,

“in\_meeting”: true,

“join\_before\_host”: false,

“mute\_upon\_entry”: false,

“use\_pmi”: false,

“approval\_type”: 0,

“registration\_type”: 2,

“audio”: null,

“audio\_recording”: null,

“enforce\_login”: false,

“enforce\_login\_domains”: null,

“alternative\_hosts”: null,

“close\_registration”: false,

“waiting\_room”: false,

“global\_dial\_in\_countries”: null,

“contact\_name”: “David.Robertson”,

“contact\_email”: “[david@dar-jader.com](mailto:david@dar-jader.com)”,

“registrants\_email\_notification”: false,

“meeting\_authentication”: true,

“authentication\_option”: null,

“authentication\_domains”: null

}

}}

---

<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:** [April 17, 2020, 6:01pm UTC](https://devforum.zoom.us/t/get-bad-request-status-400-using-jwt-token-in-call-to-api/13289/9 "2020-04-17T18:01:52Z")

</div>

Hey @hkdave95,

Yes, for the null values, just remove that whole key value pair.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![hkdave95](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/hkdave95/32/6122_2.png) [@hkdave95](https://devforum.zoom.us/u/hkdave95)\
**Post date:** [April 17, 2020, 6:53pm UTC](https://devforum.zoom.us/t/get-bad-request-status-400-using-jwt-token-in-call-to-api/13289/10 "2020-04-17T18:53:35Z")

</div>

OK / I shall do so and report back…

---

<div class="post-metadata">

**Author:** ![hkdave95](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/hkdave95/32/6122_2.png) [@hkdave95](https://devforum.zoom.us/u/hkdave95)\
**Post date:** [April 18, 2020, 1:02pm UTC](https://devforum.zoom.us/t/get-bad-request-status-400-using-jwt-token-in-call-to-api/13289/11 "2020-04-18T13:02:13Z")

</div>

Dear Tommy

Found the problem.

I created a recurring event for just one event and the problem dissolved.

I suppose I could simply have removed the unnecessary item from the json data.

Anyhoo it is working now.

TYVM for pointers.

KR

David

---

<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:** [April 20, 2020, 8:55pm UTC](https://devforum.zoom.us/t/get-bad-request-status-400-using-jwt-token-in-call-to-api/13289/12 "2020-04-20T20:55:55Z")

</div>

Happy to hear you got it working! 🙂

-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, 8:31pm UTC](https://devforum.zoom.us/t/get-bad-request-status-400-using-jwt-token-in-call-to-api/13289/13 "2020-08-21T20:31:27Z")

</div>

Closed on August 21, 2020, 8:31pm UTC


