Search code examples
phpandroidgoogle-cloud-messagingrest-client

How to push notification from rest client for testing purpose


Hi I am trying to push the notification from rest client to android app. I am doing like below -

URL - https://android.googleapis.com/gcm/send
Method - POST
Headers - Authorization: my_server_key

I always get this message

Status Code: 401 Unauthorized Alternate-Protocol: 443:quic,p=0.002 Cache-Control: private, max-age=0

enter image description here

I am not sure what I am missing & last I am using correct server api key.

Please assist & thanks in advance.


Solution

  • I set this values in the header then it is working fine for me.

    Below is the header key & value.

    A) Authorization: & it value likes key=API_KEY

    B) Content-Type: application/json