# Layer

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/layers" method="get" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

## add layer

<mark style="color:green;">`POST`</mark> `https://ushahididocs.api.ushahidi.io/api/v3/layers`

#### Request Body

| Name                 | Type    | Description                                                    |
| -------------------- | ------- | -------------------------------------------------------------- |
| name                 | String  | Layer name                                                     |
| visible\_by\_default | Boolean | Set True to make the layer visible by default and False to not |
| active               | Boolean | Set True for active layer and False for Inactive layer         |
| options              | Array   | Contains an array of layer options                             |
| type                 | String  | Layer type                                                     |
| media                | String  | media                                                          |
| data\_url            | String  | Data source URL                                                |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "id": 4,
    "url": "http://localhost:8000/api/v3/layer/4",
    "name": "test",
    "data_url": "http://services.nationalmap.gov/ArcGIS/services/NEXRAD_Weather/MapServer/WMSServer",
    "media": null,
    "type": "geojson",
    "options": null,
    "active": true,
    "visible_by_default": true,
    "created": "2022-11-02T19:20:43+00:00",
    "updated": null,
    "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
    ]
}
```

{% endtab %}
{% endtabs %}

## edit layer

<mark style="color:orange;">`PUT`</mark> `https://ushahididocs.api.ushahidi.io/api/v3/layers/1`

#### Request Body

| Name                 | Type    | Description                                                    |
| -------------------- | ------- | -------------------------------------------------------------- |
| name                 | String  | Layer name                                                     |
| visible\_by\_default | Boolean | Set True to make the layer visible by default and False to not |
| active               | Boolean | Set True for active layer and False for Inactive layer         |
| options              | Array   | Contains an array of layer options                             |
| type                 | String  | Layer type                                                     |
| media                | String  | media                                                          |
| data\_url            | String  | Data source URL                                                |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "id": 4,
    "url": "http://localhost:8000/api/v3/layer/4",
    "name": "test",
    "data_url": "http://services.nationalmap.gov/ArcGIS/services/NEXRAD_Weather/MapServer/WMSServer",
    "media": null,
    "type": "geojson",
    "options": null,
    "active": true,
    "visible_by_default": true,
    "created": "2022-11-02T19:20:43+00:00",
    "updated": null,
    "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
    ]
}
```

{% endtab %}
{% endtabs %}

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/layers/1" method="get" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/layers/5" method="delete" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}
