-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application
Description
Environment
- Python version: 3.6.9
- NetBox version: 2.10.0
Steps to Reproduce
- Make an
OPTIONSrequest to a REST API list endpoint. For example:
curl -X OPTIONS \
-H "Authorization: Token $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json; indent=4" \
http://netbox/api/dcim/devices/
(Note that all REST API endpoints are affected, not just the one above.)
Expected Behavior
The response should return metadata for the endpoint. An example is below.
{
"name": "Device",
"description": "",
"renders": [
"application/json",
"text/html"
],
"parses": [
"application/json",
"application/x-www-form-urlencoded",
"multipart/form-data"
],
"actions": {
"POST": {
...
Observed Behavior
An exception is raised:
Exception Type: AssertionError at /api/dcim/devices/
Exception Value: Expected view DeviceViewSet to be called with a URL keyword argument named "pk". Fix your URL conf, or set the `.lookup_field` attribute on the view correctly.
It appears that the introduction of bulk update support poses a problem when rendering metadata for the endpoint, since the metadata class calls get_object() when evaluating fields for POST and PUT requests.
Metadata
Metadata
Assignees
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application