Has anyone used alert api to create jsm alert with a responder?

I have been trying to create an alert with a responder. Alert gets created on jsm, but no responder is attached. Can I get some help here?

the code I used

curl --request POST \
  --url 'https://api.atlassian.com/jsm/ops/api/{cloudId}/v1/alerts' \
  --user 'email@example.com:<api_token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "message": "The CPU usage on Server XYZ has exceeded 80% for over 5 minutes.",
  "responders": [
    {
      "id": "correct_responder_id",
      "type": "user"
    }
  ],
  "priority": "P4"
}'

https://developer.atlassian.com/cloud/jira/service-desk-ops/rest/v2/api-group-alerts/#api-v1-alerts-post

I have tried hitting the above create api endpoint on local using curl. I am not getting any error, the request is successful and the alert gets created. The only issue i am facing is that the responder is not getting attached to the alert.

Note -
The responder id is correct as I tried creating an alert, got the alert id from request id , and then used the add responder to alert api endpoint to add responder to the alert. This approach worked, but the create alert endpoint didn’t.

Hello @SudeepPaul

Firstly, your profile says you’re an Atlassian staff member, but you’ve posted this question on a public user forum. Were you meaning to post this question inside Atlassian itself?

If not, you haven’t provided any useable information for anyone to be able to assist you, as you’ve not said HOW you are making this API request, what methods or libraries you’re using, what parameters and values you’re using, what responses or errors you got back from the endpoint, what testing you’ve done with your API test tool or what different things you’ve tried so far to solve the problem yourself.

Refer to the How to ask a good question thread to remind yourself of the bare minimum that’s expected.

sorry, was in a hurry to close a ticket. @sunnyape updated the description.

The request structure and method appears to be completely correct, so it seems you’re doing nothing wrong. That endpoint is still experimental and it’s highly likely that the function to add a responder when creating the alert is faulty or the documentation is wrong (essentially the same thing :slight_smile: ).

I don’t have access to a JSM Cloud instance at the moment to test with, so you’ll need ask a few peers to try the same thing and see if they can replicate the problem. If so, log a bug in JAC.

You have a workaround by using the Add Responder to Alert endpoint in the interim

Hello @SudeepPaul

I just got home and ran a test of the JSM Ops Create an Alert endpoint against my personal JSM Cloud instance and the request correctly created the alert and set the Responder at the same time.

  1. Sending the POST request with all the parameters in the body:

  2. The resulting alert in JSM Ops with the Responder set:

So, now that we’ve proven that the API endpoint works as documented, we know you have some other more fundamental problem happening.

There was a mistake in the JSON request body you originally provided that would have made the request invalid, but you’ve since altered your original post and fixed that.

I recommend that you test the same request with an API test tool like Postman, then have a peer at Atlassian double check everything you’re doing.

Have fun.