Cloud API response to list devices using POST

I’m trying to get a list of devices using a post request. I’ve searched and searched for an answer to this question, I cannot find it. I want to use POST in order to limit visibility and exposure to URL-based tokens with GET.

Why does this GET work?

curl “
{ gives a full list of devices for this token….}

And does this POST fails?

curl -X POST -H “Authorization: Bearer abc123456thisisnotmytoken”

{“ok”:false,“errors”:[“data.deviceID is empty”]}

Hi @craig

I think the answer is because fundementally GET means “read” data and POST means “write” data, which is a convention that not every web-based API adheres to, but Particle does.

Have you tried using the Authorization: Bearer header with the GET method? That should work.


Thanks for the quick reply, bko, it makes perfect sense.

I just tested it, and yes, that does work. Thanks for your help!

BTW, for anyone looking for Server side Java code to do this, the critical bits are:

        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        ....... set timeouts or whatever
        conn.addRequestProperty("Authorization", "Bearer " + token);
1 Like

Thanks for the help!