{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/gcm","auth":"required","settings":"","method":"post","params":[{"name":"uuid","type":"string","default":"D867AB3E-36D2-11E4-AEA8-76C9E2E253B6","desc":"The device UUID","required":true,"in":"body","ref":"","_id":"555f9fcfd7777119003acffa"},{"name":"regId","type":"string","default":"","desc":"The registration ID generated by GCM","required":true,"in":"body","ref":"","_id":"555f9fcfd7777119003acff9"},{"name":"pubkey","type":"string","default":"","desc":"Optional public key for message encryption","required":false,"in":"body","ref":"","_id":"557396413e0d672d00e2c7f1"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n\t'status': 'ok'\n}","name":""},{"status":400,"language":"json","code":"{\n  'error': {\n    'message': 'Invalid public key supplied. Please send a DER formatted base64 encoded key.',\n    'id': 8\n  }\n}"}]}},"next":{"description":"","pages":[]},"title":"Registering a device for GCM","type":"endpoint","slug":"registering-a-device-for-gcm","excerpt":"Only enabled when Google Cloud Messaging is enabled on the server","body":"This is only usefull when developing a client for a Google platform. It allows the device to receive notifications through the Google Cloud Messaging (GCM) platform. All messages sent through this platform will instantly be marked as read.\n\nIf a client re-registers their device the old registration will be deleted. There is no need to [delete](doc:removing-a-gcm-registration) the GCM registration manually.\n\nAn optional public key can be sent using the `pubkey` parameter. This parameter is not required and all messages will be sent as plain text if not set. The required format for the `pubkey` parameter is a base64 encoded DER formatted public key. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"import rsa\\nfrom base64 import b64encode\\n\\n(public, private) = rsa.newkeys(512)\\npubkey = b64encode(public.save_pkcs1('DER'))\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]","updates":[],"order":1,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"555f9fcfd7777119003acff8","project":"555f9bf814d68e0d00966587","category":{"sync":{"isSync":false,"url":""},"pages":["555f9fcfd7777119003acff8","555fa01d336c041700a9b832","5581f2958625220d00429ee1"],"title":"GCM","slug":"gcm","order":5,"from_sync":false,"reference":false,"_id":"555f9e9ed7777119003acfee","version":"555f9bf814d68e0d0096658a","project":"555f9bf814d68e0d00966587","__v":3,"createdAt":"2015-05-22T21:24:46.312Z"},"parentDoc":null,"__v":1,"user":"555f9a010758330d000d531a","editedParams":true,"editedParams2":true,"githubsync":"","version":{"version":"1.0","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["555f9bf814d68e0d0096658b","555f9e9ed7777119003acfee","555fa040d7777119003acffd","555fa344d7777119003ad00b","555fa3e6d7777119003ad00f","555fb694336c041700a9b86e","555fb779336c041700a9b86f","555fb86bd7777119003ad039","555fbf1a336c041700a9b87f"],"_id":"555f9bf814d68e0d0096658a","project":"555f9bf814d68e0d00966587","releaseDate":"2015-05-22T21:13:28.470Z","__v":9,"createdAt":"2015-05-22T21:13:28.470Z"},"createdAt":"2015-05-22T21:29:51.493Z"}

postRegistering a device for GCM

Only enabled when Google Cloud Messaging is enabled on the server

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

uuid:
required
stringD867AB3E-36D2-11E4-AEA8-76C9E2E253B6
The device UUID
regId:
required
string
The registration ID generated by GCM
pubkey:
string
Optional public key for message encryption

Result Format


Documentation

This is only usefull when developing a client for a Google platform. It allows the device to receive notifications through the Google Cloud Messaging (GCM) platform. All messages sent through this platform will instantly be marked as read. If a client re-registers their device the old registration will be deleted. There is no need to [delete](doc:removing-a-gcm-registration) the GCM registration manually. An optional public key can be sent using the `pubkey` parameter. This parameter is not required and all messages will be sent as plain text if not set. The required format for the `pubkey` parameter is a base64 encoded DER formatted public key. [block:code] { "codes": [ { "code": "import rsa\nfrom base64 import b64encode\n\n(public, private) = rsa.newkeys(512)\npubkey = b64encode(public.save_pkcs1('DER'))", "language": "python" } ] } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}