# cqGMA Reference Information API

## Overview

The cqGMA Reference API provides information about:

- Summits
- WWFF references
- Islands
- Lighthouses
- Castles
- Mills
- WCA references
- GMA Islands
- and more

Main API URL:

```text
https://www.cqgma.org/api/ref/?REFERENCE
```

---

# Examples

## Summit

```text
https://www.cqgma.org/api/ref/?DA/NI-099
```

## WWFF

```text
https://www.cqgma.org/api/ref/?DLFF-0125
```

## Island

```text
https://www.cqgma.org/api/ref/?EU-022
```

## Lighthouse

### ILLW

```text
https://www.cqgma.org/api/ref/?DE0136
```

### ARLHS

```text
https://www.cqgma.org/api/ref/?FED 009
```

or

```text
https://www.cqgma.org/api/ref/?FED-009
```

## WCA

```text
https://www.cqgma.org/api/ref/?DL-00319
```

## COTA

```text
https://www.cqgma.org/api/ref/?NBN-047
```

## MOTA (Mills)

```text
https://www.cqgma.org/api/ref/?X53965
```

---

# Program-Specific APIs

## Castles only

```text
https://www.cqgma.org/api/castle/?DL-00136
```

## Islands only

```text
https://www.cqgma.org/api/island/?EU-066
```

## Lighthouses only

```text
https://www.cqgma.org/api/lighthouse/?FED-101
```

## Mills only

```text
https://www.cqgma.org/api/mill/?X53965
```

## Summits only

```text
https://www.cqgma.org/api/summit/?DA/NI-096
```

## WWFF only

```text
https://www.cqgma.org/api/wwff/?DLFF-0126
```

---

# Example Return JSON

```json
{
  "reference": "DLFF-0125",
  "name": "Nature Park TERRA vita",
  "latitude": "52.26815796",
  "longitude": "8.35510254",
  "locator": "JO42EG",
  "reftype": "WWFF"
}
```

---

# Simple PHP Example

```php
<?php

function ref_info($ref)
{
    $url = 'https://www.cqgma.org/api/ref/?' . urlencode($ref);

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_URL, $url);

    $json = curl_exec($ch);

    curl_close($ch);

    return $json;
}

$json = ref_info('DLFF-0125');

$data = json_decode($json, true);

echo $data["name"];

?>
```

---

# Interactive Example

Example dialogue application:

```text
https://www.adventureradio.de/cqgma/reference_info.php
```

---

# Multiple Reference Examples

## COTA

```php
$json = ref_info('NBN-019');
```

## WCA

```php
$json = ref_info('DL-05279');
```

## Summit

```php
$json = ref_info('DM/NS-108');
```

## WWFF

```php
$json = ref_info('DLFF-0125');
```

## IOTA

```php
$json = ref_info('EU-126');
```

## GMA Islands

```php
$json = ref_info('DAI/NI-010');
```

## Mill

```php
$json = ref_info('X29821');
```

## ILLW

```php
$json = ref_info('DE0067');
```

## WLOTA

```php
$json = ref_info('518');
```

---

# ARLHS Special Handling

The API accepts different ARLHS formats:

```text
FED-101
```

```text
FED 101
```

```text
FED+101
```

---

# Summit-only Example

```php
<?php

function summit_info($ref)
{
    $url = 'https://www.cqgma.org/api/summit/?' . urlencode($ref);

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_URL, $url);

    $json = curl_exec($ch);

    curl_close($ch);

    return $json;
}

$json = summit_info('DM/NS-108');

var_dump(json_decode($json, true));

?>
```

---

# Notes

- References are case-insensitive
- URL encoding is recommended
- JSON is UTF-8 encoded
- cURL is recommended for API access
- Spaces in references should be encoded

---

# Contact

CQGMA Website:

```
https://www.cqgma.org
```
Support:

```
support@cqgma.org
```
---

