# Fix 415 Unsupported Media Type on Jira REST calls

URL: https://goingstellar.ro/reference/atlassian-rest-api/content-type-and-415/

Endpoints with a JSON body expect Content-Type: application/json. A valid JSON body sent as text/plain is refused with 415 Unsupported Media Type before the content is looked at. The body of that 415 is problem JSON, which differs from the errorMessages shape used for validation errors.

## Endpoints

| Method | Path | What it does |
|---|---|---|
| POST | `/rest/api/3/issue` | Create a work item. Requires a JSON content type. |
| POST | `/rest/api/3/issue/{issueIdOrKey}/comment` | Add a comment. Requires a JSON content type. |

## Examples

### POST /rest/api/3/issue

Sends a JSON body with the header Content-Type: text/plain.

```bash
curl -X POST \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: text/plain' \
  --data '{
  "fields": {}
}' \
  'https://your-domain.atlassian.net/rest/api/3/issue'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.post(
    'https://your-domain.atlassian.net/rest/api/3/issue',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json', 'Content-Type': 'text/plain'},
    json={'fields': {}},
)
print(r.status_code, r.text)
```

Response: HTTP 415

```
{
 "type": "about:blank",
 "title": "Unsupported Media Type",
 "status": 415,
 "detail": "Content-Type 'text/plain' is not supported.",
 "instance": "/rest/api/3/issue"
}
```

Response headers:

```
Content-Type: application/problem+json;charset=UTF-8
```

Sent to Atlassian Cloud on 29 Nov 2026.

### POST /rest/api/3/issue

Same endpoint with application/json and a valid body.

```bash
curl -X POST \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
  "fields": {
    "project": {
      "key": "WEB"
    },
    "issuetype": {
      "name": "Task"
    },
    "summary": "Example created through REST API",
    "description": {
      "type": "doc",
      "version": 1,
      "content": [
        {
          "type": "paragraph",
          "content": [
            {
              "type": "text",
              "text": "Created with POST /rest/api/3/issue."
            }
          ]
        }
      ]
    },
    "labels": [
      "api-example"
    ],
    "duedate": "2026-12-15"
  }
}' \
  'https://your-domain.atlassian.net/rest/api/3/issue'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.post(
    'https://your-domain.atlassian.net/rest/api/3/issue',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    json={'fields': {'project': {'key': 'WEB'},
                     'issuetype': {'name': 'Task'},
                     'summary': 'Example created through REST API',
                     'description': {'type': 'doc',
                                     'version': 1,
                                     'content': [{'type': 'paragraph',
                                                  'content': [{'type': 'text',
                                                               'text': 'Created with POST '
                                                                       '/rest/api/3/issue.'}]}]},
                     'labels': ['api-example'],
                     'duedate': '2026-12-15'}},
)
print(r.status_code, r.text)
```

Response: HTTP 201

```
{
 "id": "10768",
 "key": "WEB-57",
 "self": "https://your-domain.atlassian.net/rest/api/3/issue/10768"
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### POST /rest/api/3/issue/{issueIdOrKey}/comment

Another JSON POST that succeeds with the right header.

```bash
curl -X POST \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
  "body": {
    "type": "doc",
    "version": 1,
    "content": [
      {
        "type": "paragraph",
        "content": [
          {
            "type": "text",
            "text": "First comment through the REST API."
          }
        ]
      }
    ]
  }
}' \
  'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/comment'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.post(
    'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/comment',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    json={'body': {'type': 'doc',
                   'version': 1,
                   'content': [{'type': 'paragraph',
                                'content': [{'type': 'text',
                                             'text': 'First comment through the REST API.'}]}]}},
)
print(r.status_code, r.text)
```

Response: HTTP 201

```
{
 "id": "11103",
 "created": "2026-11-29T19:29:55.626+0200"
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

## How it behaves

- POST /rest/api/3/issue with Content-Type: text/plain answered 415, with type about:blank, title Unsupported Media Type, status 415 and detail Content-Type 'text/plain' is not supported.
- The 415 response itself had the Content-Type application/problem+json;charset=UTF-8, and the instance field repeated the request path.
- The response headers captured for the 415 held no X-Ratelimit-Limit or X-Ratelimit-Remaining, which the normal JSON calls on the same host do show.

## Pitfalls

- Many HTTP clients default to text/plain or form encoding when given a string body. Set the header explicitly or use the client's json option.
- Match on status 415, not on the detail text. The message names whatever type was sent.
- File uploads go the other way: they use multipart/form-data and need the X-Atlassian-Token header as well.

## Questions and answers

### Which Content-Type does Jira REST expect?

application/json for JSON bodies. The basic auth guide examples send that header on every call.

### Is the Accept header needed too?

The runs did not vary Accept. The Confluence tutorial sets Accept: application/json in its examples.

## Related

- [Error response formats](https://goingstellar.ro/reference/atlassian-rest-api/error-responses/)
- [X-Atlassian-Token: no-check](https://goingstellar.ro/reference/atlassian-rest-api/xsrf-no-check-header/)
- [HTTP status codes](https://goingstellar.ro/reference/atlassian-rest-api/http-status-codes/)
- [Create a work item](https://goingstellar.ro/reference/atlassian-rest-api/create-issue/)

## Sources

- [The Jira Cloud platform REST API v3 (Atlassian Developer)](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/)
- [Basic auth for REST APIs, Jira (Atlassian Developer)](https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/)

