Unexpected Character thrown when trying to perform REST calls

プラットフォームについて: Cloud と Data Center - この記事は クラウド プラットフォームとデータセンター プラットフォームの両方に等しく当てはまります。

Server* 製品のサポートは 2024 年 2 月 15 日に終了しました。Server 製品を実行している場合は、 アトラシアン Server サポート終了 のお知らせにアクセスして、移行オプションを確認してください。

*Fisheye および Crucible は除く

問題

When trying to use REST API, you receive an Unexpected Character error message. For example, when using the follow curl command to create a new JIRA issue via REST

curl -u admin:admin -X POST --data /home/user/data.txt -H "Content-Type: application/json" http://localhost:8080/rest/api/2/issue

You receive the following error response

{ "errorMessages":[ "Unexpected character ('/' (code 47)): maybe a (non-standard) comment? (not recognized as one since Feature 'ALLOW_COMMENTS' not enabled for parser)\n at [Source: org.apache.catalina.connector.CoyoteInputStream@49d0d945; line: 1, column: 2]" ] }

原因

The format of the command is incorrect. In this example, the format for --data is incorrect. It should be the following

curl -u admin:admin -X POST --data @/home/user/data.txt -H "Content-Type: application/json" http://localhost:8080/rest/api/2/issue

Note that there is an additional alias (@) before the file path. In this case, it was expecting an '@' but got a '/' instead, hence throwing the error

ソリューション

Refer to Jira REST APIs and make sure the correct formatting is used

更新日時: September 25, 2025

さらにヘルプが必要ですか?

アトラシアン コミュニティをご利用ください。