[bug] /api/pleroma/notification_settings actually takes URI params instead of JSON body #722
Labels
No labels
approved, awaiting change
bug
configuration
documentation
duplicate
enhancement
extremely low priority
feature request
Fix it yourself
help wanted
invalid
mastodon_api
needs docs
needs tests
not a bug
planned
pleroma_api
privacy
question
static_fe
triage
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: AkkomaGang/akkoma#722
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Your setup
OTP
Extra details
No response
Version
v3.10.4
PostgreSQL version
No response
What were you trying to do?
I'm trying to call the endpoint
/api/pleroma/notification_settings
documented here: https://docs.akkoma.dev/stable/development/API/pleroma_api/#apipleromanotification_settingsSince every calls in that page are taking a JSON body as input i'm sending a put request there with the following body:
What did you expect to happen?
I get success as a response, but the setting is not actually changed.
The notification setting should be updated.
What actually happened?
However, after checking the tests in test/pleroma/web/twitter_api/util_controller_test.exs (line 30) I notice that this endpoint is actually taking URI params instead of a JSON body.
When I call
/api/pleroma/notification_settings?block_from_strangers=true
the setting is indeed changed as requested.Logs
No response
Severity
I cannot use it as easily as I'd like
Have you searched for this issue?
Thanks for reporting this
Note, the page you linked already documents:
Coming from just the doc, the more surprising thing then is JSON bodies working at all ^^`
But yeah, almost all requests accept all three variants equally, URL parameters are usually discouraged and the doc should be updated
And
/api/pleroma/notification_settings
is still contradicting even this currently documented behaviour by solely accepting URL query parameters. The lack of support for form data parameter causes #691 since akkoma-fe performs this request with form parametersI suspect the root cause here is this operations API spec explicitly listing the inputs under
parameter:
and anrequestBody: nil
isntead of using the samerequest_body()
function as most other operations.parameters: [
The
request_body
function builds something accepting any of"application/json", "multipart/form-data", "application/x-www-form-urlencoded"
def request_body(description, schema_ref, opts \\ []) do