cancel
Showing results for 
Search instead for 
Did you mean: 

HTTPPOST Example Android GCM

florian239955_st
Associate II
Posted on March 23, 2015 at 13:57

Hi All,

I'm evaluating the SPWF01, so I want to send an Android GCM HTTP post (json or plain text) - but I've no success.

I tried it with:

AT+S.HTTPPOST=android.googleapis.com,/gcm/send,Content-Type:application/x-www-form-urlencoded;charset=UTF-8&Authorization:key=APIKEY,80

and also with:

AT+S.HTTPPOST=android.googleapis.com,/gcm/send,Content-Type:application/json&Authorization:key=APIKEY,80

I got following answer:

HTTP/1.0 401 Unauthorized

Has anybody an idea or can give me an example how to send the http header via the SPWF AT command?

Best regards,

Flo

#http-post #spwf #gcm
20 REPLIES 20
Posted on July 04, 2016 at 11:38

Format properly HTTP header, and JSON content. Put ''CrLfCrLf'' between header and content, and append ''CrLfCrLf'' after content.

Mind the header fields: http://www.json.org/JSONRequest.html