Skip to content

Commit a781c5b

Browse files
committed
rest api organizations
1 parent 2fae058 commit a781c5b

File tree

1 file changed

+155
-0
lines changed

1 file changed

+155
-0
lines changed
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
---
2+
title: Use the REST API to manage organizations in Azure IoT Central
3+
description: How to use the IoT Central REST API to manage organizations in an application
4+
author: v-krishnag
5+
ms.author: v-krishnag
6+
ms.date: 03/08/2022
7+
ms.topic: how-to
8+
ms.service: iot-central
9+
services: iot-central
10+
11+
---
12+
13+
# How to use the IoT Central REST API to manage organizations
14+
15+
The IoT Central REST API lets you develop client applications that integrate with IoT Central applications. You can use the REST API to manage organizations in your IoT Central application.
16+
17+
Every IoT Central REST API call requires an authorization header. To learn more, see [How to authenticate and authorize IoT Central REST API calls](howto-authorize-rest-api.md).
18+
19+
For the reference documentation for the IoT Central REST API, see [Azure IoT Central REST API reference](/rest/api/iotcentral/).
20+
21+
## Organizations REST API
22+
23+
The IoT Central REST API lets you:
24+
25+
* Add a organization to your application
26+
* Get a organization by ID
27+
* Update a organization in your application
28+
* Get a list of the organizations in the application
29+
* Delete a organization in your application
30+
31+
### Create Organizations
32+
33+
The REST API lets you create organizations in your IoT Central application. Use the following request to create a organization in your application:
34+
35+
```http
36+
PUT https://{subdomain}.{baseDomain}/api/organizations/{organizationId}?api-version=1.1-preview
37+
```
38+
39+
* organizationId - Unique Id of the organization
40+
41+
The following example shows a request body that adds a organization to a IoT Central application.
42+
43+
```json
44+
{
45+
"displayName": "Seattle",
46+
"parent": "washington"
47+
}
48+
```
49+
50+
The request body has some required fields:
51+
52+
* `@displayName`: Display name of the organization.
53+
54+
The response to this request looks like the following example:
55+
56+
```json
57+
{
58+
"id": "seattle",
59+
"displayName": "Seattle",
60+
"parent": "washington"
61+
}
62+
```
63+
64+
### Get a organization
65+
66+
Use the following request to retrieve details of a individual organization from your application:
67+
68+
```http
69+
GET https://{subdomain}.{baseDomain}/api/organizations/{organizationId}?api-version=1.1-preview
70+
```
71+
72+
The response to this request looks like the following example:
73+
74+
```json
75+
{
76+
"id": "seattle",
77+
"displayName": "Seattle",
78+
"parent": "washington"
79+
}
80+
```
81+
82+
### Update an organization
83+
84+
Use the following request to update details of an organization in your application:
85+
86+
```http
87+
PATCH https://{subdomain}.{baseDomain}/api/organizations/{organizationId}?api-version=1.1-preview
88+
```
89+
90+
The following example shows a request body that updates a organization.
91+
92+
```json
93+
{
94+
"id": "seattle",
95+
"displayName": "Seattle Sales",
96+
"parent": "washington"
97+
}
98+
```
99+
100+
The response to this request looks like the following example:
101+
102+
```json
103+
{
104+
"id": "seattle",
105+
"displayName": "Seattle Sales",
106+
"parent": "washington"
107+
}
108+
```
109+
110+
### List organizations
111+
112+
Use the following request to retrieve a list of organizations from your application:
113+
114+
```http
115+
GET https://{your app subdomain}.azureiotcentral.com/api/organizations?api-version=1.1-preview
116+
```
117+
118+
The response to this request looks like the following example. The role value identifies the role ID the user is associated with:
119+
120+
```json
121+
{
122+
"value": [
123+
{
124+
"id": "redmond",
125+
"displayName": "Redmond"
126+
},
127+
{
128+
"id": "bellevue",
129+
"displayName": "Bellevue"
130+
},
131+
{
132+
"id": "spokane",
133+
"displayName": "Spokane",
134+
"parent": "Washington"
135+
},
136+
{
137+
"id": "seattle",
138+
"displayName": "Seattle",
139+
"parent": "Washington"
140+
}
141+
]
142+
}
143+
```
144+
145+
### Delete a user
146+
147+
Use the following request to delete a organization:
148+
149+
```http
150+
DELETE https://{your app subdomain}.azureiotcentral.com/api/organizations/{organizationId}?api-version=1.1-preview
151+
```
152+
153+
## Next steps
154+
155+
Now that you've learned how to manage users and roles with the REST API, a suggested next step is to [How to use the IoT Central REST API to manage data exports.](howto-manage-data-export-with-rest-api.md)

0 commit comments

Comments
 (0)