# Fetch Current Oncall / Rotated User via API

[Generaete API Key from here](https://docs.pagerly.io/generate-api-key)

### Fetching current user/oncall&#x20;

```

curl --location 'https://api.pagerly.io/pagerly/o/currentusers?teamname=<teamname>' \
--header 'X-APIKEY: <API-KEY>'


Header -> X-APIKEY : Generated API Key
Request param -> teamname -> Your Team's name in Pagerly


Example Request : curl --location 'https://api.pagerly.io/pagerly/o/currentusers?teamname=devops' \
--header 'X-APIKEY: bb04cd53-2ef8-42e0-868b-a8de50884418xxx'

Example Response :

[
    {
        "name": "mansi",
        "email": "mansi@pagerly.io",
        "id": "U04CTTV5Z6G",
        "imageurl": null
    }
]


```

### Fetching current user/oncall for Jira&#x20;

```

curl --location 'https://api.pagerly.io/pagerly/o/currentusersforjira?teamname=<teamname>' \
--header 'X-APIKEY: <API-KEY>'


Header -> X-APIKEY : Generated API Key
Request param -> teamname -> Your Team's name in Pagerly


Example Request : curl --location 'https://api.pagerly.io/pagerly/o/currentusersforjira?teamname=devops' \
--header 'X-APIKEY: bb04cd53-2ef8-42e0-868b-a8de50884418xxx'

Example Response :

{
    "accountId": "63c18e6494d18cbf677351fa"
}
```

How to use this in Jira Automation to automatically assign a ticket to oncall / user ??

Automatically Assign Oncall to Jira Tickets using Jira Automation

**On any automation or any new automation , use the following steps**

1\. Click "Add component"

![](https://ajeuwbhvhr.cloudimg.io/https://colony-recorder.s3.amazonaws.com/files/2025-07-11/d4c8b76b-c834-4056-887b-7f6978700e0b/ascreenshot.jpeg?tl_px=0,91\&br_px=2266,1358\&force_format=jpeg\&q=100\&width=1120.0\&wat=1\&wat_opacity=0.7\&wat_gravity=northwest\&wat_url=https://colony-recorder.s3.us-west-1.amazonaws.com/images/watermarks/FB923C_standard.png\&wat_pad=504,277)

2\. Click "Actions will execute when your rule runs successfully."

![](https://ajeuwbhvhr.cloudimg.io/https://colony-recorder.s3.amazonaws.com/files/2025-07-11/6ef0609d-4fd6-4662-af97-c57d4c2e3d3d/ascreenshot.jpeg?tl_px=0,0\&br_px=2266,1266\&force_format=jpeg\&q=100\&width=1120.0\&wat=1\&wat_opacity=0.7\&wat_gravity=northwest\&wat_url=https://colony-recorder.s3.us-west-1.amazonaws.com/images/watermarks/FB923C_standard.png\&wat_pad=777,275)

3\. Click "Send web request"

![](https://ajeuwbhvhr.cloudimg.io/https://colony-recorder.s3.amazonaws.com/files/2025-07-11/d96f8622-5cfe-4757-85d1-cf7f8e760494/ascreenshot.jpeg?tl_px=0,379\&br_px=2266,1646\&force_format=jpeg\&q=100\&width=1120.0\&wat=1\&wat_opacity=0.7\&wat_gravity=northwest\&wat_url=https://colony-recorder.s3.us-west-1.amazonaws.com/images/watermarks/FB923C_standard.png\&wat_pad=818,306)

4\. Click the "Web request URL\* (required)" field.

![](https://ajeuwbhvhr.cloudimg.io/https://colony-recorder.s3.amazonaws.com/files/2025-07-11/031c58ae-6297-465d-9c0d-b61966c8301a/ascreenshot.jpeg?tl_px=0,105\&br_px=2266,1372\&force_format=jpeg\&q=100\&width=1120.0\&wat=1\&wat_opacity=0.7\&wat_gravity=northwest\&wat_url=https://colony-recorder.s3.us-west-1.amazonaws.com/images/watermarks/FB923C_standard.png\&wat_pad=772,277)

5\. `Enter`[`https://api.pagerly.io/pagerly/o/currentusersforjira?teamname=<teamname>`](https://api.pagerly.io/pagerly/o/currentusersforjira?teamname=) `in web request url .` \
`Replace your <teamname> in the URL. HTTP method would be GET.` \
`Body would be empty`

![](https://ajeuwbhvhr.cloudimg.io/https://colony-recorder.s3.amazonaws.com/files/2025-07-11/176b9ba1-e387-4c2a-888c-4fd0032d0318/ascreenshot.jpeg?tl_px=0,0\&br_px=2266,1646\&force_format=jpeg\&q=100\&width=1120.0)

{% hint style="warning" %}
`Alert: Alert! Make sure to check Delay Execution of subsequent ..`
{% endhint %}

6\. Enter your header "X-APIKEY" and value would be your API-KEY

![](https://ajeuwbhvhr.cloudimg.io/https://colony-recorder.s3.amazonaws.com/files/2025-07-11/4fe80a77-f07b-42d9-a691-bf8f379cd7e6/ascreenshot.jpeg?tl_px=0,0\&br_px=2266,1646\&force_format=jpeg\&q=100\&width=1120.0)

7\. Click "Add component"

![](https://ajeuwbhvhr.cloudimg.io/https://colony-recorder.s3.amazonaws.com/files/2025-07-11/23695038-0b9c-41b9-a06c-650b1063d30f/ascreenshot.jpeg?tl_px=0,373\&br_px=2266,1640\&force_format=jpeg\&q=100\&width=1120.0\&wat=1\&wat_opacity=0.7\&wat_gravity=northwest\&wat_url=https://colony-recorder.s3.us-west-1.amazonaws.com/images/watermarks/FB923C_standard.png\&wat_pad=479,277)

8\. Click "Actions will execute when your rule runs successfully."

![](https://ajeuwbhvhr.cloudimg.io/https://colony-recorder.s3.amazonaws.com/files/2025-07-11/d9623702-5af6-4051-8587-86785188eec9/ascreenshot.jpeg?tl_px=0,5\&br_px=2266,1272\&force_format=jpeg\&q=100\&width=1120.0\&wat=1\&wat_opacity=0.7\&wat_gravity=northwest\&wat_url=https://colony-recorder.s3.us-west-1.amazonaws.com/images/watermarks/FB923C_standard.png\&wat_pad=777,277)

9\. Click "Assign work item"

![](https://ajeuwbhvhr.cloudimg.io/https://colony-recorder.s3.amazonaws.com/files/2025-07-11/0d59b795-6139-468b-b27b-85f58d27816d/ascreenshot.jpeg?tl_px=0,379\&br_px=2266,1646\&force_format=jpeg\&q=100\&width=1120.0\&wat=1\&wat_opacity=0.7\&wat_gravity=northwest\&wat_url=https://colony-recorder.s3.us-west-1.amazonaws.com/images/watermarks/FB923C_standard.png\&wat_pad=783,422)

10\. Click "Smart value"

![](https://ajeuwbhvhr.cloudimg.io/https://colony-recorder.s3.amazonaws.com/files/2025-07-11/a81d0e05-3db1-4e66-a5c6-d2cc23fde83d/ascreenshot.jpeg?tl_px=0,379\&br_px=2266,1646\&force_format=jpeg\&q=100\&width=1120.0\&wat=1\&wat_opacity=0.7\&wat_gravity=northwest\&wat_url=https://colony-recorder.s3.us-west-1.amazonaws.com/images/watermarks/FB923C_standard.png\&wat_pad=798,430)

11\. Under user add `"[[webhookResponse.body.accountId]]`

![](https://ajeuwbhvhr.cloudimg.io/https://colony-recorder.s3.amazonaws.com/files/2025-07-11/c1b3b158-0b58-45f4-b5d6-7957265f5925/ascreenshot.jpeg?tl_px=0,379\&br_px=2266,1646\&force_format=jpeg\&q=100\&width=1120.0\&wat=1\&wat_opacity=0.7\&wat_gravity=northwest\&wat_url=https://colony-recorder.s3.us-west-1.amazonaws.com/images/watermarks/FB923C_standard.png\&wat_pad=919,302)
