Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Cloud Messaging HTTP Error 400: Bad Request
    primarykey
    data
    text
    <p>I am trying to send a message through GCM (Google Cloud Messaging). I have registered through Google APIs, I can send a regID to my website (which is a Google App Engine Backend) from multiple Android test phones. However, I can't send anything to GCM from Google App Engine. Here is what I am trying to use.</p> <pre><code> regId = "APA91b..." json_data = {"collapse_key" : "Food-Promo", "data" : { "Category" : "FOOD", "Type": "VEG", }, "registration_ids": [regId], } url = 'https://android.googleapis.com/gcm/send' apiKey = "AI..." myKey = "key=" + apiKey headers = {'Content-Type': 'application/json', 'Authorization': myKey} data = urllib.urlencode(json_data) data2 = {"title": title} data3 = urllib.urlencode(data2) req = urllib2.Request(url, data, headers) f = urllib2.urlopen(req) response = f.read() f.close() logging.debug("***!!!!!!!WriteEntry TEST ----- Response: " + response) </code></pre> <p>And here is the error that I am receiving.</p> <pre><code>Traceback (most recent call last): File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 703, in __call__ handler.post(*groups) File "/base/data/home/apps/s~journaltestza/26.360625174851783344/main.py", line 213, in post f = urllib2.urlopen(req) File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 124, in urlopen return _opener.open(url, data) File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 387, in open response = meth(req, response) File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 498, in http_response 'http', request, response, code, msg, hdrs) File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 425, in error return self._call_chain(*args) File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 360, in _call_chain result = func(*args) File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 506, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) HTTPError: HTTP Error 400: Bad Request </code></pre> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload