HTTP Error Not Found - Grafana Datasource Testing

On configuring a new datasource over code , datasource gets deployed on my Grafana instance , but datasource testing fails. However , if I use the same url and configure datasource manually datasource testing is successful. It means datasource url is correct and no routing issues.I inferred that datasource url and routing is good but the way Garafana talks to datasource url is different from the way it works in manual configuration. What else could be misising… please suggest.

Im passing these in my code :
type: prometheus
access: proxy
org_id: 1

The issue is fixed , When using AlertManager as your datasource the type shouldn’t be ‘prometheus’. It has to be as below.

type: camptocamp-prometheus-alertmanager-datasource