# Get Issue-based Alerts
source: https://developer.mastercard.com/riskrecon-api/documentation/testing/alerting-samples/rcv-iss-alrts-smpl/index.md

Allows you to fetch alerting issues from new scans in your portfolio as per your alert settings or policies.

## Pre-requisites {#pre-requisites}

Refer to the [Retrieve issue-based alerts](https://developer.mastercard.com/riskrecon-api/documentation/use-cases/risk-mgmt-issue-rmdfn/alerting/issue-based-alerting/index.md) use case.

## Request URL for Sandbox environment {#request-url-for-sandbox-environment}

    GET https://api.sandbox.riskrecon.com/v1/alerting/issues

## Request URL for Production environment {#request-url-for-production-environment}

    GET https://api.riskrecon.com/v1/alerting/issues

## Test Cases {#test-cases}

### Test Case: Success - Retrieve issue-based alerts {#test-case-success---retrieve-issue-based-alerts}

**Request**

Here is an example of a request made using a `curl` command.

```bash
curl -X 'GET' \
  'https://api.sandbox.riskrecon.com/v1/alerting/issues?page=1&per_page=20&sort_method=ASC&start_date=2023-07-08&end_date=2023-08-06&priorities%5B%5D=5&sort_attribute=last_seen' \
  -H 'accept: application/json'
  -H 'Authorization: valid_JWT_token'
```

**Response**

get:

```json
{
    "issue_alerts": [
        {
            "analysis_id": "12345",
            "company_name": "Some Company, Inc.",
            "date": "2022-12-05T18:20:17",
            "finding_id": "28f58cb126acdbd06769970c74bbcc57",
            "id": 456,
            "issue": "Missing Security Headers",
            "new": false,
            "priority": 6,
            "risk_structure": "Uncategorized",
            "security_criteria": "web_http_security_headers",
            "security_domain_key": "web_app_security",
            "seen": false,
            "severity": "low"
        }
    ],
    "meta": {
        "current_page": 1,
        "next_page": null,
        "prev_page": null,
        "total_count": 1,
        "total_new": 1,
        "total_pages": 1
    }
}
```

### Test Case: Fail - Incorrect date range {#test-case-fail---incorrect-date-range}

**Request**

Here is an example of a request made with an incorrect date range using a `curl` command.

```bash
curl -X 'GET' \
  'https://api.sandbox.riskrecon.com/v1/alerting/issues?page=1&per_page=20&sort_method=DESC&start_date=2023-07-07&end_date=2023-01-03&priorities[]=5&sort_attribute=last_seen' \
  -H 'accept: application/json' 
  -H 'Authorization: valid_JWT_token'
```

**Response**

HTTP Error response 400

    {
      "Errors": {
        "Error": [
          {
            "Description": "Bad Request",
            "Details": "end_date: must not be greater than 30 days",
            "ReasonCode": "BAD_REQUEST",
            "Recoverable": false,
            "Source": "RISKRECON_API"
          },
          {
            "Description": "Bad Request",
            "Details": "start_date: must not be greater than 30 days",
            "ReasonCode": "BAD_REQUEST",
            "Recoverable": false,
            "Source": "RISKRECON_API"
          }
        ]
      }
    }

### Test Case: Fail - Incorrect Sort Method {#test-case-fail---incorrect-sort-method}

**Request**

Here is an example of a request made with an incorrect sort method using a `curl` command.

```bash
curl -X 'GET' \
  'https://api.sandbox.riskrecon.com/v1/alerting/issues?page=1&per_page=20&sort_method=DESCinding&start_date=2023-07-08&end_date=2023-08-06&priorities[]=5&sort_attribute=priority
  -H 'accept: application/json'
  -H 'Authorization: valid_JWT_token' 
```

**Response**

HTTP Error response 400

```json
{
    "Errors": {
        "Error": [
            {
                "Description": "Bad Request",
                "Details": "sort_method: is invalid",
                "ReasonCode": "BAD_REQUEST",
                "Recoverable": false,
                "Source": "RISKRECON_API"
            }
        ]
    }
}
```

### Test Case: Fail - Incorrect priorities {#test-case-fail---incorrect-priorities}

**Request**

Here is an example of a request made using a `curl` command where the value of priorities is a string instead of an integer.

```bash
curl -X 'GET' \
  'https://api.sandbox.riskrecon.com/v1/alerting/issues?page=1&per_page=20&sort_method=DESC&start_date=2023-09-04&end_date=2023-09-05&priorities[]=ten&sort_attribute=last_seen
  -H 'accept: application/json'
  -H 'Authorization: valid_JWT_token' 
```

**Response**

HTTP Error response 400

```json
{
    "Errors": {
        "Error": [
            {
                "Description": "Bad Request",
                "Details": "priorities: is invalid",
                "ReasonCode": "BAD_REQUEST",
                "Recoverable": false,
                "Source": "RISKRECON_API"
            }
        ]
    }
}
```

