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 Method | URL |
---|---|
POST | https://industrial.api.ubidots.com/api/v2.0/users/<user_key>/_/assign_organizations/ |
Path Parameters
Parameter | Type | Use |
---|---|---|
user_key | String | The id or username of the User, username should use the prefix ~ |
Query Parameters
Parameter | Type | Use | Description |
---|---|---|---|
token | String | Authentication | Authorization Token can optionally be sent as a query parameter. |
Body Parameters
Parameter | Type | Required? | Default Value |
---|---|---|---|
label | String | Yes | N/A (Required) |
role | String | Yes | N/A (Required) |
invitation | Object | No | {} |
Pro Tip
You can assign multiple Organizations to a single User in the same request separating all the key lists by a comma.
Header
Parameter | Required? | Description |
---|---|---|
X-Auth-Token | Yes | Authentication Token of account |
Content-Type | String (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.