Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource not found error for the deployments endpoint #33

Closed
antrille opened this issue Jan 23, 2022 · 1 comment
Closed

Resource not found error for the deployments endpoint #33

antrille opened this issue Jan 23, 2022 · 1 comment

Comments

@antrille
Copy link

antrille commented Jan 23, 2022

Hi!

I found an issue in the API client. Whenever I try to fetch a deployments list, I'm getting the following exception:

{
    "message": "Resource not found: There is no API hosted at this URL.",
    "exception": "Bitbucket\\Exception\\RuntimeException",
    "file": "/srv/app/vendor/bitbucket/client/src/HttpClient/Plugin/BitbucketExceptionThrower.php",
    "line": 76,
    "trace": [ ... ]
}

Here's how I'm trying to get the list from code:

$deployments = $this
    ->bitbucket
    ->repositories()
    ->workspaces($workspace)
    ->deployments($repository)
    ->list();

Technically, this code should work, but I think there might be an issue with generated URL for this specific endpoint. Here's the URL that I'm getting in code:

https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/deployments

The thing is, this URL just doesn't work without a trailing slash. I'm getting the following response when I'm trying to make a request in Postman:

GET https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/deployments

{
    "type": "error",
    "error": {
        "message": "Resource not found",
        "detail": "There is no API hosted at this URL.\n\nFor information about our API's, please refer to the documentation at: https://developer.atlassian.com/bitbucket/api/2/reference/"
    }
}

... and the same URL but with a trailing slash:

GET https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/deployments/

{
    "page": 1,
    "values": [
        {
            "type": "deployment",
            "deployable": {
                "type": "deployment_release",
                "uuid": "<>",
                "pipeline": {
                    "uuid": "<>",
                    "type": "pipeline"
                },
    ...

I guess we need a fix :)

@GrahamCampbell
Copy link
Owner

Thanks for getting in touch, though this isn't an issue with this specific package. This package is just a Laravel wrapper. The best course of action here would be for you to submit a fix upstream to https://github.com/BitbucketPHP/Client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants