I have done some curl operations like below:
def gitlabCommitStatus(String status) {
def gitlapUrl = "'$gitlabAPI/$projectId/statuses/$sha?state=$status'";
def commitData = "--data 'description=$commitStatusDesc' --data 'target_url=$env.BUILD_URL'";
def commitStatus = "curl -s --request POST --header 'PRIVATE-TOKEN: $gitlabToken' $gitlapUrl $commitData";
executeCommand(commitStatus);
if (status != 'running' && checkCommitMessage() && isProtectedBranch()) {
status = status == 'failed' ? "Failure" : "Success";
runShell('gulp ci-report --status ' + status);
}
}
As same above, i want use below curl in here which is suggested by JIRA team in below support ticket
Ticket - Atlassian Support
Curl command -
curl --request POST \
--url 'https://https://organization.atlassian.net/rest/api/3/issue/<issue-key>/comment' \
--user '<email_address>:<API_Token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"body": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Atlassian Test",
"type": "text"
}
]
}
]
}
}'
above curl works fine in linux terminal