Update Organization

This endpoint updates the Organization fields specified in the body.

Request

To update one or more specific attributes of an Organization please make a PATCH request to the following URL:

HTTP MethodURL
PATCHhttps://nanoview-api.wellairsolutions.com/api/v2.0/organizations/<organization_key>/

Path Parameters

ParameterTypeDescription
organization_keyStringThe ID or label of the Organization, label should use the prefix ~

Query Parameters

ParameterTypeUseDescription
tokenStringAuthenticationAuthentication Token can optionally be sent as a query parameter.

Body Parameters

ParameterTypeRequired?Description
labelStringNoThe API label of Organization
nameStringNoName of the Organization
descriptionStringNoDescription of Organization
faviconImage FileNoIcon of Organization. How to update the favicon
logoImage FileNoLogo of Organization. How to update the logo
propertiesObjectNoOrganization properties
isActiveBooleanNoIs True when Organization is active
app<app_key>NoKey of App (ID or label)
parentObjectNoNew parent, as {"id": "<organization_id>"} or {"label": "<organization_label>"}, or null to make it a root. Moves the Organization with everything nested below it. See Move an Organization
tagsArrayNoTags of Organization
🚧

Updating favicon and logo

Our 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 as form-data too. There is an example on the right hand side.

curl -X PATCH 'https://nanoview-api.wellairsolutions.com/api/v2.0/organizations/<organization_key>' \ -H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \ -F 'favicon=path/logo.png' -F 'logo=@logoname'

Move an Organization

Sending a parent different from the current one moves the Organization, with everything nested below it, in a single transaction. Send null to turn it into a root Organization.

curl -X PATCH 'https://nanoview-api.wellairsolutions.com/api/v2.0/organizations/~north-tower-floor-3/' \
 -H 'Content-Type: application/json' \
 -H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
 -d '{"parent": {"id": "64a1b2c3d4e5f60001234570"}}'
  • Roles that reached the moved branch only through its old ancestors are removed from it, and the roles of the new ancestors are applied.
  • The move is rejected with 400 Bad Request, and the tree is left as it was, when the new parent is the Organization itself or one of its descendants, belongs to another account, or the result would be deeper than 7 levels.
  • An active Organization cannot be moved under an inactive one. To move it there, deactivate it first and then move it.
  • Sending the current parent again changes nothing.

Deactivate an Organization

Sending "isActive": false deactivates the Organization and every active Organization nested below it, in the same request. The users who are left without any active Organization are deactivated too.

Reactivation does not cascade: each nested Organization has to be activated on its own, and an Organization cannot be activated while any of its ancestors is inactive (400 Bad Request, An organization cannot be active while one of its ancestors is inactive.).

Header

ParameterRequired?Description
X-Auth-TokenYesAuthentication Token of account
$ curl -X PATCH 'https://nanoview-api.wellairsolutions.com/api/v2.0/organizations/<organization_key>' \
 -H 'Content-Type: application/json' \
 -H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
 -d '{
    "label": "variable2",
    "name": "Variable 2",
    "description": "my variable 2",
    "tags": ["blue", "yellow"],
    "properties": {}
}'
{
    "app": null,
    "createdAt": "2020-01-01T14:05:55.471155Z",
    "description": "Other Organization",
    "devicesCount": 0,
    "favicon": null,
    "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": null,
    "name": "My Best Customer",
    "properties": {"any": "thing"},
    "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 updated Organization.