The REST API documentation is a bit informal. As someone who is not familiar with mailman, and who doesn't know python, they are a bit of a slog.
One day it would be nice to augment the documentation with a formal and complete reference document. Something like this one <https://infosight.hpe.com/InfoSight/media/cms/active/public/pubs_REST_API_Reference_NOS_51x.whz/jun1455055569904.html>. A formal reference manual needs a complete listing of every type of object, all possible operations on each object, and all required and optional parameters.
Since creating a formal document like that is probably out of scope, at a minimum it would be good to specify that boolean values are passed as JSON strings, not JSON booleans.
It might be worth seeing if the code can be enhanced to allow the boolean values to be sent in using JSON booleans as well as JSON strings.
Thanks again for the prompt response!
-- Stephen
On Tue, Jan 18, 2022 at 4:25 PM Mark Sapiro <mark@msapiro.net> wrote:
On 1/18/22 10:53 AM, Stephen Daniel wrote:
2nd follow-up. Apologies for spamming this list.
I went wandering through the code as suggested by the traceback. I discovered that thee "as_boolean" routine is expecting a string argument but getting a boolean argument.
So, If I send the booleans as strings, with values "true" or "false", all is well. This is not what the API documentation suggests I should do. Can someone either fix the documentation or the code?
Those snippets in the documentation are doctests. That code is actually executed by unit testing and passes. In all those snippets, dump_json is passing the second argument as
data
to mailman.testing.documentation.dump_json() which in turn calls mailman.testing.documentation.call_http() which calls mailman.testing.helpers.call_api() which ultimately calls requests.request() with the samedata
argument.So basically, the issue is the difference between how requests.request() handles that
data
dictionary in creating the POST data and whatever you are doing.Possibly we could add some caveat to < https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/docs/documentation.html#documentation-helpers>
or possibly elsewhere. Do you have a suggestion as to what?
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/