# Getting "Unsupported Media Type" error whil trying to register a user into a webinar

**URL:** <https://devforum.zoom.us/t/getting-unsupported-media-type-error-whil-trying-to-register-a-user-into-a-webinar/6996>\
**Category:** API and Webhooks\
**Created:** [December 9, 2019, 5:34pm UTC](https://devforum.zoom.us/t/getting-unsupported-media-type-error-whil-trying-to-register-a-user-into-a-webinar/6996 "2019-12-09T17:34:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![divakar.chandran](https://avatars.discourse-cdn.com/v4/letter/d/ac8455/32.png) [@divakar.chandran](https://devforum.zoom.us/u/divakar.chandran)\
**Post date:** [December 9, 2019, 5:34pm UTC](https://devforum.zoom.us/t/getting-unsupported-media-type-error-whil-trying-to-register-a-user-into-a-webinar/6996/1 "2019-12-09T17:34:35Z")

</div>

**Description/Error**  
Am trying to call a post method web service (Rest) to register a participant into a webinar by using JAVA. While calling the web service am getting “Unsupported Media Type” error. So can you help what media types are using in ZOOM.

Am using OkHttp methodology to POST.

**How To Reproduce (If applicable)**  
[https://marketplace.zoom.us/docs/api-reference/zoom-api/webinars/webinarregistrantcreate](https://marketplace.zoom.us/docs/api-reference/zoom-api/webinars/webinarregistrantcreate)

---

<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:** [December 9, 2019, 8:50pm UTC](https://devforum.zoom.us/t/getting-unsupported-media-type-error-whil-trying-to-register-a-user-into-a-webinar/6996/2 "2019-12-09T20:50:37Z")

</div>

Hey @divakar.chandran,

That error usually means the request body JSON is malformed.

Can you please share your code, and request body so I can debug?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![divakar.chandran](https://avatars.discourse-cdn.com/v4/letter/d/ac8455/32.png) [@divakar.chandran](https://devforum.zoom.us/u/divakar.chandran)\
**Post date:** [December 10, 2019, 7:40am UTC](https://devforum.zoom.us/t/getting-unsupported-media-type-error-whil-trying-to-register-a-user-into-a-webinar/6996/3 "2019-12-10T07:40:05Z")

</div>

Thanks for the respose, Here the code.

```auto
final OkHttpClient httpClient = new OkHttpClient();
		
		 // form parameters
        FormBody formBody = new FormBody.Builder()
                .add("email", "divakar.chandran@Xyz.com")
                .add("first_name", "Divakar")
                .add("last_name", "Chandran")
                .build();

        Request request = new Request.Builder()
                .url("https://api.zoom.us/v2/webinars/WebinarID/registrants")
                .addHeader("content-type", "application/json")
                .addHeader("authorization", "Bearer XYZZCertificationKey")
                .post((okhttp3.RequestBody) formBody)
                .build();

        try (Response response = httpClient.newCall(request).execute()) {

            if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);

            // Get response body
            System.out.println(response.body().string());
        } catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

```

---

<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:** [December 10, 2019, 7:38pm UTC](https://devforum.zoom.us/t/getting-unsupported-media-type-error-whil-trying-to-register-a-user-into-a-webinar/6996/4 "2019-12-10T19:38:39Z")

</div>

Hey @divakar.chandran,

I see the issue here. You are sending the request body as form data and specifying the “content-type”, `"application/json"` header.

You need to either send JSON as the request body, or change the “content-type” from `"application/json"` to `"multipart/form-data"`.

Info on `"multipart/form-data"`:

> <https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data/4073451#4073451>

Updated code for `"multipart/form-data"`:

```auto
final OkHttpClient httpClient = new OkHttpClient();
		
		 // form parameters
        FormBody formBody = new FormBody.Builder()
                .add("email", "divakar.chandran@Xyz.com")
                .add("first_name", "Divakar")
                .add("last_name", "Chandran")
                .build();

        Request request = new Request.Builder()
                .url("https://api.zoom.us/v2/webinars/WebinarID/registrants")
                .addHeader("content-type", "multipart/form-data")
                .addHeader("authorization", "Bearer XYZZCertificationKey")
                .post((okhttp3.RequestBody) formBody)
                .build();

        try (Response response = httpClient.newCall(request).execute()) {

            if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);

            // Get response body
            System.out.println(response.body().string());
        } catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

```

Try that and or changing the Form Builder to be a JSON object and let me know if it works!

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:07pm UTC](https://devforum.zoom.us/t/getting-unsupported-media-type-error-whil-trying-to-register-a-user-into-a-webinar/6996/5 "2020-08-21T19:07:18Z")

</div>

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


