title: Unable to create Keycloak realm via the rest admin API: Unsupported Media Type
body: <p>I am using keycloak 4.8.3 and I am trying to create a new realm and user(s) using the admin api. According to <a href="https://www.keycloak.org/docs-api/4.8/rest-api/index.html#_realms_admin_resource" rel="nofollow noreferrer">the documentation</a> , it looks like it is the import call. Assuming I am running keycloak on localhost, the api url should look like <code>http://localhost:8080/auth/</code>. I am also a little bit confused by the doc which isn't explicit on the exact path other than <code>POST /</code> so not sure if it's <code>POST /admin/realms</code>.</p>
  
  <p>I have started working on this using ansible and since not getting making any head way , I turned to plain REST. I have used the master username and password to get a token calling <code>/auth/realms/master/protocol/openid-connect/token</code>. It looks like with the POST request/response below, I am either calling the wrong url, or making call with the wrong Content-Type (tried  sending only <code>{"realm": "somerealm"}</code> with the form url encoded type and keycloak only returns OK etc but nothing gets created). </p>
  
  <pre><code>&gt; POST /auth/ HTTP/1.1
  &gt; Host: localhost:8080
  &gt; User-Agent: insomnia/6.5.4
  &gt; Content-Type: application/json
  &gt; Authorization: bearer eyJhbGcisomelongbearertoken"
  &gt; Accept: */*
  &gt; Content-Length: 373
  
  | {
  |   "realm": "somerealm",
  |   "displayName": "somerealm",
  |   "enabled": true,
  |   "users": [
  |       {
  |           "email": "apigateway@example.com",
  |           "enabled": true,
  |           "firstName": "APIGateway",
  |           "lastName": "SomeProject",
  |           "usename": "api-manager",
  |           credentials: [
  |               {
  |                   "temporary": false,
  |                   "type": "password",
  |                   "value": "somedecentpassword"
  |               }
  |           ]
  |       }
  |   ]
  | }
  
  * upload completely sent off: 373 out of 373 bytes
  
  &lt; HTTP/1.1 415 Unsupported Media Type
  &lt; Date: Tue, 25 Jun 2019 11:13:44 GMT
  &lt; Content-Length: 0
  &lt; Connection: keep-alive
  </code></pre>
  
  <p>Can anyone hint on the issue above, I am on this for the past 24h and I think I need to come here and shout for help. Thanks in advance</p>