# Using API To Claim Device - Always Get Errors: "data.deviceID is empty"?

**URL:** <https://community.particle.io/t/using-api-to-claim-device-always-get-errors-data-deviceid-is-empty/50811>\
**Category:** Troubleshooting\
**Created:** [July 1, 2019, 10:54pm UTC](https://community.particle.io/t/using-api-to-claim-device-always-get-errors-data-deviceid-is-empty/50811 "2019-07-01T22:54:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahonroy](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Mahonroy](https://community.particle.io/u/Mahonroy)\
**Post date:** [July 1, 2019, 10:54pm UTC](https://community.particle.io/t/using-api-to-claim-device-always-get-errors-data-deviceid-is-empty/50811/1 "2019-07-01T22:54:32Z")

</div>

Hello, I am using the API to view specific device ID's, and to claim devic ID's. I can view specific device ID's just fine using this:

> var client = new RestClient("[https://api.particle.io/v1/devices/](https://api.particle.io/v1/devices/)" + \_photonSerialNumber + "?access\_token=" + \_particleAPIToken);  
> var request = new RestRequest(Method.GET);
> 
> request.AddHeader("Accept", "application/json;");  
> request.AddHeader("Content-Type", "application/json;");
> 
> IRestResponse response = client.Execute(request);

This works just fine. However, when I try to claim devices, I always get the error message "data.deviceID is empty":

> var client = new RestClient("[https://api.particle.io/v1/devices?id=](https://api.particle.io/v1/devices?id=)" + \_photonSerialNumber + "&access\_token=" + \_particleAPIToken);  
> var request = new RestRequest(Method.POST);
> 
> request.AddHeader("Accept", "application/json;");  
> request.AddHeader("Content-Type", "application/json;");
> 
> IRestResponse response = client.Execute(request);

Notice the error is references "deviceID" and not "id". So I tried "deviceID" as well. I've tried adding "id"/"deviceID" as parameters in the body, and I get the same error messages. When I put the access\_token in the body instead as a query string I get error that its an invalid access\_token... so the access\_token only works as a query string apparently.

Any idea what might be my problem? Thanks and any help is greatly appreciated!

---

<div class="post-metadata">

**Author:** ![Mahonroy](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Mahonroy](https://community.particle.io/u/Mahonroy)\
**Post date:** [July 2, 2019, 8:48pm UTC](https://community.particle.io/t/using-api-to-claim-device-always-get-errors-data-deviceid-is-empty/50811/2 "2019-07-02T20:48:02Z")

</div>

Checking back in on this. Does anyone have any ideas?

---

<div class="post-metadata">

**Author:** ![mstanley](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/mstanley/32/20170_2.png) [@mstanley](https://community.particle.io/u/mstanley)\
**Post date:** [July 3, 2019, 2:35am UTC](https://community.particle.io/t/using-api-to-claim-device-always-get-errors-data-deviceid-is-empty/50811/3 "2019-07-03T02:35:43Z")

</div>

Hi @Mahonroy,

Sorry to hear you’re having troubles.

I went ahead and just tested this endpoint in cURL with the following command to confirm it’s operating as intended:

```auto
curl -X POST https://api.particle.io/v1/devices \
      -d id=<ID_REMOVED> \
      -d access_token=<TOKEN_REMOVED>

```

To double check, you are providing the device’s ID and not serial number, correct?

It’s also entirely possible there may actually be an issue with your access token. Where is it you are sourcing your access token from?

---

<div class="post-metadata">

**Author:** ![Mahonroy](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Mahonroy](https://community.particle.io/u/Mahonroy)\
**Post date:** [July 3, 2019, 5:04pm UTC](https://community.particle.io/t/using-api-to-claim-device-always-get-errors-data-deviceid-is-empty/50811/4 "2019-07-03T17:04:12Z")

</div>

I got it to work last night. Putting both the id and access\_token in the body, or both in the URL as a query string will not work. However… putting the access\_token in the URL as a query string, and id in the body actually works for some reason. But, vice versa does not work - e.g. id in query string, access\_token in data. Definitely odd. All my other Particle API integrations work, this is the only one that seems to have some issues on the back end?
