无法使用 REST API 发送 FCM 推送通知

Failed to send the FCM push notification using the REST API

Post请求:

URL:

https://fcm.googleapis.com/fcm/send

Headers:

Content-Type: application/json
Authorization: key=AAAAAsmF578:APA91b...90f

Body:

{
    "to": "fCF...ZFK", 
    "notification": {
        "title": "Foo",
        "body": "Bar"
    }
}


回复:

但是,如果我使用 Firebase Notification Composer 在我的 Android 设备上使用相同的 FCM 令牌发送通知 fCF...ZFK,我确实会收到通知。我在 Postman 那里做错了什么?我已经在 SO 上尝试了几个与此相关的答案,但没有得到任何有用的答案。

您的 URL 中有一个 Line Feed (LF) 字符(URL 编码后的 %0A)无效 API URL。这可能是在从文档或其他来源复制时添加的。

URL 应该是 /fcm/send 而不是 /fcm/send%0A