github.com/RedHatInsights/insights-results-aggregator@v1.4.1/docs/rest_api.md (about)

     1  ---
     2  layout: page
     3  nav_order: 6
     4  ---
     5  # REST API
     6  
     7  Aggregator service provides information about its REST API schema via endpoint `api/v1/openapi.json`.
     8  OpenAPI 3.0 is used to describe the schema; it can be read by human and consumed by computers.
     9  
    10  For example, if aggregator is started locally, it is possible to read schema based on OpenAPI 3.0
    11  specification by using the following command:
    12  
    13  ```shell
    14  curl localhost:8080/api/v1/openapi.json
    15  ```
    16  
    17  Please note that OpenAPI schema is accessible w/o the need to provide authorization tokens.
    18  
    19  ## Accessing results
    20  
    21  ### Settings for localhost
    22  
    23  ```
    24  export ADDRESS=localhost:8080/api/v1
    25  ```
    26  
    27  ### Basic endpoints
    28  
    29  #### List of clusters associated with the specified organization ID
    30  
    31  ```
    32  /organizations/{orgId}/clusters
    33  ```
    34  
    35  ##### Usage:
    36  
    37  ```
    38  curl -k -v $ADDRESS/organizations/{orgId}/clusters
    39  ```
    40  
    41  #### Report for the given organization and cluster
    42  
    43  ```
    44  /organizations/{orgId}/clusters/{clusterId}/users/{userId}/report
    45  ```
    46  
    47  ##### Usage:
    48  
    49  ```
    50  curl -k -v $ADDRESS/organizations/{orgId}/clusters/{clusterId}/users/{userId}/report
    51  ```
    52  
    53  #### Latest reports for the given list of clusters
    54  
    55  ##### Using `GET` method
    56  
    57  ```
    58  /organizations/{orgId}/clusters/{clusterList}/reports
    59  ```
    60  
    61  ##### Usage:
    62  
    63  ```
    64  curl -k -v $ADDRESS/organizations/{orgId}/clusters/{cluster1}/report
    65  curl -k -v $ADDRESS/organizations/{orgId}/clusters/{cluster1},{cluster2}/report
    66  curl -k -v $ADDRESS/organizations/{orgId}/clusters/{cluster1},{cluster2},{cluster3}/report
    67  ```
    68  
    69  Plase note that the total URL length is limited, usually to 2000 or 2048 characters.
    70  
    71  ##### Using `POST` method
    72  
    73  ```
    74  /organizations/{orgId}/clusters/reports
    75  ```
    76  
    77  ##### Usage:
    78  
    79  ```
    80  curl -k -v $ADDRESS/organizations/{orgId}/clusters/reports -d @cluster_list.json
    81  ```
    82  
    83  ##### Format of the payload:
    84  
    85  ```json
    86  {
    87          "clusters" : [
    88                  "34c3ecc5-624a-49a5-bab8-4fdc5e51a266",
    89                  "74ae54aa-6577-4e80-85e7-697cb646ff37",
    90                  "a7467445-8d6a-43cc-b82c-7007664bdf69",
    91                  "ee7d2bf4-8933-4a3a-8634-3328fe806e08"
    92          ]
    93  }
    94  ```
    95  
    96  #### Latest rule report for the given organization, cluster, user and rule ids
    97  
    98  ```
    99  /organizations/{orgId}/clusters/{clusterId}/users/{userId}/rules/{ruleId}
   100  ```
   101  
   102  #### List of clusters for a given rule selector (plugin_name|error_key) within the specified organization ID
   103  
   104  ```
   105  /rules/{rule_selector}/organizations/{org_id}/users/{user_id}/clusters_detail
   106  ```
   107  
   108  ##### Usage:
   109  
   110  ```
   111  curl -k -v $ADDRESS/rules/{rule_selector}/organizations/{org_id}/users/{user_id}/clusters_detail
   112  ```
   113  
   114  Plase note that user ID is expected, but is only used for improving logging.