# Component Waivers REST API

**Note**

All repository reports must be re-evaluated in order to include the most accurate policy waiver information used by this API.

The Component Waivers API focuses on existing policy waivers by component. The waivers can be at any scope (app, org, root org, repository, or all repositories). Waivers are listed for each stage to fully detail all the waivers for an application. Stages can carry duplicate waivers, but this accurately reflects every waiver in which a component is in one stage and not another. For repository waivers the only applicable stage is the proxy stage.

## Requesting Component Waivers

To list the component waivers:

```
GET api/v2/reports/components/waivers
```

A sample request to list the component waivers is done with the following command:

```
curl -u admin:admin123 -X GET http://localhost:8070/api/v2/reports/components/waivers
```

This API currently supports filtering by component format/ecosystem. To retrieve waivers only for components in a particular ecosystem, for example maven, add a "format" query parameter to the URL as follows:

```
GET api/v2/reports/components/waivers?format=maven
```

## Response Description

The server will respond with JSON that groups waivers by application components and repository components. The waived application violations will be listed per stage and include the waiver details. Similarly, the waived repository violations will be listed in the proxy stage and include waiver details.

Here is a brief outline of the response which describes the high-level object composition. For the full response details continue to the Response Sample.

**Response Outline**

```
{
  "applicationWaivers": [
    {
      "application": {},
      "stages": [
        {
          "stageId": "build",
          "componentPolicyViolations": [
            {
              "component": {},
              "waivedPolicyViolations": [
                {
                  "policyWaiver": {
                    "policyWaiverId": "e8f43ba30718456eadad6f0616f4c68e",
                    "comment": "temporary waiver",
                    "isObsolete": false,
                    "createTime": "2019-10-16T20:52:27.659+0000",
                    "expiryTime": "2019-10-23T00:00:00.000+0000",
                    "reasonId": "Not reachable",
                    "policyWaiverReasonId": "policyWaiverReasonId",
                    "scopeOwnerType": "root_organization",
                    "scopeOwnerId": "ROOT_ORGANIZATION_ID",
                    "scopeOwnerName": "Root Organization",
                    "hash": "1249e25aebb15358bedd",
                    "policyId": "775a6e88799040c5bb2dd8f020124d07",
                    "creatorId": "authorizedUser",
                    "creatorName": "Authorized User",
                    "matcherStrategy": "EXACT_COMPONENT",
                    "associatedPackageUrl": "pkg:maven/commons-beanutils/commons-beanutils@1.8.3?type=jar",
                    "componentIdentifier": {
                      "format": "maven",
                      "coordinates": {
                        "artifactId": "commons-beanutils",
                        "extension": "jar",
                        "groupId": "commons-beanutils",
                        "version": "1.8.3"
                      }
                    },
                    "displayName": {
                      "parts": [
                        {
                          "field": "Group",
                          "value": "commons-beanutils"
                        },
                        {
                          "value": " : "
                        },
                        {
                          "field": "Artifact",
                          "value": "commons-beanutils"
                        },
                        {
                          "value": " : "
                        },
                        {
                          "field": "Version",
                          "value": "1.8.3"
                        }
                      ],
                      "name": "commons-beanutils"
                    }
                  }
                }
              ]
            }
          ]
        },
        {
          "stageId": "release",
          "componentPolicyViolations": [
            {
              "component": {},
              "waivedPolicyViolations": [
                {
                  "policyWaiver": {
                    "comment": "The waiver cannot be found.  Please re-evaluate.",
                    "isObsolete": true
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  "repositoryWaivers": [
    {
      "repository": {},
      "stages": [
        {
          "stageId": "proxy",
          "componentPolicyViolations": [
            {
              "component": {},
              "waivedPolicyViolations": [
                {
                  "policyWaiver": {
                    "policyWaiverId": "e8f43ba30718456eadad6f0616f4c68e",
                    "comment": "temporary waiver",
                    "isObsolete": false,
                    "createTime": "2019-10-16T20:52:27.659+0000",
                    "scopeOwnerType": "root_organization",
                    "scopeOwnerId": "ROOT_ORGANIZATION_ID",
                    "scopeOwnerName": "Root Organization",
                    "hash": "1249e25aebb15358bedd",
                    "policyId": "775a6e88799040c5bb2dd8f020124d07",
                    "creatorId": "authorizedUser",
                    "creatorName": "Authorized User",
                    "matcherStrategy": "EXACT_COMPONENT",
                    "associatedPackageUrl": "pkg:maven/commons-beanutils/commons-beanutils@1.8.4?type=jar",
                    "componentIdentifier": {
                      "format": "maven",
                      "coordinates": {
                        "artifactId": "commons-beanutils",
                        "extension": "jar",
                        "groupId": "commons-beanutils",
                        "version": "1.8.4"
                      }
                    },
                    "displayName": {
                      "parts": [
                        {
                          "field": "Group",
                          "value": "commons-beanutils"
                        },
                        {
                          "value": " : "
                        },
                        {
                          "field": "Artifact",
                          "value": "commons-beanutils"
                        },
                        {
                          "value": " : "
                        },
                        {
                          "field": "Version",
                          "value": "1.8.4"
                        }
                      ],
                      "name": "commons-beanutils"
                    }
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}
