# \_save

Creates or modifies a Geofence.

### Parameters

#### data

An array of several aspects of the chosen Geofence:\
name\
max\_lat\
min\_lat\
max\_lng\
min\_lng\
points (radius, type)\
last\_edited\
cdate

#### name

The name assigned to the created/saved Geofence

### Example

This will set the name of a Geofence with the ID of 2 to 'Test', give it a radius of 250 in a circle shape, and center it around Forthill Park in Enniskillen

<pre><code>FM_api(
    'Geofence_save',[
        'data' => '{"id":2,"max_lat":54.347115,"min_lat":54.343517,
        "max_lng":-7.6295705,"min_lng":-7.635742,"points":{"radius":250,
<strong>        "type":"circle"},"name":"Test","meta":[],"last_edited":1679828787,
</strong>        "cdate":1679828658}'
    ]
);
</code></pre>

### Results

#### On Success

```
{"ok":1,"id":2}
```

#### On Failure

If there is no data variable requested or the requested variable is not formatted correctly:

```
{"error":"missing or invalid parameter: data"}
```

If a new name being given to the Geofence is higher than 50 characters

```
{"error":"name too long. max length 50"}
```
