[PR #19826] [MERGED] Closes #19722: Extend the object types REST API endpoint #15730

Closed
opened 2025-12-30 00:23:41 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/19826
Author: @jeremystretch
Created: 7/7/2025
Status: Merged
Merged: 7/9/2025
Merged by: @arthanson

Base: featureHead: 19722-object-types-endpoint


📝 Commits (2)

📊 Changes

2 files changed (+60 additions, -1 deletions)

View changed files

📝 netbox/core/models/contenttypes.py (+28 -0)
📝 netbox/extras/api/serializers_/objecttypes.py (+32 -1)

📄 Description

Closes: #19722

  • Adds several new fields to the serialized representation of an ObjectType:
    • app_name: The human-friendly app name (e.g. "IPAM" instead of "ipam")
    • model_name: The human-friendly model name (e.g. "VRF" instead of "vrf")
    • model_name_plural: The plural form of model_name
    • is_plugin_model: Returns True if the model is delivered via a NetBox plugin
    • rest_api_endpoint: The base REST API endpoint for the model (if available)
    • description: The model's docstring
  • Tweaks the formatting of display slightly for improved readability

Before:

{
    "id": 74,
    "url": "http://netbox:8000/api/extras/object-types/74/",
    "display": "IPAM | VRF",
    "app_label": "ipam",
    "model": "vrf"
}

After:

{
    "id": 74,
    "url": "http://netbox:8000/api/extras/object-types/74/",
    "display": "IPAM > VRF",
    "app_label": "ipam",
    "app_name": "IPAM",
    "model": "vrf",
    "model_name": "VRF",
    "model_name_plural": "VRFs",
    "is_plugin_model": false,
    "rest_api_endpoint": "/api/ipam/vrfs/",
    "description": "A virtual routing and forwarding (VRF) table represents a discrete..."
}

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/19826 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 7/7/2025 **Status:** ✅ Merged **Merged:** 7/9/2025 **Merged by:** [@arthanson](https://github.com/arthanson) **Base:** `feature` ← **Head:** `19722-object-types-endpoint` --- ### 📝 Commits (2) - [`3c8cafe`](https://github.com/netbox-community/netbox/commit/3c8cafe6e0b34256bc3d00d62c4124f18225851b) Closes #19722: Extend the object types REST API endpoint - [`bf90f74`](https://github.com/netbox-community/netbox/commit/bf90f746f23c0cd1153c3c707d99a23005257bc2) Misc cleanup ### 📊 Changes **2 files changed** (+60 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `netbox/core/models/contenttypes.py` (+28 -0) 📝 `netbox/extras/api/serializers_/objecttypes.py` (+32 -1) </details> ### 📄 Description ### Closes: #19722 - Adds several new fields to the serialized representation of an ObjectType: - `app_name`: The human-friendly app name (e.g. "IPAM" instead of "ipam") - `model_name`: The human-friendly model name (e.g. "VRF" instead of "vrf") - `model_name_plural`: The plural form of `model_name` - `is_plugin_model`: Returns True if the model is delivered via a NetBox plugin - `rest_api_endpoint`: The base REST API endpoint for the model (if available) - `description`: The model's docstring - Tweaks the formatting of `display` slightly for improved readability Before: ```json { "id": 74, "url": "http://netbox:8000/api/extras/object-types/74/", "display": "IPAM | VRF", "app_label": "ipam", "model": "vrf" } ``` After: ```json { "id": 74, "url": "http://netbox:8000/api/extras/object-types/74/", "display": "IPAM > VRF", "app_label": "ipam", "app_name": "IPAM", "model": "vrf", "model_name": "VRF", "model_name_plural": "VRFs", "is_plugin_model": false, "rest_api_endpoint": "/api/ipam/vrfs/", "description": "A virtual routing and forwarding (VRF) table represents a discrete..." } ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:23:41 +01:00
adam closed this issue 2025-12-30 00:23:41 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15730