netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
16.03k stars 2.57k forks source link

API urls has changed #17610

Closed n-rodriguez closed 3 weeks ago

n-rodriguez commented 3 weeks ago

Deployment Type

Self-hosted

NetBox Version

v4.1.1

Python Version

3.11

Steps to Reproduce

Hello!

I'm using netbox-client-ruby to call Netbox API and it seems that collections urls have changed in Netbox v4.1.

Previously the urls called was api/virtualization/virtual-machines.json but now it throws an error (see below).

Calling api/virtualization/virtual-machines/ work.

It is intentional?

Thank you!

Expected Behavior

No errors should happen

Observed Behavior

<!DOCTYPE html>
<html lang="en">

<head>
    <title>Server Error</title>
    <link rel="stylesheet" href="/static/netbox-light.css" />
    <meta charset="UTF-8">
  </head>

<body>
    <div class="container-fluid">
        <div class="row">
            <div class="col col-md-6 offset-md-3">
                <div class="card border-danger mt-5">
                    <h2 class="card-header">
                        <i class="mdi mdi-alert"></i> Server Error
                    </h2>
                    <div class="card-body">

                            <p>
                                There was a problem with your request. Please contact an administrator.
                            </p>

                        <hr />
                        <p>
                            The complete exception is provided below:
                        </p>
                        <pre class="block"><strong>&lt;class &#x27;django.core.exceptions.ImproperlyConfigured&#x27;&gt;</strong><br />
  Could not resolve URL for hyperlinked relationship using view name &quot;&quot;. You may have failed to include the related model in your API, or incorrectly configured the `lookup_field` attribute on this field.

Python version: 3.11.9
NetBox version: 4.1.1
Plugins: None installed
</pre>
                        <p>
                            If further assistance is required, please post to the <a href="https://github.com/netbox-community/netbox/discussions">NetBox discussion forum</a> on GitHub.
                        </p>
                        <div class="text-end">
                            <a href="/" class="btn btn-primary">Home Page</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
  </body>

</html>
peteeckel commented 3 weeks ago

To be honest ...

Previously the urls called was api/virtualization/virtual-machines.json but now it throws an error (see below).

I absolutely doubt that. At least not as long as I am using NetBox.

Anyway, the ruby integration you are referring to is not managed by the NetBox project, so you should open an issue with them. It's unlikely that anyone here can help you.

n-rodriguez commented 3 weeks ago

I absolutely doubt that.

you should not ;) this is the url declared in netbox-client-ruby and it has always worked until I've migrated to v4.1.

Anyway, the ruby integration you are referring to is not managed by the NetBox project,

I know, but the url is. I just want to know if something has changed on this side. Thank you!

peteeckel commented 3 weeks ago

I don't doubt that it used to work at one point. But AFAIK api/virtualization/virtual-machines.json has never been an official, documented URL schema, so if it worked it was by coincidence.

n-rodriguez commented 3 weeks ago

But AFAIK api/virtualization/virtual-machines.json has never been an official, documented URL schema, so if it worked it was by coincidence.

Thanks for your answer 👍 Now I can make a PR to netbox-client-ruby to upgrade URLs.

Thank you!