# Impossible to add device with REST API?

**URL:** <https://community.cumulocity.com/t/impossible-to-add-device-with-rest-api/7851>\
**Category:** Forum\
**Tags:** cumulocity\
**Created:** [March 10, 2023, 3:28pm UTC](https://community.cumulocity.com/t/impossible-to-add-device-with-rest-api/7851 "2023-03-10T15:28:17Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![franck.arrestier](https://avatars.discourse-cdn.com/v4/letter/f/a88e4f/32.png) [@franck.arrestier](https://community.cumulocity.com/u/franck.arrestier)\
**Post date:** [March 10, 2023, 3:28pm UTC](https://community.cumulocity.com/t/impossible-to-add-device-with-rest-api/7851/1 "2023-03-10T15:28:17Z")

</div>

#### What product/components do you use and which version/fix level are you on?

Cumulocity IOT 1015.0.244

#### Is your question related to the free trial, or to a production (customer) instance?

production

#### What are you trying to achieve? Please describe it in detail.

Add a device using REST API (/inventory/managedObjects) with Postman : when I send the POST request, i have a 201 with some informations as name, internal ID but nothing appears in Device list (on Web interface -GUI).

#### Do you get any error messages? Please provide a **full error** message screenshot and log file.

No error from REST api.

#### Have you installed all the latest fixes for the products and systems you are using?

No update.

---

<div class="post-metadata">

**Author:** ![Stefan\_Witschel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/stefan_witschel/32/31955_2.png) [@Stefan\_Witschel](https://community.cumulocity.com/u/Stefan_Witschel)\
**Post date:** [March 10, 2023, 3:39pm UTC](https://community.cumulocity.com/t/impossible-to-add-device-with-rest-api/7851/2 "2023-03-10T15:39:12Z")

</div>

I’m guessing you are not flagging it as a device and the c8y\_IsDevice fragment is missing in the payload?  
Can you share your payload you are sending to confirm this?

---

<div class="post-metadata">

**Author:** ![Philipp\_Emmel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/philipp_emmel/32/19455_2.png) [@Philipp\_Emmel](https://community.cumulocity.com/u/Philipp_Emmel)\
**Post date:** [March 10, 2023, 3:48pm UTC](https://community.cumulocity.com/t/impossible-to-add-device-with-rest-api/7851/3 "2023-03-10T15:48:37Z")

</div>

In order for a managed object to be recognized as device it needs the c8y\_IsDevice fragment. You can learn more about this and other important data in devices here: [Device management library - Cumulocity IoT Guides](https://cumulocity.com/guides/reference/device-management-library/#device-marker)

You can also add an “Accept” header to your POST request, then Cumulocity will return the created object as a response. You can find the documentation about it here: [Cumulocity - OpenAPI](https://cumulocity.com/api/core/#section/REST-implementation/HTTP-usage)

---

<div class="post-metadata">

**Author:** ![franck.arrestier](https://avatars.discourse-cdn.com/v4/letter/f/a88e4f/32.png) [@franck.arrestier](https://community.cumulocity.com/u/franck.arrestier)\
**Post date:** [March 10, 2023, 4:28pm UTC](https://community.cumulocity.com/t/impossible-to-add-device-with-rest-api/7851/4 "2023-03-10T16:28:59Z")

</div>

If I use the example from your documentation :

```auto
{
    "name": "RaspPi BCM2708 0000000017b769d5",
    "type": "c8y_Linux",
    "c8y_IsDevice": {},
    "com_cumulocity_model_Agent": {},
    "c8y_SupportedOperations": ["c8y_Restart", "c8y_Configuration", "c8y_Software", "c8y_Firmware"],
    "c8y_Hardware": {
        "revision": "000e",
        "model": "RaspPi BCM2708",
        "serialNumber": "0000000017b769d5"
    },
    "c8y_Configuration": {
        "config": "#Fri Aug 30 09:13:56 BST 2013\nc8y.log.eventLevel=INFO\n..."
    },
    "c8y_Mobile": {
         "imei": "861145013087177",
        "cellId": "4904-A496",
        "iccid": "89490200000876620613"
    },
    "c8y_Firmware": {
        "name": "raspberrypi-bootloader",
        "version": "1.20130207-1"
    },
    "c8y_Software": {
        "pi-driver": "pi-driver-3.4.5.jar",
        "pi4j-gpio-extension": "pi4j-gpio-extension-0.0.5.jar"
   
    }
}

```

Then the response with 201 status is :

```auto
{
    "additionParents": {
        "references": [],
        "self": "https://<<domain>>/inventory/managedObjects/164688/additionParents"
    },
    "owner": "<<user>>",
    "childDevices": {
        "references": [],
        "self": "https://<<domain>>/inventory/managedObjects/164688/childDevices"
    },
    "childAssets": {
        "references": [],
        "self": "https://<<domain>>/inventory/managedObjects/164688/childAssets"
    },
    "creationTime": "2023-03-10T16:24:15.349Z",
    "type": "c8y_Linux",
    "lastUpdated": "2023-03-10T16:24:15.349Z",
    "childAdditions": {
        "references": [],
        "self": "https://<<domain>>/inventory/managedObjects/164688/childAdditions"
    },
    "name": "RaspPi BCM2708 0000000017b769d5",
    "deviceParents": {
        "references": [],
        "self": "https://<<domain>>/inventory/managedObjects/164688/deviceParents"
    },
    "assetParents": {
        "references": [],
        "self": "https://<<domain>>/inventory/managedObjects/164688/assetParents"
    },
    "self": "https://<<domain>>/inventory/managedObjects/164688",
    "id": "164688",
    "c8y_Firmware": {
        "name": "raspberrypi-bootloader",
        "version": "1.20130207-1"
    },
    "c8y_Mobile": {
        "iccid": "89490200000876620613",
        "imei": "861145013087177",
        "cellId": "4904-A496"
    },
    "c8y_Software": {
        "pi4j-gpio-extension": "pi4j-gpio-extension-0.0.5.jar",
        "pi-driver": "pi-driver-3.4.5.jar"
    },
    "com_cumulocity_model_Agent": {},
    "c8y_IsDevice": {},
    "c8y_Configuration": {
        "config": "#Fri Aug 30 09:13:56 BST 2013\nc8y.log.eventLevel=INFO\n..."
    },
    "c8y_SupportedOperations": [
        "c8y_Restart",
        "c8y_Configuration",
        "c8y_Software",
        "c8y_Firmware"
    ],
    "c8y_Hardware": {
        "serialNumber": "0000000017b769d5",
        "model": "RaspPi BCM2708",
        "revision": "000e"
    }
}

```

---

<div class="post-metadata">

**Author:** ![Robert\_Neale](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/robert_neale/32/31965_2.png) [@Robert\_Neale](https://community.cumulocity.com/u/Robert_Neale)\
**Post date:** [March 10, 2023, 4:42pm UTC](https://community.cumulocity.com/t/impossible-to-add-device-with-rest-api/7851/5 "2023-03-10T16:42:11Z")

</div>

Which tenant?

Can you display device with id 164688 in the UI (pick an existing device and replace its idin the url with 164688)?

---

<div class="post-metadata">

**Author:** ![Korbinian\_Butz](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/korbinian_butz/32/10473_2.png) [@Korbinian\_Butz](https://community.cumulocity.com/u/Korbinian_Butz)\
**Post date:** [March 10, 2023, 4:49pm UTC](https://community.cumulocity.com/t/impossible-to-add-device-with-rest-api/7851/6 "2023-03-10T16:49:19Z")

</div>

Is there a filter active on your Device-List? (referring to the list shown in Device Management \> Devices \> All Devices)

---

<div class="post-metadata">

**Author:** ![franck.arrestier](https://avatars.discourse-cdn.com/v4/letter/f/a88e4f/32.png) [@franck.arrestier](https://community.cumulocity.com/u/franck.arrestier)\
**Post date:** [March 13, 2023, 8:20am UTC](https://community.cumulocity.com/t/impossible-to-add-device-with-rest-api/7851/7 "2023-03-13T08:20:36Z")

</div>

I tried but I have an error.

 ![c8y_bug](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/b/1/b121f907e267c8264884a34ae448f6fcaec44ff7.png)

I just have 10 devices. Even after rebooting, problem is still present.

---

<div class="post-metadata">

**Author:** ![franck.arrestier](https://avatars.discourse-cdn.com/v4/letter/f/a88e4f/32.png) [@franck.arrestier](https://community.cumulocity.com/u/franck.arrestier)\
**Post date:** [March 13, 2023, 8:26am UTC](https://community.cumulocity.com/t/impossible-to-add-device-with-rest-api/7851/8 "2023-03-13T08:26:19Z")

</div>

yes, thanks. But I have no filter.

---

<div class="post-metadata">

**Author:** ![Tristan\_Bastian](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/tristan_bastian/32/18259_2.png) [@Tristan\_Bastian](https://community.cumulocity.com/u/Tristan_Bastian)\
**Post date:** [March 13, 2023, 8:53am UTC](https://community.cumulocity.com/t/impossible-to-add-device-with-rest-api/7851/9 "2023-03-13T08:53:48Z")

</div>

Can you check that the `X-Cumulocity-Processing-Mode` header is not set within your POST request? see: [Cumulocity - OpenAPI](https://cumulocity.com/api/core/#processing-mode)  
Can you also check if you are able to retrieve the device via Postman? So a GET to `/inventory/managedObjects/164688`.

---

<div class="post-metadata">

**Author:** ![Stefan\_Witschel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/stefan_witschel/32/31955_2.png) [@Stefan\_Witschel](https://community.cumulocity.com/u/Stefan_Witschel)\
**Post date:** [March 13, 2023, 8:55am UTC](https://community.cumulocity.com/t/impossible-to-add-device-with-rest-api/7851/10 "2023-03-13T08:55:09Z")

</div>

Also make sure to check your credentials especially the tenant when doing the REST request.  
I could also be that you creating the devices in a different tenant as you expect because of the credentials.

---

<div class="post-metadata">

**Author:** ![franck.arrestier](https://avatars.discourse-cdn.com/v4/letter/f/a88e4f/32.png) [@franck.arrestier](https://community.cumulocity.com/u/franck.arrestier)\
**Post date:** [March 13, 2023, 11:03am UTC](https://community.cumulocity.com/t/impossible-to-add-device-with-rest-api/7851/11 "2023-03-13T11:03:07Z")

</div>

Thanks for your support : X-Cumulocity-Processing-Mode was “TRANSIENT”. When I remove it, it’s working fine.

I was using your definition ( OpenAPI Specification) to import into Postman. The problem is that the request POST comes with X-Cumulocity-Processing-Mode:TRANSIENT.

---

<div class="post-metadata">

**Author:** ![Harald\_Meyer](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/harald_meyer/32/1959_2.png) [@Harald\_Meyer](https://community.cumulocity.com/u/Harald_Meyer)\
**Post date:** [March 13, 2023, 11:51am UTC](https://community.cumulocity.com/t/impossible-to-add-device-with-rest-api/7851/12 "2023-03-13T11:51:37Z")

</div>

Maybe @Philipp_Emmel can comment on the reason to support TRANSIENT for managed objects.

The problem you are facing seems to be at least partially a Postman problem. In the OpenAPI specification, PERSISTENT is the default value and TRANSIENT is the example value. It seems like Postman uses the latter when you import a OpenAPI specification. I have suggested internally that we change the example value to PERSISTENT as well to avoid similar confusion.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/system/32/31990_2.png) [@system](https://community.cumulocity.com/u/system)\
**Post date:** [September 9, 2023, 11:52am UTC](https://community.cumulocity.com/t/impossible-to-add-device-with-rest-api/7851/13 "2023-09-09T11:52:22Z")

</div>

Closed on September 9, 2023, 11:52am UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
