## FCM - Firebase cloud messaging related endpoints

All the requests associated with the FCM require the presence of the JWT token.
See  [auth_and_requests.md](../auth_and_requests.md) 


## Update FCM token ##

### POST - api/v1/update-firebase-token

Body parameters parameters:
* fcm_token -the token provided by FCM for the user device


##### Response:
```json
{
    "message": "Token atualizado."
}
```


## Subscribe to a FCM topic ##

### POST - api/v1/subscribe-fcm-topic

Body parameters parameters:
* topic - a valid topic name to subscribe to

##### Response:

```json
{
    "fcm_topic": "new_exhibitions"
}
```

## UnsSubscribe from a FCM topic ##

### POST - api/v1/unsubscribe-fcm-topic

Body parameters parameters:
* topic - a valid topic name to subscribe to
* device_id - the device id
##### Response:

```json
{
    "message": "subscrição removida.",
    "data": {
        "fcm_topic": "new_exhibitions",
        "device_id": "sdfsadfasd"
    }
}
```


## List the subscribed topics on all devices ##

### GET - api/v1/cm-topics

##### Response:

```json
{
    "data": {
        "topics": [
            "new_news_item",
            "new_exhibitions"
        ]
    }
}
```