Assign Organization to Users

This endpoint assigns Organizations to a specific User

Request

To assign Organization to a User, please make a POST request to the following URL:

HTTP MethodURL
POSThttps://industrial.api.ubidots.com/api/v2.0/users/<user_key>/_/assign_organizations/

Path Parameters

ParameterTypeUse
user_keyStringThe id or username of the User, username should use the prefix ~

Query Parameters

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

Body Parameters

ParameterTypeRequired?Default Value
labelStringYesN/A (Required)
roleStringYesN/A (Required)
invitationObjectNo{}

📘

Pro Tip

You can assign multiple Organizations to a single User in the same request separating all the key lists by a comma.

Header

ParameterRequired?Description
X-Auth-TokenYesAuthentication Token of account
Content-TypeString (application/json)Content type of body
$ curl -X POST 'https://industrial.api.ubidots.com/api/v2.0/users/63d3f1247fefea000cd325af/_/assign_organizations/' \
 -H 'Content-Type: application/json' \
 -H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
 -d '[
  {"label": "my-third-customer",
   "role": "viewer",
   "invitation": {
     "subject": "Welcome to app",
     "message": "Hello you are been invited",
     "ubiAppId": "6242336d32b3a5000aa394f2",
     "expires": 365,
     "resetPassword": false
   }    
  }  
]'
{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "url": "https://industrial.api.ubidots.com/api/v2.0/organizations/62b4eb3519cd98007bf410bf",
      "id": "62b4eb3519cd98007bf410bf",
      "label": "my-third-customer",
      "name": "Cliente1",
      "createdAt": "2022-06-23T22:37:41.840643Z",
      "role": {
        "url": "https://industrial.api.ubidots.com/api/v2.0/roles/viewer",
        "label": "viewer",
        "name": "Viewer",
        "createdAt": "2022-06-02T13:06:50.616480Z"
      }
    }
  ]
}
{
    "code": 400001,
    "message": "Validation Error.",
    "detail": {
        ....
    }
}
{
    "code": 401001,
    "message": "Authentication credentials were not provided.",
    "detail": "Authentication credentials were not provided."
}

Response

Returns an Object with a results array containing the User assigned to the Organizations.