Hie all ,
I am struck trying to POST a python dictionary as json for creating silence . The following is my data that i am posting to alertmanager silences endpoint:
data ={
"id": id,
"matchers": [
{
"name": matcherName,
"value": matcherValue,
"isRegex": matcherIsRegx
}
],
"startsAt": startsAt,
"endsAt": endsAt,
"createdBy": createdBy,
"comment": comment
}
all the values are variables with datatypes as string except the isRegx which is boolean .
While posting it after creating a json using python requests library as :
payload = json.dumps(data)
I was getting error message as :
"parsing silence body from \"\" failed, because json: cannot unmarshal string into Go value of type struct { ID string \"json:\\\"id,omitempty\\\"\" }
Please help.
Regards