How to know the URLs for CURL while getting or modifying the data of mailman 3

Hi team,
Somehow, I have enabled the REST API of mailman 3 accessible
from another machine. I am able to see some data using the command cURL and by providing the REST API credentials.
But I don't know the URLs to be used for the purpose I want to
do some thing like I want to add user to list or remove a user from the list. These activities I can do it from the browser and also from the python prompt (>>>) but how to do the same activities through the curl command.
As of now, if I want to see the lists or domains on Mailman 3
through cURL I am running the below commands
*1. curl -GET -u <username>:<password> http://<MM3 Server IP>:8001/3.1/domains | python -mjson.tool* *2. curl -GET -u * *<username>:<password>* *http://**<MM3 Server IP>**:8001/3.1/lists | python -mjson.tool*
But further to this, I don't know how to add users to the list,
how to create new lists and many other activities. How can I generate the URLs as required.
-- Thanks & Regards, Shashi Kanth.K 9052671936
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Virus-free. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Thank you for your response Stephen.
Thanks for giving the URL. I think you mean this one right
https://mailman.readthedocs.io/en/latest/src/mailman/rest/docs/rest.html
But that document contains the way to do through the python prompt (>>>)
I want through curl command. I tried from the time of your earlier mail but unable to generate the URLs usable with curl command for different purposes such as subscribing the member to a list or removing a member from a list.
If you still say the above URL is the one which helps me I am unable to find out the logic to generate the URLs for curl from the content written for python prompt
Please help with 2 or more examples with out feeling it as risk.
On Sat, Apr 25, 2020 at 6:39 PM Stephen J. Turnbull < turnbull.stephen.fw@u.tsukuba.ac.jp> wrote:
-- Thanks & Regards, Shashi Kanth.K 9052671936

Shashi,
This whole thread is off-topic for the developers list. This list is for development of Mailman, not for teaching people to use it. Read the whole recommended documentation before you ask busy developers to tutor you in very basic things. There's a mailman-users@mailman3.org list for users to help each other. All of the Mailman developers who might be willing to answer your questions are there as well, but there are also many experienced users, some of whom have experimented with the REST API who will also help. Please reply there for further help. (Reply-To is set.)
That said, there are plenty of URLs in the API documentation. Here's a hint: search for "dump_json". That function takes an URL. You may want https: instead of http: in your URLs, and you may need to change the port from 9001, depending on the configuration of your REST server. Try it with simple GET requests for information first, such as for domains or lists. You can also do these requests with an ordinary web browser, though I don't know what it will do with the JSON-formatted reply.
If you don't have domains and lists configured, I suppose the informational requests will come back as empty JSON objects. It should be safe to make them. You can either use Postorius to bootstrap a few example domains, lists, and users, or (the hard way) figure out how to POST appropriate requests. I don't recommend trying to update the backend DBMS by hand; the schema is quite complicated. I don't know how to use curl to update Mailman's databases. That requires a POST request which I have never done with curl. The POST request needs to be valid JSON.
The more I think about this, the less I think your idea of using curl is worthwhile, because formatting JSON requests by hand is going to be a real annoyance and a great way to mess up your database with spurious information. You're really going to want programmatic support for this. But that's already all available in Python in the Mailman system.
It's up to you, but I feel a responsibility to warn you that using curl is not going to be simpler than learning enough Python to do these things.
Regards,

Stephen,
Thank you for your response. I am sorry for getting confused
between two lists mailman-users and mailman-developers. Developers may be busy and my question may be basic but still there is a space for more politeness at your end to advice me.
Apart from that, you have given a lot much of useful
information which is really and honestly helpful for me to the maximum extent. Now I shall take the help of members of mailman-users only.
@mailman-users@mailman3.org <mailman-users@mailman3.org>,
Team, I have installed Mailman Version 3.3 and running in
production. Our development team developed another application which requires the access of the REST API and do changes over the MM3 DB automatically without manual intervention. That application would be connecting to REST API over http or https protocol
To achieve this I have enabled the REST API to run at all the IP
addresses of my MM3 Server by editing the mailman/src/mailman/config/schema.cfg file. I was able to run few commands like creation of domains, lists, list configuration changes for testing using the CURL (GET, POST, PATCH, DELTE) and got succeeded.
But for every operation I need to write a different URL for CURL
command to work. Out of many operations I require, addition of members to a list and removal of members from a list are most important tasks.
So, I request herewith, from the URL
https://mailman.readthedocs.io/en/latest/src/mailman/rest/docs/rest.html, I could see many URLs but they are executed at python prompt (>>>) only. I require URLs usable at the CURL command. Is there any way I could generate the URLs or any where documented regarding the URLs usable with CURL for the addition and removal of subscribers ?
On Sat, Apr 25, 2020 at 8:04 PM Stephen J. Turnbull < turnbull.stephen.fw@u.tsukuba.ac.jp> wrote:
-- Thanks & Regards, Shashi Kanth.K 9052671936

On 4/25/20 6:16 AM, Shashikanth Komandoor wrote:
Where you see something like, e.g.,
dump_json('http://localhost:9001/3.0/lists')
in the docs, translate that URL into
http://<MM3 ServerIP>:8001/3.0/lists
for your curl command.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

On Sat, Apr 25, 2020, at 9:12 AM, Mark Sapiro wrote:
This is also documented now at
https://mailman.readthedocs.io/en/latest/src/mailman/rest/docs/rest.html#hel...
Hopefully this will be more helpful.
-- thanks, Abhilash Raj (maxking)

Thank you for your response Stephen.
Thanks for giving the URL. I think you mean this one right
https://mailman.readthedocs.io/en/latest/src/mailman/rest/docs/rest.html
But that document contains the way to do through the python prompt (>>>)
I want through curl command. I tried from the time of your earlier mail but unable to generate the URLs usable with curl command for different purposes such as subscribing the member to a list or removing a member from a list.
If you still say the above URL is the one which helps me I am unable to find out the logic to generate the URLs for curl from the content written for python prompt
Please help with 2 or more examples with out feeling it as risk.
On Sat, Apr 25, 2020 at 6:39 PM Stephen J. Turnbull < turnbull.stephen.fw@u.tsukuba.ac.jp> wrote:
-- Thanks & Regards, Shashi Kanth.K 9052671936

Shashi,
This whole thread is off-topic for the developers list. This list is for development of Mailman, not for teaching people to use it. Read the whole recommended documentation before you ask busy developers to tutor you in very basic things. There's a mailman-users@mailman3.org list for users to help each other. All of the Mailman developers who might be willing to answer your questions are there as well, but there are also many experienced users, some of whom have experimented with the REST API who will also help. Please reply there for further help. (Reply-To is set.)
That said, there are plenty of URLs in the API documentation. Here's a hint: search for "dump_json". That function takes an URL. You may want https: instead of http: in your URLs, and you may need to change the port from 9001, depending on the configuration of your REST server. Try it with simple GET requests for information first, such as for domains or lists. You can also do these requests with an ordinary web browser, though I don't know what it will do with the JSON-formatted reply.
If you don't have domains and lists configured, I suppose the informational requests will come back as empty JSON objects. It should be safe to make them. You can either use Postorius to bootstrap a few example domains, lists, and users, or (the hard way) figure out how to POST appropriate requests. I don't recommend trying to update the backend DBMS by hand; the schema is quite complicated. I don't know how to use curl to update Mailman's databases. That requires a POST request which I have never done with curl. The POST request needs to be valid JSON.
The more I think about this, the less I think your idea of using curl is worthwhile, because formatting JSON requests by hand is going to be a real annoyance and a great way to mess up your database with spurious information. You're really going to want programmatic support for this. But that's already all available in Python in the Mailman system.
It's up to you, but I feel a responsibility to warn you that using curl is not going to be simpler than learning enough Python to do these things.
Regards,

Stephen,
Thank you for your response. I am sorry for getting confused
between two lists mailman-users and mailman-developers. Developers may be busy and my question may be basic but still there is a space for more politeness at your end to advice me.
Apart from that, you have given a lot much of useful
information which is really and honestly helpful for me to the maximum extent. Now I shall take the help of members of mailman-users only.
@mailman-users@mailman3.org <mailman-users@mailman3.org>,
Team, I have installed Mailman Version 3.3 and running in
production. Our development team developed another application which requires the access of the REST API and do changes over the MM3 DB automatically without manual intervention. That application would be connecting to REST API over http or https protocol
To achieve this I have enabled the REST API to run at all the IP
addresses of my MM3 Server by editing the mailman/src/mailman/config/schema.cfg file. I was able to run few commands like creation of domains, lists, list configuration changes for testing using the CURL (GET, POST, PATCH, DELTE) and got succeeded.
But for every operation I need to write a different URL for CURL
command to work. Out of many operations I require, addition of members to a list and removal of members from a list are most important tasks.
So, I request herewith, from the URL
https://mailman.readthedocs.io/en/latest/src/mailman/rest/docs/rest.html, I could see many URLs but they are executed at python prompt (>>>) only. I require URLs usable at the CURL command. Is there any way I could generate the URLs or any where documented regarding the URLs usable with CURL for the addition and removal of subscribers ?
On Sat, Apr 25, 2020 at 8:04 PM Stephen J. Turnbull < turnbull.stephen.fw@u.tsukuba.ac.jp> wrote:
-- Thanks & Regards, Shashi Kanth.K 9052671936

On 4/25/20 6:16 AM, Shashikanth Komandoor wrote:
Where you see something like, e.g.,
dump_json('http://localhost:9001/3.0/lists')
in the docs, translate that URL into
http://<MM3 ServerIP>:8001/3.0/lists
for your curl command.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

On Sat, Apr 25, 2020, at 9:12 AM, Mark Sapiro wrote:
This is also documented now at
https://mailman.readthedocs.io/en/latest/src/mailman/rest/docs/rest.html#hel...
Hopefully this will be more helpful.
-- thanks, Abhilash Raj (maxking)
participants (4)
-
Abhilash Raj
-
Mark Sapiro
-
Shashikanth Komandoor
-
Stephen J. Turnbull