1

I tried to use Azure Sphere Public API: Device Group - Delete with Node.js.

But I got error message: Error occurred while deleting deviceGroup --- for tenantId ---. (---: my tenant/device group ID)

But the 'Device Group - Get' method worked well. Below is part of the test code.

  const config = {
    url: `https://prod.core.sphere.azure.net/v2/tenants/${tenantId}/devicegroups/${groupId}`,
    headers: {
      Authorization: `Bearer ${token}`
    },
    method: "DELETE"
  };

  try {
    const resp = await axios(config);
    console.log("resp:", resp);
  } catch (error) {
    console.error(error);
  }

In config, when I change the method to "GET", it works. But when using the "DELETE" method, an error occurred.

Please check this.

inmile
  • 23
  • 5

1 Answers1

0

I noticed that the problem is role type.

To use DELETE method of Azure Sphere Public API, it seems to need an Administrator role.

Before I tested with the Contributor role, so got an error.

enter image description here

with the Admin role, the request is successful.

inmile
  • 23
  • 5
  • It was difficult to determine the cause of the problem because there was only one line of error message when requested. I also can't find this in the official documentation. I hope this improves. – inmile Feb 22 '21 at 06:06