This commit is contained in:
Arthur
2026-03-31 12:00:22 -07:00
parent 3284c83597
commit b45fc8835f
3 changed files with 5 additions and 5 deletions

View File

@@ -386,14 +386,14 @@ A complete date & time. Returns a `datetime.datetime` object.
## Uploading Scripts via the API
Script modules can be uploaded to NetBox via the REST API by sending a `multipart/form-data` POST request to `/api/extras/script-modules/`. The caller must have the `extras.add_scriptmodule` and `core.add_managedfile` permissions.
Script modules can be uploaded to NetBox via the REST API by sending a `multipart/form-data` POST request to `/api/extras/script-upload/`. The caller must have the `extras.add_scriptmodule` and `core.add_managedfile` permissions.
```no-highlight
curl -X POST \
-H "Authorization: Token $TOKEN" \
-H "Accept: application/json; indent=4" \
-F "upload_file=@/path/to/myscript.py" \
http://netbox/api/extras/script-modules/
http://netbox/api/extras/script-upload/
```
Alternatively, a script module can be linked to an existing data source and data file instead of uploading a file directly:
@@ -403,7 +403,7 @@ curl -X POST \
-H "Authorization: Token $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json; indent=4" \
http://netbox/api/extras/script-modules/ \
http://netbox/api/extras/script-upload/ \
--data '{"data_source": 1, "data_file": 42}'
```