During my pipeline, after deployment, I want to send a message containing a link to the page that show what has been deployed. To be clear, this is the page that you get when going to your repository, click on Deployment from the sidebar, and then click on the environment. This URL looks something like https://bitbucket.org/<workspace>/<repository>/deployments/%7Bbad41910-a7ed-5def-844d-1961b35b456f%7D, the UUID being the UUID of the deployment.
I’m trying to get that UUID using the REST API https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/deployments. Since this returns a paginated list of all deployments, I’m trying to sort them so that the latest is at the top. But I cannot make it to return the deployment sorted by anything.
Some attempts
https://api.bitbucket.org/2.0/repositories/sourceglobalresearchdev/gta-example-app/deployments?sort="-number"https://api.bitbucket.org/2.0/repositories/sourceglobalresearchdev/gta-example-app/deployments?sort=-"number"https://api.bitbucket.org/2.0/repositories/sourceglobalresearchdev/gta-example-app/deployments?sort%3D%22-number%22https://api.bitbucket.org/2.0/repositories/sourceglobalresearchdev/gta-example-app/deployments?sort%3D-%22number%22
And the same with the created_on field. Some of those calls return an error, some don’t. But the ones that succeeded are not sorted by anything it seems, definitely not by the field I used.
So, does that endpoint support sorting? If so, how can I sort the result so that the latest deployment is on top? Then I’m guessing I can use pagelen=1 to only get the latest deployment.
Thanks for your help