## Retrieve Compound Aggregation

### cURL

```bash
curl --request GET \
  --url https://api.m3ter.com/organizations/{orgId}/compoundaggregations/{id} \
  --header 'Authorization: Bearer <token>'
```

### Python

```python
import requests

url = "https://api.m3ter.com/organizations/{orgId}/compoundaggregations/{id}"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
```

### JavaScript (Fetch)

```javascript
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.m3ter.com/organizations/{orgId}/compoundaggregations/{id}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### PHP

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.m3ter.com/organizations/{orgId}/compoundaggregations/{id}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

### Go

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

url := "https://api.m3ter.com/organizations/{orgId}/compoundaggregations/{id}"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}
```

### Unirest (Java)

```java
HttpResponse<String> response = Unirest.get("https://api.m3ter.com/organizations/{orgId}/compoundaggregations/{id}")
  .header("Authorization", "Bearer <token>")
  .asString();
```

### Ruby

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.m3ter.com/organizations/{orgId}/compoundaggregations/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

### API Response Codes

- 200 - Returns the Compound Aggregation
- 4XX - Client errors
- 5XX - Server errors

### Sample Response Structure

```json
{
  "id": "<string>",
  "version": 123,
  "customFields": {},
  "name": "<string>",
  "quantityPerUnit": 123,
  "unit": "<string>",
  "code": "<string>",
  "segments": [
    {}
  ],
  "accountingProductId": "<string>",
  "calculation": "<string>",
  "productId": "<string>",
  "evaluateNullAggregations": true,
  "dtCreated": "2023-11-07T05:31:56Z",
  "dtLastModified": "2023-11-07T05:31:56Z",
  "createdBy": "<string>",
  "lastModifiedBy": "<string>"
}
```

#### Authorization
- Type: `string`
- Location: `header`
- Required: Yes

### Path Parameters
- `orgId` (string, required): The unique identifier (UUID) for your Organization.
- `id` (string, required): The unique identifier (UUID) of the Compound Aggregation to retrieve.

### Response Properties
- `id` (string, required): The UUID of the entity.
- `version` (integer, required): The version number, incremented by 1 upon update.
- `customFields` (object): User-defined fields for attaching custom data.
- `name` (string): Descriptive name for the Aggregation.
- `quantityPerUnit` (number): Defines how much of a quantity equates to 1 unit.
- `unit` (string): User-defined label for billing.
- `code` (string): Unique short code to identify this Aggregation.
- `segments` (object[]): (Optional) Values for segmented Aggregation.
- `accountingProductId` (string): Optional Product ID for accounting.
- `calculation` (string): Represents the calculation formula.
- `productId` (string): Unique identifier (UUID) of the Product associated.
- `evaluateNullAggregations` (boolean): True/False flag for evaluating calculations.
- `dtCreated` (string, date-time): Creation date/time in ISO-8601 format.
- `dtLastModified` (string, date-time): Last modification date/time in ISO-8601 format.
- `createdBy` (string): UUID of the user who created this aggregation.
- `lastModifiedBy` (string): UUID of the user who last modified this aggregation.
