Create alerts through alert provisioning api

Hello, I am trying to create alerts through the api.

  • What Grafana version and what operating system are you using?
    Grafana v9.1.6 on linux / grafana docker image

  • What are you trying to achieve?
    I am trying to create that are working alerts.

  • How are you trying to achieve it?
    I am using the ```
    /api/v1/provisioning/alert-rules


* What happened?
The alerts are created, but not working.

* What did you **expect** to happen?
I expect to create an alert that works.

* Can you copy/paste the configuration(s) that you are having problems with?

{
orgID: 1,
folderUID: ‘<fodler_uid>’,
ruleGroup: ‘<rule_group>’,
title: ‘<alert_name>/23d26014-6ba5-4b93-8e71-e171d452a8f2’,
condition: ‘C’,
noDataState: ‘NoData’,
execErrState: ‘Error’,
data: [
{
refId: ‘A’,
queryType: ‘’,
relativeTimeRange: { from: 300, to: 0 },
datasourceUid: ‘<datasource_id>’,
model: {
expr: ‘sum by(instance) ({job=“<environment_name>”})’,
hide: false,
intervalMs: 1000,
maxDataPoints: 43200,
refId: ‘A’
}
},
{
refId: ‘B’,
queryType: ‘’,
relativeTimeRange: { from: 0, to: 0 },
datasourceUid: ‘-100’,
model: {
conditions: [
{
evaluator: { params: [ 3 ], type: ‘gt’ },
operator: { type: ‘and’ },
query: { params: [ ‘A’ ] },
reducer: { params: , type: ‘last’ },
type: ‘query’
}
],
datasource: { type: ‘expr’, uid: ‘-100’ },
expression: ‘A’,
hide: false,
intervalMs: 1000,
maxDataPoints: 43200,
reducer: ‘last’,
refId: ‘B’,
type: ‘reduce’
}
},
{
refId: ‘C’,
queryType: ‘’,
relativeTimeRange: { from: 0, to: 0 },
datasourceUid: ‘-100’,
model: {
conditions: [
{
evaluator: { params: [ 0, 0 ], type: ‘gt’ },
operator: { type: ‘and’ },
query: { params: [ ‘B’ ] },
reducer: { params: , type: ‘avg’ },
type: ‘query’
}
],
datasource: { name: ‘Expression’, type: ‘expr’, uid: ‘expr’ },
expression: ‘$B > 100’,
intervalMs: 1000,
maxDataPoints: 43200,
refId: ‘C’,
type: ‘math’
}
}
],
for: ‘1m’,
annotations: {
description: ‘’,
severity: ‘Critical’,
alertName: ‘<alert_name>’
},
labels: {
severity: ‘Critical’,
environmentId: ‘<environment_id>’,
metric: ‘{job=“<environment_name>”}’,
alertPredicateId: ‘<alert_predicate_id>’,
alertInformationId: ‘<alert_information_id>’,
eoc: ‘webhook’
}
}


* Did you receive any errors in the Grafana UI or in related logs? If so, please tell us **exactly** what they were.
 In the health column on ui it shows either an error ```failed to execute condition: data source not found``` or ```nodata```

* Did you follow any online instructions? If so, what is the URL?
https://grafana.com/docs/grafana/v9.1/developers/http_api/alerting_provisioning/#create-a-new-alert-rule-routepostalertrule

Thanks in advance.