Skip to content

Conversation

BenoitKnecht
Copy link
Contributor

Fixes: #591

If the API token is not allowed to POST on a particular endpoint, choices won't be returned in .actions.POST, but we can still get them in .actions.PUT.

This commit falls back to getting choices from .actions.PUT instead of raising an exception when .actions.POST is missing.

@arthanson
Copy link
Collaborator

@BenoitKnecht Can you please add a test case for this?

If the API token is not allowed to POST on a particular endpoint, choices won't
be returned in `.actions.POST`, but we can still get them in `.actions.PUT`.

This commit falls back to getting choices from `.actions.PUT` instead of
raising an exception when `.actions.POST` is missing.

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
Make sure we can get choices from the `PUT` action when the API doesn't
allow `POST`, and that the `POST` data takes precedence over the `PUT`
data.

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
@BenoitKnecht BenoitKnecht force-pushed the get-choices-from-post-or-put branch from dddd5fa to 0f9a463 Compare September 30, 2024 12:18
@BenoitKnecht
Copy link
Contributor Author

@arthanson Sorry for the massive delay, I somehow missed your message.

I've added a couple of unit tests, let me know if that's good enough.

@BenoitKnecht
Copy link
Contributor Author

@arthanson Could you take another look at this PR? I'd really love to get this merged.

@arthanson arthanson merged commit 75a2c4e into netbox-community:master Apr 15, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Choices are not returned when the API token can PUT but not POST on an endpoint
2 participants