Skip to content

app_label and model on API POST custom-object-type-fields is redundant #224

@LDTips

Description

@LDTips

Plugin Version

0.3.1

NetBox Version

4.4.0

Python Version

3.12.3

Steps to Reproduce

API endpoint POST custom-object-type-fields requires model and app_label, despite at the same time requiring related_object_type which is an ID. model and app_label can be instead determined by the related_object_type, based on DB table django_content_type. I believe this is how it's done for other endpoints.

custom_object_field_relational = {
    'custom_object_type': custom_obj1_id,
    'name': 'related_obj2',
    'label': 'Related Obj 2',
    'type': 'object',
    'primary': False,
    'related_object_type': custom_obj2_id,
    # Paremeters below should not be needed, as they can be determined by 'related_object_type'
    'app_label': 'netbox_custom_objects',
    'model': f'table{custom_obj1_id}model',
}

To reproduce:

  1. Create Custom Object1
  2. Create Custom Object2
  3. Try creating via API a field for Custom Object1 that related to Custom Object2

Expected Behavior

Expected behavior:
API call does not need app_label and model

Observed Behavior

Observed behavior:
app_label and model need to be passed in the call

Metadata

Metadata

Assignees

No one assigned

    Labels

    severity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: needs ownertype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions