How can I write Prometheus rule and alertmanager config file from a java or spring boot application?

I am working on an application to write Prometheus rules and restart the server. I can write or push metrics data using Prometheus (java) lib.

To get the rules, we can use the following GET API.

http://localhost:9090/api/v1/rules

Is there a POST API to write the rules?