I started writing an Java FCM appserver and am trying to send messages using the raw HTTP v1 API. My POSTs are summarily rejected with a 400 error (you client has issued a malformed or illegal request, that's all we know). The error suggests some payload formatting problem. I think I got the authtoken right, and the Google API's enabled because I got different HTTP statuses when I didn't.
I have tried sending both through code and using curl, with the same outcome. The examples in the FCM send documentation have two different JSON layouts, one with and one without the "message" wrapper, so I'm not sure which one is correct. My payload, in it's simplest form, looks something like this:
{"message":{"token":"bk...3P1","data":{"command":"REPORT"}}}
Has anybody gotten this type of error from the FCM server and resolved it?