Marcus, it’s unclear from the link you have shared how to create alerts. At least, I could not find anything which talks about alerts. Can you elaborate?
If you use Grafana’s graphical interface you can create dashboards. Each dashboard can hold X number of panels. If you have a panel in edit mode there is a tab called Alerts where you configure rules of your alert, see alerting documentation. After you’ve added your alerts to panels they’re now included in the dashboard json model. When you saves the dashboard the dashboard json model will be persisted to the database. This is also were the alerts are extracted from the dashboard json model and actual alerts are persisted (different database table) - first after this step you’ll see your alerts on the Alert Rules page in Grafana.
So to elaborate on using the api for creating alerts you’ll need a proper dashboard json model and send it in to the create/update dashboard endpoint referenced above. The easiest way of getting the dashboard json model is to navigate to a dashboard -> Settings -> View json and/or fetching the dashboard from the api using a HTTP GET. You can then use this dashboard json model to make updates to the dashboard and the alerts using the create/update dashboard endpoint.
We’re lacking some documentation about how the actual json representation of alert rules are represented in dashboards, but the easiest to get to know this would be to show the json of a dashboard having alerts defined.