How to use the new report functionality?
Asked by S?bastien Gachoud:

Hi,

I am trying to use the new report functionality but I do not understand why it does not show up.

#### What I did: {#toc-hId-352278064}

In the pipeline, I ran

> curl --request PUT '<https://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/commit/$BITBUCKET_COMMIT/reports/mySystem-001>' \\ --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", "data": \[ { "title": "Duration (seconds)", "type": "DURATION", "value": 14 }, { "title": "Safe to merge?", "type": "BOOLEAN", "value": false } \] }'

it ran just fine when I used the pipeline on the pull-request branch.

#### What I was expecting: {#toc-hId--1455176399}

Something to appear in the report section of the pull request.

Can someone tell me what is not working here?

Edit: Actually I noticed afterward that the response to curl PUT does not trigger a failure to the pipeline. I receive a "Resource not found" error message but I am unable to find out why.

Best


Answers:
author: Patrik S
body: Hey [@S?bastien Gachoud](/t5/user/viewprofilepage/user-id/5574262) ,

welcome to the Atlassian Community!

Looking at the request you shared, it seems you're not adding credentials for authentication, and thus the API is returning a 'Resource not found' error.

I was able to successfully create a report using the example request below :  

```

curl --location -u USERNAME:APP_PASSWORD --request PUT 'https://api.bitbucket.org/2.0/repositories/test-workspace-4/test_zip_file/commit/401321e808c0e06af7cdf954319f0c66e719e35b/reports/mysystem-001' \
--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",
"data": [
 {
"title": "Duration (seconds)",
"type": "DURATION",
"value": 14
 },
 {
"title": "Safe to merge?",
"type": "BOOLEAN",
"value": false
 }
 ]
}'
```

Where:

* USERNAME : your bitbucket account username. You can find/change the username under your [personal bitbucket settings](https://bitbucket.org/account/settings/).
* APP PASSWORD: a token used for authentication. If you haven't already, you can [create a new app password](https://support.atlassian.com/bitbucket-cloud/docs/create-an-app-password/) with at least repository:read scope, that is required for that endpoint.

Could you adjust your request as per the example above and let us know how it goes?

Also, I would suggest to test the request locally on your terminal first to confirm it's working and make any necessary adjustments, and once it's working locally, you can update your pipeline to match.

I hope that helps! Let us know in case you have any questions.

Thank you, [@S?bastien Gachoud](/t5/user/viewprofilepage/user-id/5574262) !

Patrik S

comments: author: S?bastien Gachoud
body: Hello,

Thank you for your help. I am actually using the proxy:

> 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](https://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/commit/$BITBUCKET_COMMIT/reports/mySystem-001)' \\ --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](http://www.mysystem.com/reports/001)", "result": "FAILED", "data": \[ { "title": "Duration (seconds)", "type": "DURATION", "value": 14 }, { "title": "Safe to merge?", "type": "BOOLEAN", "value": false } \] }'

Best


author: S?bastien Gachoud
body: Hi,

Would you have some other idea?

Best


Tags: bitbucket-cloud

cloud