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

**URL:** <https://discuss.prometheus.io/t/how-can-i-write-prometheus-rule-and-alertmanager-config-file-from-a-java-or-spring-boot-application/1759>\
**Category:** Prometheus server\
**Created:** [July 17, 2023, 11:33am UTC](https://discuss.prometheus.io/t/how-can-i-write-prometheus-rule-and-alertmanager-config-file-from-a-java-or-spring-boot-application/1759 "2023-07-17T11:33:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahimkhanabdul](https://avatars.discourse-cdn.com/v4/letter/r/3ab097/32.png) [@rahimkhanabdul](https://discuss.prometheus.io/u/rahimkhanabdul)\
**Post date:** [July 17, 2023, 11:33am UTC](https://discuss.prometheus.io/t/how-can-i-write-prometheus-rule-and-alertmanager-config-file-from-a-java-or-spring-boot-application/1759/1 "2023-07-17T11:33:29Z")

</div>

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](http://localhost:9090/api/v1/rules)

Is there a POST API to write the rules?
