This endpoint creates a new Organization
Request
To create a new Organization please make a POST request to the following URL:
| HTTP Method | URL |
|---|---|
| POST | https://nanoview-api.wellairsolutions.com/api/v2.0/organizations/ |
Query Parameters
| Parameter | Type | Use | Description |
|---|---|---|---|
| token | String | Authentication | Authentication Token can optionally be sent as a query parameter. |
Body Parameters
| Parameter | Type | Required? | Default Value | Description |
|---|---|---|---|---|
| label | String | Yes | N/A (required) | API label of Organization |
| name | String | No | Same as label | Name of Organization |
| description | String | No | "" | Description of Organization |
| favicon | Image | No | null | Icon of the Organization, this attribute has to be sent as form-data (-F favicon=/path/logo.png) |
| logo | Image | No | null | Url of image or logo |
| properties | Object | No | {} | Organization properties. |
| isActive | Boolean | No | True | Is True when Organization is active |
| app | <app_key> | No | null | Key of App (id or label) |
| parent | Object | No | null | Organization to nest this one under, as {"id": "<organization_id>"} or {"label": "<organization_label>"}. Omit it or send null to create a root Organization. See Organization Hierarchy |
| tags | Array | No | [] | Tags of Organization, for example the level of the node: ["building"] |
UpdatingfaviconandlogoOur backend is that powerful that it can handle files. There is however one little caveat, the data needs to be sent as
form-data. Practically this means simply a different flag in the curl. And important to know, you can send the other attributes asform-datatoo. There is an example on the right hand side.curl -X POST 'https://nanoview-api.wellairsolutions.com/api/v2.0/organizations/' \ -H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \ -F 'favicon=path/logo.png' -F 'logo=@logoname'
Create an Organization inside another one
Send parent to nest the new Organization under an existing one of the same account. The platform does not store a node type: mark the level with tags and keep descriptive attributes in properties.
curl -X POST 'https://nanoview-api.wellairsolutions.com/api/v2.0/organizations/' \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-d '{
"name": "Room 101",
"label": "north-tower-room-101",
"parent": {"id": "64a1b2c3d4e5f60001234569"},
"tags": ["space"],
"properties": {"space_type": "room"}
}'labelmust be unique in the whole account, not only among the siblings: two buildings cannot both have afloor-1. Keep the readable name inname.- The tree can have at most 7 levels, the root included.
- The parent must belong to the same account and be active: a new Organization cannot be created under an inactive one.
- Users who have a role on any ancestor get the same role on the new Organization right away.
- A nested Organization takes the App of its parent. Sending a different
appreturns400 Bad Request.
A rule that is not met returns 400 Bad Request with the reason in detail, for example An organization hierarchy cannot be deeper than 7 levels.
Header
| Parameter | Type | Description |
|---|---|---|
| X-Auth-Token | String | Authentication Token of account |
| Content-Type | String (application/json) | Content type of body |
curl -X POST 'https://nanoview-api.wellairsolutions.com/api/v2.0/organizations/' \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-d '{
"name": "My Second Customer",
"label": "my-second-customer",
"description": "Other Organization",
"properties": {"color": "#BADA55"},
"isActive": true,
"app": "~my_application"
}'{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"app": {
"id": "5dfa39901a9ca53020c6938d",
"label": "my_application",
"name": "NanoView App of Me",
"url": "https://nanoview-api.wellairsolutions.com/api/v2.0/apps/5dfa39901a9ca53020c6938d"
},
"createdAt": "2020-01-01T14:05:55.471155Z",
"description": "Other Organization",
"devicesCount": 0,
"favicon": {
"h36": "https://nanoview.wellairsolutions.com/media/logo_36.png",
"h50": "https://nanoview.wellairsolutions.com/media/logo_50.png",
"raw": "https://nanoview.wellairsolutions.com/media/logo.png"
},
"id": "435ab418805c32fa400f",
"isActive": true,
"label": "my-second-customer",
"limits": [
{
"actual_value": 0,
"icon": "hdd-o",
"max_value": "*",
"name": "Devices",
"type": "devices"
},
{
"actual_value": 0,
"icon": "envelope",
"max_value": "*",
"name": "Emails",
"type": "emails"
},
{
"actual_value": 0,
"icon": "signal",
"max_value": "*",
"name": "Variables",
"type": "variables"
},
{
"actual_value": 0,
"icon": "users",
"max_value": "*",
"name": "Users",
"type": "users"
},
{
"actual_value": 0,
"icon": "spinner",
"max_value": "*",
"name": "Dots",
"type": "dots"
},
{
"actual_value": 0,
"icon": "mobile-phone",
"max_value": "*",
"name": "SMS",
"type": "sms"
},
{
"actual_value": 0,
"icon": null,
"max_value": "*",
"name": "Voice",
"type": "voice"
}
],
"logo": {
"h36": "https://nanoview.wellairsolutions.com/media/logo_36.png",
"h50": "https://nanoview.wellairsolutions.com/media/logo_50.png",
"raw": "https://nanoview.wellairsolutions.com/media/logo.png"
},
"name": "My Second Customer",
"properties": {"color": "#BADA55"},
"url": "https://nanoview-api.wellairsolutions.com/api/v2.0/organizations/435ab418805c32fa400f",
"usersCount": 0
}
]
}{
"code": 400001,
"message": "Validation Error.",
"detail": {
....
}
}{
"code": 401001,
"message": "Authentication credentials were not provided.",
"detail": "Authentication credentials were not provided."
}Response
Returns an Organization object of the Organization created.
