No matching report found
Asked by Hudhayfah:

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": {}}


Answers:
author: Caroline R
body: Hi, [@Hudhayfah](/t5/user/viewprofilepage/user-id/4739190), 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:

* <https://developer.atlassian.com/cloud/bitbucket/rest/api-group-reports/#api-repositories-workspace-repo-slug-commit-commit-reports-reportid-put>

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:

* [https://developer.atlassian.com/cloud/bitbucket/rest/api-group-reports/#api-repositories-workspace-repo-slug\[...\]reportid-annotations-annotationid-put](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-reports/#api-repositories-workspace-repo-slug-commit-commit-reports-reportid-annotations-annotationid-put)

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

comments: author: Hudhayfah
body: ```
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


author: Caroline R
body: Hi, [@Hudhayfah](/t5/user/viewprofilepage/user-id/4739190),

I saw that you created [another question](https://community.atlassian.com/t5/Bitbucket-questions/how-to-generate-code-report-in-PRs/qaq-p/1953887) 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


Tags: bitbucket-cloud

cloud