...
The following pages describe the switch enterprise functionality in the Abiquo UI.
Summary diagram
The steps in this diagram link to the API reference guide resources and data entities sections.
Detailed steps
Get the user entity by name
To get a cloud admin user from whichever enterprise they are currently in, run the get request with a wildcard for all enterprises represented by the underscore character "_".
If you know the ID of the user, you can retrieve the user entity directly with the users link.
For example, the cloud admin user has an ID of 1, and the link as "https://example.com/api/admin/enterprises/_/users/1"Or use the "has" parameter to perform a search for the user by text such as username, name, or details
Code Block curl -X GET \ 'https://example.com/api/admin/enterprises/_/users?has=cloudadmin' \ -H 'Accept: application/vnd.abiquo.users+json;version=4.7' \
This request returns a collection of users, so find the required user
Expand Code Block { "id": 10, "nick": "cloudadmin", "name": "cloudadmin", "surname": "cloudadmin", "email": "cloudadmin@example.com", "locale": "en_US", "authType": "ABIQUO", "active": true, "publicSshKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDgm0ckfxabLgc2a2cJlTyTdsZ4F5xNWHQqOZjOiZ/OEJ7jDXJiDz2cWiUNeNJJ49xFHHVo4R7QIROau8F5jhjvz1T6yPIcaI+EEqyKBNZtAuTxi7u9xwiuye4Zj6H37oAsxolRNBKg/nPCZ6SGNnVp2nhbN4bJS33Ia8rUSTa7yEbQxkduQndvNh64DscmxMwPiVJOcc9GJZz7gz1PcpeNNxP7Ir3giDSQF+TP4OyCDYV8nOQitGbxqNlJK3jcrx4nhaaY9As1xb5XD1e6X40fNg2+aW6z5rTh5PaEqPReyHDf7RxFWsgj58XUiJ4EPKvnV2EqM9DQINahlDlvIVG8G7p1dx+zT9VCZjEaHIuMQvK7MhStI9cE++TxhipPRfpPClDVQMguDs/JBpiztDZyCYe8szBo+IfxWl3im3pO4CjHqns1Kq0qR8AE7hc3wzNxR4wtX/jGN22LUDObfjVO3zYvnlDu9B3iTtFhS8MZ1N4Pk2/DKnN2/qg8nSNCufSZcFHnY2OV4Wspl5S5MIvz8nQMcl+0q+0BELeIdA0zhAzAaJMv0P8C/R9L0HVLCUFmzwIPW8rrEox5WgZjbxh5Fw3gDNk8/vCWZsKWsYFyy1MoFPt9JrfrO1/axb3xowFI04FcaXgk69SAMxfzL4LQuFCimprdj0gAea1gyswLvw== maryjane.smyth@abiquo.com", "firstLogin": false, "locked": false, "links": [ { "rel": "enterprise", "href": "https://example.com:443/api/admin/enterprises/275" }, { "title": "CLOUD_ADMIN", "rel": "role", "type": "application/vnd.abiquo.role+json", "href": "https://example.com:443/api/admin/roles/1" }, { "title": "cloudadmin", "rel": "edit", "type": "application/vnd.abiquo.user+json", "href": "https://example.com:443/api/admin/enterprises/275/users/10" }, { "title": "Global scope", "rel": "scope", "type": "application/vnd.abiquo.scope+json", "href": "https://example.com:443/api/admin/scopes/1" }, { "title": "virtual machines", "rel": "virtualmachines", "type": "application/vnd.abiquo.virtualmachines+json", "href": "https://example.com:443/api/admin/enterprises/275/users/10/action/virtualmachines" }, { "title": "pending tasks", "rel": "pendingtasks", "type": "application/vnd.abiquo.tasks+json", "href": "https://example.com:443/api/admin/enterprises/275/users/10/action/pendingtasks" }, { "title": "applications", "rel": "applications", "type": "application/vnd.abiquo.applications+json", "href": "https://example.com:443/api/admin/enterprises/275/users/10/applications" }, { "title": "enable two factor authentication", "rel": "enable2fa", "type": "application/vnd.abiquo.twofactorauthcredentials+json", "href": "https://example.com:443/api/admin/enterprises/275/users/10/action/enable2fa" }, { "title": "async tasks", "rel": "asynctasks", "type": "application/vnd.abiquo.asynctasks+json", "href": "https://example.com:443/api/admin/enterprises/275/users/10/asynctasks" } ] }
Get the new enterprise by name
Code Block curl -X GET \ 'https://example.com/api/admin/enterprises?has=abiquo' \ -H 'Accept: application/vnd.abiquo.enterprises+json;version=4.7' \
Find the required enterprise in the list
Get the enterprise "edit" link
Edit the user entity.
Find the link with the "rel" value of "enterprise" and replace it with the new enterprise link. For example, to switch to enterprise 1224, you could use the link below
Remember that the user entity must be complete in order to save the user, e.g. add an email attribute for the user if you didn't already add one because it is required.
Sample enterprise link
Code Block { "href": "http://example.com/api/admin/enterprises/1224", "rel": "enterprise" }
Update the user
Perform a PUT request to In the user and URL, replace the enterprise id in the URL with an underscore character "_".
Send the user entity that you modified above. Remember that the user entity must be complete in order to save the user, e.g. add an email attribute for the user if you didn't already add one because this is obligatoryPerform a PUT request to the user, sending the updated user entity.
cURL
Code Block curl -X PUT \ https://example.com/api/admin/enterprises/_/users/10 \ -H 'Accept: application/vnd.abiquo.user+json;version=4.67' \ -H 'Content-Type: application/vnd.abiquo.user+json;version=4.67' \ -u user:password --verbose \ -d @requestpayload.json
Sample response
Expand Code Block { "id": 10, "nick": "cloudadmin", "name": "cloudadmin", "surname": "cloudadmin", "email": "cloudadmin@example.com", "locale": "en_US", "authType": "ABIQUO", "active": true, "publicSshKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDgm0ckfxabLgc2a2cJlTyTdsZ4F5xNWHQqOZjOiZ/OEJ7jDXJiDz2cWiUNeNJJ49xFHHVo4R7QIROau8F5jhjvz1T6yPIcaI+EEqyKBNZtAuTxi7u9xwiuye4Zj6H37oAsxolRNBKg/nPCZ6SGNnVp2nhbN4bJS33Ia8rUSTa7yEbQxkduQndvNh64DscmxMwPiVJOcc9GJZz7gz1PcpeNNxP7Ir3giDSQF+TP4OyCDYV8nOQitGbxqNlJK3jcrx4nhaaY9As1xb5XD1e6X40fNg2+aW6z5rTh5PaEqPReyHDf7RxFWsgj58XUiJ4EPKvnV2EqM9DQINahlDlvIVG8G7p1dx+zT9VCZjEaHIuMQvK7MhStI9cE++TxhipPRfpPClDVQMguDs/JBpiztDZyCYe8szBo+IfxWl3im3pO4CjHqns1Kq0qR8AE7hc3wzNxR4wtX/jGN22LUDObfjVO3zYvnlDu9B3iTtFhS8MZ1N4Pk2/DKnN2/qg8nSNCufSZcFHnY2OV4Wspl5S5MIvz8nQMcl+0q+0BELeIdA0zhAzAaJMv0P8C/R9L0HVLCUFmzwIPW8rrEox5WgZjbxh5Fw3gDNk8/vCWZsKWsYFyy1MoFPt9JrfrO1/axb3xowFI04FcaXgk69SAMxfzL4LQuFCimprdj0gAea1gyswLvw== maryjane.smyth@abiquo.com", "firstLogin": false, "locked": false, "links": [ { "rel": "enterprise", "href": "https://example.com:443/api/admin/enterprises/276" }, { "title": "CLOUD_ADMIN", "rel": "role", "type": "application/vnd.abiquo.role+json", "href": "https://example.com:443/api/admin/roles/1" }, { "title": "cloudadmin", "rel": "edit", "type": "application/vnd.abiquo.user+json", "href": "https://example.com:443/api/admin/enterprises/275/users/10" }, { "title": "Global scope", "rel": "scope", "type": "application/vnd.abiquo.scope+json", "href": "https://example.com:443/api/admin/scopes/1" }, { "title": "virtual machines", "rel": "virtualmachines", "type": "application/vnd.abiquo.virtualmachines+json", "href": "https://example.com:443/api/admin/enterprises/275/users/10/action/virtualmachines" }, { "title": "pending tasks", "rel": "pendingtasks", "type": "application/vnd.abiquo.tasks+json", "href": "https://example.com:443/api/admin/enterprises/275/users/10/action/pendingtasks" }, { "title": "applications", "rel": "applications", "type": "application/vnd.abiquo.applications+json", "href": "https://example.com:443/api/admin/enterprises/275/users/10/applications" }, { "title": "enable two factor authentication", "rel": "enable2fa", "type": "application/vnd.abiquo.twofactorauthcredentials+json", "href": "https://example.com:443/api/admin/enterprises/275/users/10/action/enable2fa" }, { "title": "async tasks", "rel": "asynctasks", "type": "application/vnd.abiquo.asynctasks+json", "href": "https://example.com:443/api/admin/enterprises/275/users/10/asynctasks" } ] }