{"__v":1,"_id":"555f9fcfd7777119003acff8","category":{"__v":3,"_id":"555f9e9ed7777119003acfee","pages":["555f9fcfd7777119003acff8","555fa01d336c041700a9b832","5581f2958625220d00429ee1"],"project":"555f9bf814d68e0d00966587","version":"555f9bf814d68e0d0096658a","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-05-22T21:24:46.312Z","from_sync":false,"order":5,"slug":"gcm","title":"GCM"},"editedParams":true,"editedParams2":true,"parentDoc":null,"project":"555f9bf814d68e0d00966587","user":"555f9a010758330d000d531a","version":{"__v":9,"_id":"555f9bf814d68e0d0096658a","project":"555f9bf814d68e0d00966587","createdAt":"2015-05-22T21:13:28.470Z","releaseDate":"2015-05-22T21:13:28.470Z","categories":["555f9bf814d68e0d0096658b","555f9e9ed7777119003acfee","555fa040d7777119003acffd","555fa344d7777119003ad00b","555fa3e6d7777119003ad00f","555fb694336c041700a9b86e","555fb779336c041700a9b86f","555fb86bd7777119003ad039","555fbf1a336c041700a9b87f"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-05-22T21:29:51.493Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"method":"post","results":{"codes":[{"name":"","code":"{\n\t'status': 'ok'\n}","language":"json","status":200},{"code":"{\n  'error': {\n    'message': 'Invalid public key supplied. Please send a DER formatted base64 encoded key.',\n    'id': 8\n  }\n}","language":"json","status":400}]},"settings":"","auth":"required","params":[{"_id":"555f9fcfd7777119003acffa","ref":"","in":"body","required":true,"desc":"The device UUID","default":"D867AB3E-36D2-11E4-AEA8-76C9E2E253B6","type":"string","name":"uuid"},{"_id":"555f9fcfd7777119003acff9","ref":"","in":"body","required":true,"desc":"The registration ID generated by GCM","default":"","type":"string","name":"regId"},{"_id":"557396413e0d672d00e2c7f1","ref":"","in":"body","required":false,"desc":"Optional public key for message encryption","default":"","type":"string","name":"pubkey"}],"url":"/gcm"},"isReference":false,"order":1,"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]","excerpt":"Only enabled when Google Cloud Messaging is enabled on the server","slug":"registering-a-device-for-gcm","type":"endpoint","title":"Registering a device for GCM"}

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 }}