I am trying to use the bitbucket code report
using Gradle curl.
task flushBucket() {
def process = [ 'bash', '-c', "curl --proxy 'http://localhost:29418' --request PUT \"http://api.bitbucket.org/2.0/repositories/\$BITBUCKET_REPO_OWNER/\$BITBUCKET_REPO_SLUG/commit/\$BITBUCKET_COMMIT/reports/mySystem-001/annotations/mySystem-annotation0055\" --header 'Content-Type: application/json' --data-raw '{\"title\": \"ttile\"}' " ].execute()
process.waitFor()
println "flushBucketflushBucket"
println process.err.text
println process.text
}
however,
{"key": "report-service.general.bad-request", "message": "No matching report found ", "arguments": {}}
Hi, @Huthefa, thank you for reaching out to Atlassian Community.
In order to create or update a report, I would recommend you to follow the steps described in this link:
By checking the endpoint you have shared, it doesn’t look like you are using this endpoint to create/update a report, but the following endpoint to create or update an annotation in a report:
based on the URL in the question:
http://api.bitbucket.org/2.0/repositories/\$BITBUCKET_REPO_OWNER/\$BITBUCKET_REPO_SLUG/commit/\$BITBUCKET_COMMIT/reports/mySystem-001/annotations/mySystem-annotation0055
I understand you are trying to update or put an annotation in the report called mySystem-001 and if you get “No matching report found”, I would suggest you get all reports for that specific commit with
https://developer.atlassian.com/cloud/bitbucket/rest/api-group-reports/#api-repositories-workspace-repo-slug-commit-commit-reports-get and see if there is a report with external_id mySystem-001 for that commit.
Please let me know how it goes and free to share any additional questions or concerns regarding this case.
Kind regards,
Caroline
script:
- >
curl --request PUT 'http://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/commit/$BITBUCKET_COMMIT/reports/mysystem-002' \
--header 'Content-Type:application/json' \
--data-raw '{ "title": "Security scan report",
"details": "This pull request introduces 10 new dependency vulnerabilities.",
"report_type": "SECURITY",
"reporter": "mySystem",
"link": "http://www.mysystem.com/reports/001",
"result": "FAILED" }'
no reports are generated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, @Huthefa,
I saw that you created another question for this subject and Theodora has already provided you an answer, so you can refer to that for creating a report, and then let us know how it goes with creating a report and with the annotations.
Looking forward to hearing from you.
Kind regards,
Caroline
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.