Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Get the user entity by name

    • To get a cloud admin user an administrator from whichever enterprise they are currently working in, run the get request use a URL with a wildcard for all enterprises represented by , which is 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 so the link as would be: "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' \
         -u admin:xabiquo k --verbose | jq .


    • This request returns a collection of users, so find . Keep the required user entity, which starts before the ID

      Expand


      Code Block
      {
          "totalSize": 1,
       {   "links": [
              "id": 10,{
                  "nickrel": "cloudadminfirst",
                  "namehref": "cloudadmin",
                  "surname": "cloudadmin",https://example.com:443/api/admin/enterprises/_/users?limit=25&has=cloudadmin&by=name&asc=true"
                  "email": "cloudadmin@example.com"},
              {
         "locale": "en_US",
                  "authTyperel": "ABIQUOlast",
                  "activehref": 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","https://example.com:443/api/admin/enterprises/_/users?startwith=0&limit=25&has=cloudadmin&by=name&asc=true"
              }
          "firstLogin],
          "collection": false, [
              {
                  "lockedid": false10,
                  "linksnick": "cloudadmin",
       [           "name": "Cloud",
          {        "surname": "Admin",
                  "reldescription": "enterprise",Secondary cloud admin user",
                       "hrefemail": "https://examplecloudadmin@example.com:443/api/admin/enterprises/275"",
                    "locale": "en_US",
       },           "authType": "ABIQUO",
          {        "active": true,
                  "titlepublicSshKey": "CLOUD_ADMINssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDgm0ckfblahblahblah",
                  "allowedCIDRs": [],
                  "relfirstLogin": "role"false,
                  "locked": false,
            "type      "phoneNumber": "application/vnd.abiquo.role+json555123456",
                  "links": [
            "href": "https://example.com:443/api/admin/roles/1"
                      },
                        {
                          "title": "cloudadminMarketing Department",
                          "rel": "editenterprise",
                          "type": "application/vnd.abiquo.userenterprise+json",
                          "href": "https://example.com:443/api/admin/enterprises/275/users/103"
                      },
                      {
                          "title": "Global scopeCLOUD_ADMIN",
                          "rel": "scoperole",
                          "type": "application/vnd.abiquo.scoperole+json",
                          "href": "https://example.com:443/api/admin/scopesroles/1"
                      },
                      {
                          "title": "virtual machinescloudadmin",
                          "rel": "virtualmachinesedit",
                          "type": "application/vnd.abiquo.virtualmachinesuser+json",
                          "href": "https://example.com:443/api/admin/enterprises/2753/users/10/action/virtualmachines"
                      },
                      {
                          "title": "pendingGlobal tasksscope",
                          "rel": "pendingtasksscope",
                          "type": "application/vnd.abiquo.tasksscope+json",
                          "href": "https://example.com:443/api/admin/enterprises/275/users/10/action/pendingtasksscopes/1"
                      },
                      {
                          "title": "applicationsvirtual machines",
                          "rel": "applicationsvirtualmachines",
                          "type": "application/vnd.abiquo.applicationsvirtualmachines+json",
                          "href": "https://example.com:443/api/admin/enterprises/2753/users/10/applicationsaction/virtualmachines"
                      },
                      {
                          "title": "enable two factor authenticationpending tasks",
                          "rel": "enable2fapendingtasks",
                          "type": "application/vnd.abiquo.twofactorauthcredentialstasks+json",
                          "href": "https://example.com:443/api/admin/enterprises/2753/users/10/action/enable2fapendingtasks"
                      },
                      {
                          "title": "async tasksapplications",
                          "rel": "asynctasksapplications",
                          "type": "application/vnd.abiquo.asynctasksapplications+json",
                          "href": "https://example.com:443/api/admin/enterprises/2753/users/10/asynctasksapplications"
                      },
                   ]   {
                }

    Get the new enterprise by name

    Code Blockcurl
    •  
    -X
    •  
    GET
    •  
    \ 'https://example.com/api/admin/enterprises?has=abiquo' \ -H 'Accept:
    •        "title": "async tasks",
                          "rel": "asynctasks",
                          "type": "application/vnd.abiquo.
    enterprises+json;version=4.7' \
    1. Find the required enterprise in the list

    2. Get the enterprise "edit" link

    Edit the user entity. 

  2. 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

  3. 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.

  4. Sample enterprise link

    Code Block { "href": "http://example.com/api/admin/enterprises/1224
    • asynctasks+json",
                          "href": "https://example.com:443/api/admin/enterprises/3/users/10/asynctasks"
                      }
                  ]
              }
          ]
      }




  5. Get the new enterprise by name

    Code Block
    curl -X GET \
      'https://example.com/api/admin/enterprises?has=Finance' \
      -H 'Accept: application/vnd.abiquo.enterprises+json;version=4.7' \


    1. Sample response

      Expand


      Code Block
      {
          "totalSize": 1,
          "links": [
              {
                  "rel": "first",
                  "href": "https://example.com:443/api/admin/enterprises?limit=25&has=Finance&by=name&asc=true"
              },
              {
                  "rel": "last",
                  "href": "https://example.com:443/api/admin/enterprises?startwith=0&limit=25&has=Finance&by=name&asc=true"
              }
          ],
          "collection": [
              {
                  "id": 2,
                  "name": "Finance Department",
                  "isReservationRestricted": false,
                  "workflow": false,
                  "twoFactorAuthenticationMandatory": false,
                  "reseller": false,
                  "keyNode": false,
                  "diskSoftLimitInMb": 0,
                  "diskHardLimitInMb": 0,
                  "storageSoftInMb": 0,
                  "storageHardInMb": 0,
                  "vmsSoft": 0,
                  "vmsHard": 0,
                  "vlansSoft": 0,
                  "vlansHard": 0,
                  "publicIpsSoft": 0,
                  "publicIpsHard": 0,
                  "repositorySoftInMb": 0,
                  "repositoryHardInMb": 0,
                  "links": [
                      {
                          "title": "Finance Department",
                          "rel": "edit",
                          "type": "application/vnd.abiquo.enterprise+json",
                          "href": "https://example.com:443/api/admin/enterprises/2"
                      },
                      {
                          "title": "users",
                          "rel": "users",
                          "type": "application/vnd.abiquo.users+json",
                          "href": "https://example.com:443/api/admin/enterprises/2/users"
                      },
                      {
                          "title": "properties",
                          "rel": "properties",
                          "type": "application/vnd.abiquo.enterpriseproperties+json",
                          "href": "https://example.com:443/api/admin/enterprises/2/properties"
                      },
                      {
                          "title": "Global scope",
                          "rel": "scope",
                          "type": "application/vnd.abiquo.scope+json",
                          "href": "https://example.com:443/api/admin/scopes/1"
                      },
                      {
                          "title": "template definitions lists",
                          "rel": "appslib/templateDefinitionLists",
                          "type": "application/vnd.abiquo.templatedefinitionlists+json",
                          "href": "https://example.com:443/api/admin/enterprises/2/appslib/templateDefinitionLists"
                      },
                      {
                          "title": "template defintion paths",
                          "rel": "appslib/templateDefinitions",
                          "type": "application/vnd.abiquo.templatedefinitions+json",
                          "href": "https://example.com:443/api/admin/enterprises/2/appslib/templateDefinitions"
                      },
                      {
                          "title": "repositories",
                          "rel": "datacenterrepositories",
                          "type": "application/vnd.abiquo.datacenterrepositories+json",
                          "href": "https://example.com:443/api/admin/enterprises/2/datacenterrepositories"
                      },
                      {
                          "title": "virtual machines",
                          "rel": "virtualmachines",
                          "type": "application/vnd.abiquo.virtualmachines+json",
                          "href": "https://example.com:443/api/admin/enterprises/2/action/virtualmachines"
                      },
                      {
                          "title": "virtual appliances",
                          "rel": "virtualappliances",
                          "type": "application/vnd.abiquo.virtualappliances+json",
                          "href": "https://example.com:443/api/admin/enterprises/2/action/virtualappliances"
                      },
                      {
                          "title": "ips",
                          "rel": "ips",
                          "type": "application/vnd.abiquo.privateips+json",
                          "href": "https://example.com:443/api/admin/enterprises/2/action/ips"
                      },
                      {
                          "title": "virtual datacenters",
                          "rel": "cloud/virtualdatacenters",
                          "type": "application/vnd.abiquo.virtualdatacenters+json",
                          "href": "https://example.com:443/api/admin/enterprises/2/action/virtualdatacenters"
                      },
                      {
                          "title": "reserved machines",
                          "rel": "reservedmachines",
                          "type": "application/vnd.abiquo.machines+json",
                          "href": "https://example.com:443/api/admin/enterprises/2/reservedmachines"
                      },
                      {
                          "title": "limits",
                          "rel": "limits",
                          "type": "application/vnd.abiquo.limits+json",
                          "href": "https://example.com:443/api/admin/enterprises/2/limits"
                      },
                      {
                          "title": "providerlimits",
                          "rel": "providerlimits",
                          "type": "application/vnd.abiquo.providerlimits+json",
                          "href": "https://example.com:443/api/admin/enterprises/2/providerlimits"
                      },
                      {
                          "title": "volumes",
                          "rel": "volumes",
                          "type": "application/vnd.abiquo.volumes+json",
                          "href": "https://example.com:443/api/admin/enterprises/2/action/volumes"
                      },
                      {
                          "title": "external networks",
                          "rel": "externalnetworks",
                          "type": "application/vnd.abiquo.vlans+json",
                          "href": "https://example.com:443/api/admin/enterprises/2/action/externalnetworks"
                      },
                      {
                          "title": "pending tasks",
                          "rel": "pendingtasks",
                          "type": "application/vnd.abiquo.tasks+json",
                          "href": "https://example.com:443/api/admin/enterprises/2/action/pendingtasks"
                      },
                      {
                          "title": "credentials",
                          "rel": "credentials",
                          "type": "application/vnd.abiquo.publiccloudcredentialslist+json",
                          "href": "https://example.com:443/api/admin/enterprises/2/credentials"
                      },
                      {
                          "title": "pricingcredentials",
                          "rel": "pricingcredentials",
                          "type": "application/vnd.abiquo.pricingcredentialslist+json",
                          "href": "https://example.com:443/api/admin/enterprises/2/pricingcredentials"
                      },
                      {
                          "title": "virtual appliances specs",
                          "rel": "vappspecs",
                          "type": "application/vnd.abiquo.virtualappliancespecs+json",
                          "href": "https://example.com:443/api/admin/enterprises/2/vappspecs"
                      },
                      {
                          "title": "bills",
                          "rel": "bills",
                          "type": "application/vnd.abiquo.bills+json",
                          "href": "https://example.com:443/api/statistics/enterpriseresources/2/bills"
                      },
                      {
                          "title": "billregisters",
                          "rel": "billregisters",
                          "type": "application/vnd.abiquo.bills+json",
                          "href": "https://example.com:443/api/statistics/enterpriseresources/2/billregisters"
                      },
                      {
                          "title": "estimation",
                          "rel": "estimation",
                          "type": "text/plain",
                          "href": "https://example.com:443/api/statistics/enterpriseresources/2/billregisters/action/estimate"
                      },
                      {
                          "title": "Bill providers",
                          "rel": "billproviders",
                          "type": "application/vnd.abiquo.billproviders+json",
                          "href": "https://example.com:443/api/statistics/enterpriseresources/2/bills/action/providers"
                      },
                      {
                          "title": "Budgets",
                          "rel": "budgets",
                          "type": "application/vnd.abiquo.budgets+json",
                          "href": "https://example.com:443/api/admin/enterprises/2/budgets"
                      }
                  ],
                  "ramSoft": 0,
                  "ramHard": 0,
                  "cpuSoft": 0,
                  "cpuHard": 0
              }
          ]
      }



    2. Find the required enterprise in the collection

    3. Save the enterprise "edit" link

      Code Block
                      {
                          "title": "Finance Department",
                          "rel": "edit",
                          "type": "application/vnd.abiquo.enterprise+json",
                          "href": "https://example.com:443/api/admin/enterprises/2"
                      },


  6. Edit the user entity. 

    1. 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

    2. 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.

    3. Sample enterprise link

      Code Block
          {
            "href": "http://mjsabiquo.bcn.com/api/admin/enterprises/2", 
            "rel": "enterprise"
          }


    4. Sample user entity with new enterprise link

      Expand


      Code Block
               {
                  "id": 10,
                  "nick": "cloudadmin",
                  "name": "Cloud",
                  "surname": "Admin",
                  "description": "Secondary cloud admin user",
                  "email": "cloudadmin@example.com",
                  "locale": "en_US",
                  "authType": "ABIQUO",
                  "active": true,
                  "publicSshKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDblahblahblah",
                  "allowedCIDRs": [],
                  "firstLogin": false,
                  "locked": false,
                  "phoneNumber": "555123456",
                  "links": [
                      {
                          "rel": "enterprise",
                          "href": "https://example.com:443/api/admin/enterprises/2"
                      },
                      {
                          "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/3/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/3/users/10/action/virtualmachines"
                      },
                      {
                          "title": "pending tasks",
                          "rel": "pendingtasks",
                          "type": "application/vnd.abiquo.tasks+json",
                          "href": "https://example.com:443/api/admin/enterprises/3/users/10/action/pendingtasks"
                      },
                      {
                          "title": "applications",
                          "rel": "applications",
             
      "rel
                   "type": "
      enterprise"
      application/vnd.abiquo.applications+json",
               
      }

    Update the user 

    1. In the user URL, replace the enterprise ID with an underscore character "_". 

    2. Perform a PUT request to the user, sending the updated user entity.

    3. cURL

      Code Block
      Expand
      curl -X PUT \
                 "href": "https://example.com:443/api/admin/enterprises/
      _
      3/users/10
      \
      /applications"
             
      -H
       
      'Accept:
       
      application/vnd.abiquo.user+json;version=4.7'
       
      \
         
      -H
       
      'Content-Type:
       
      application/vnd.abiquo.user+json;version=4.7' \
       },
        
      -u
       
      user:password
       
      --verbose
       
      \
         
      -d
       
      @requestpayload.json
       

      Sample response

      Code Block
      {      {
            "id": 10,             "nicktitle": "cloudadminasync tasks",
                          "namerel": "cloudadminasynctasks",
                          "surnametype": "cloudadminapplication/vnd.abiquo.asynctasks+json",
                    "email": "cloudadmin@example.com",      "href": "https://example.com:443/api/admin/enterprises/3/users/10/asynctasks"
                  "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"
                      },
                      {
         }



  7. Update the user 

    1. In the user URL, replace the enterprise ID with an underscore character "_". 

    2. Perform a PUT request to the user, sending the updated user entity.

    3. cURL

      Code Block
      curl -X PUT \
        https://example.com/api/admin/enterprises/_/users/10 \
        -H 'Accept: application/vnd.abiquo.user+json;version=4.7' \
        -H 'Content-Type: application/vnd.abiquo.user+json;version=4.7' \
        -u user:password --verbose \
        -d @requestpayload.json 


    4. Sample response. Success status code: 200

      Expand


      Code Block
      {
          "id": 10,
          "nick": "cloudadmin",
          "name": "Cloud",
          "surname": "Admin",
          "description": "Secondary cloud admin user",
          "email": "cloudadmin@example.com",
          "locale": "en_US",
          "authType": "ABIQUO",
          "active": true,
          "publicSshKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDgm0ckfblahblahblah",
          "allowedCIDRs": [],
          "firstLogin": false,
          "locked": false,
          "phoneNumber": "555123456",
          "links": [
              {
                      "title": "CLOUD_ADMINFinance Department",
          
                     "rel": "roleenterprise",
             
                  "type": "application/vnd.abiquo.roleenterprise+json",
       
                        "href": "https://example.com:443/api/admin/rolesenterprises/1"
                      },
           2"
               },
      {        {
                  "title": "cloudadminCLOUD_ADMIN",
      
                         "rel": "editrole",
                          "type": "application/vnd.abiquo.userrole+json",
                     
          "href": "https://example.com:443/api/admin/enterprises/275/users/10"
                      },      "href": "https://example.com:443/api/admin/roles/1"
              },
      {        {
                  "title": "Global scopecloudadmin",
            
                   "rel": "scopeedit",
             
                  "type": "application/vnd.abiquo.scopeuser+json",
         
                      "href": "https://example.com:443/api/admin/enterprises/scopes2/users/110"
                      },
                    
       {        {
                  "title": "virtualGlobal machinesscope",
        
                       "rel": "virtualmachinesscope",
                          "type": "application/vnd.abiquo.virtualmachinesscope+json",
                          "href": "https://example.com:443/api/admin/enterprises/275/users/10/action/virtualmachines"
               
            },      "href": "https://example.com:443/api/admin/scopes/1"
              },
      {        {
                  "title": "pendingvirtual tasksmachines",
          
                     "rel": "pendingtasksvirtualmachines",
             
                  "type": "application/vnd.abiquo.tasksvirtualmachines+json",
       
                        "href": "https://example.com:443/api/admin/enterprises/2752/users/10/action/pendingtasksvirtualmachines"
                      },
               
            {        {
                  "title": "applicationspending tasks",
          
                     "rel": "applicationspendingtasks",
      
                         "type": "application/vnd.abiquo.applicationstasks+json",
       
                        "href": "https://example.com:443/api/admin/enterprises/2752/users/10/action/applications"
            pendingtasks"
               },
             
              {
                          "title": "enable two factor authenticationapplications",
             
                  "rel": "enable2faapplications",
       
                        "type": "application/vnd.abiquo.twofactorauthcredentialsapplications+json",
             
                  "href": "https://example.com:443/api/admin/enterprises/2752/users/10/action/enable2faapplications"
      
                     },
                      {
            
                   "title": "async tasks",
            
                   "rel": "asynctasks",
             
                  "type": "application/vnd.abiquo.asynctasks+json",
                          "href": "https://example.com:443/api/admin/enterprises/2752/users/10/asynctasks"
                      }
            
           ]
       
            }