• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login
    1. Home
    2. scottybullet
    S
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 8
    • Best 3
    • Controversial 0
    • Groups 0

    scottybullet

    @scottybullet

    4
    Reputation
    229
    Profile views
    8
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    scottybullet Unfollow Follow

    Best posts made by scottybullet

    • RE: API - Create Host Deploy Task "error": "Invalid tasking type passed"

      Figured this out, I hope it helps someone out… this PS Script creates a Host and then creates a deploy task to the Image specified when the host was created.

      $vmname = "vmname"
      $MacAddress = "00:00:00:00:00:00"
      $ImageName = "ImageName"
      
      #######################################################################################################################
      # Configure the variables below for the Fog Server
      #######################################################################################################################
          #FogServer
              $fogApiToken = 'your token'
              $fogUserToken = 'your user token'
              $fogServer = "fog server IP or dns name"
              $Description = "Created by vCommander"   # www.embotics.com
          
      ########################################################################################################################
      # Nothing to configure below this line - Starting the main function of the script
      ########################################################################################################################
      
      ########################################################################################################################
      # Setting Cert Policy - required for successful auth with the server if set to https
      ########################################################################################################################
      add-type @"
          using System.Net;
          using System.Security.Cryptography.X509Certificates;
          public class TrustAllCertsPolicy : ICertificatePolicy {
              public bool CheckValidationResult(
                  ServicePoint srvPoint, X509Certificate certificate,
                  WebRequest request, int certificateProblem) {
                  return true;
              }
          }
      "@
      [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
      [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
      
      ########################################################################################################################
          #Setup Auth headers and base url for FogServer
              $headers = @{};
              $headers.Add('fog-api-token', $fogApiToken);
              $headers.Add('fog-user-token', $fogUserToken);
              $baseUri = "http://$fogServer/fog"
          
          #Get Image List From Fog Server
              $ImageURL = $baseUri+"/image/"
              $ImageResult = Invoke-RestMethod -Uri $ImageURL -Method GET -Headers $headers -ContentType "application/json"
              $Image = $ImageResult.images | Select-object imageTypeID,id,name | Where-object {$_.name -eq $ImageName}
             
      
          #GetHost List from fog Server
              $HostURL = $baseUri +"/host/"
              $HostResult = Invoke-RestMethod -Uri $HostURL -Method GET -Headers $headers -ContentType "application/json"
      
          #Create Host entry from vCommander
             $HostJson = @{
                                 "name"=  $vmname
                                 "description"=  $Description
                                 "macs" =  @($MacAddress)
                                 "imageID"= $Image.id
                                 "imagename" =  $ImageName  
                                 }
              $CreateHostJson = ConvertTo-Json($HostJson)
              $createHostURL = $baseUri +"/host/create"
              $createHostResult = Invoke-RestMethod -Uri $createHostURL -Method POST -body $CreateHostJson -Headers $headers -ContentType "application/json"
      
          #Get Task types to confirm Structure
               $TasktypesURL = $baseUri + "/tasktype"
               $TasktypesResult = Invoke-RestMethod -Uri $TasksURL -Method GET -Headers $headers -ContentType "application/json"
               $TasktypeID = ($TasktypesResult.tasktypes | Select-object name,id | Where-object {$_.name -eq "Deploy"}).id
      
          #Create Task to Image Host    
              $ImageID = $image.id
              $HostID = $createHostResult.id  
      
              $TaskURL = $baseUri + "/host/" + $HostID + "/task"
              $TaskdataSet = @{
                  "hostname" = $createHostResult.name
                  "taskTypeID" = $TasktypeID
                  }
              $taskdataToSend = ConvertTo-JSON($TaskdataSet)
              $TaskResult = Invoke-RestMethod -Method Post -Uri $TaskURL -Headers $headers -Body $taskdataToSend -ContentType "application/json"
      
      posted in FOG Problems
      S
      scottybullet
    • API - Powershell Create host and Deploy task script

      I hope this helps someone out. I am using this to deploy physicals from a Cloud Management Platform. I am sure others will have similar uses while integrating to other systems/tools.

      <#
      Description: Script that calls out to Fog Pxe Imaging Server to create a Host entry and start a deploy imaging task.
      Requirements: 
      -vComamnder 6.1.X or higher https://www.embotics.com
      -Powershell V4 or greater
      -Fog Version 1.4.4 or greater https://fogproject.org/
      
      Note:
      Your Environment may require additional or diffrent settings.  
      
      vCommander workflow Run Syntax:
      powershell.exe c:\Scripts\fog\DeployImage.ps1 -MachineName "#{target.settings.customAttribute['Name']}" -MacAddress "#{target.settings.customAttribute['MAC Address']}" -imagename "#{target.settings.customAttribute['Image']}"
      #>
                  
      
      [CmdletBinding()]
      	param(
              [switch]$Elevated,
              [Parameter(Mandatory=$True)]
              [String] $MachineName = $(Throw "Provide the target machines Name"),
              [String] $MacAddress = $(Throw "Provide the target machines MAC Address"),
              [String] $ImageName = $(Throw "Provide the Image Name to assign to the new target host")
              )
      
      #######################################################################################################################
      # Configure the variables below for the Fog Server
      #######################################################################################################################
          #FogServer
              $fogApiToken = 'Fog Api Token'
              $fogUserToken = 'Fog User Token'
              $fogServer = "fog IP addrress"
              $Description = "Created by vCommander"  
          
      ########################################################################################################################
      # Nothing to configure below this line - Starting the main function of the script
      ########################################################################################################################
      
      ########################################################################################################################
      # Setting Cert Policy - required for successful auth with the phpipam API if set to https
      ########################################################################################################################
      add-type @"
          using System.Net;
          using System.Security.Cryptography.X509Certificates;
          public class TrustAllCertsPolicy : ICertificatePolicy {
              public bool CheckValidationResult(
                  ServicePoint srvPoint, X509Certificate certificate,
                  WebRequest request, int certificateProblem) {
                  return true;
              }
          }
      "@
      [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
      [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
      
      ########################################################################################################################
          #Setup Auth headers and base url for FogServer
              $headers = @{};
              $headers.Add('fog-api-token', $fogApiToken);
              $headers.Add('fog-user-token', $fogUserToken);
              $baseUri = "http://$fogServer/fog"
          
          #Get Image List From Fog Server
              Try{
                  $ImageURL = $baseUri+"/image/"
                  $ImageResult = Invoke-RestMethod -Uri $ImageURL -Method GET -Headers $headers -ContentType "application/json"
                  $Image = $ImageResult.images | Select-object imageTypeID,id,name | Where-object {$_.name -eq $ImageName}
                  }Catch{Write-Host "Failed to get Image data from Fog" -ForegroundColor Red
                      $error[0] | Format-List -Force
                      Exit 1
                      }
      
          #GetHost List from fog Server ***Not nessicary but nice to have incase you want to use it for other data checks***
              Try{
                  $HostURL = $baseUri +"/host/"
                  $HostResult = Invoke-RestMethod -Uri $HostURL -Method GET -Headers $headers -ContentType "application/json"
                  }Catch{Write-Host "Failed to get HostList from Fog" -ForegroundColor Red
                      $error[0] | Format-List -Force
                      Exit 1
                      }
      
          #Create Host entry from vCommander
             $HostJson = @{
                                 "name"=  $MachineName
                                 "description"=  $Description
                                 "macs" =  @($MacAddress)
                                 "imageID"= $Image.id
                                 "imagename" =  $ImageName  
                                 }
              Try{                    
                  $CreateHostJson = ConvertTo-Json($HostJson)
                  $createHostURL = $baseUri +"/host/create"
                  $createHostResult = Invoke-RestMethod -Uri $createHostURL -Method POST -body $CreateHostJson -Headers $headers -ContentType "application/json"
                 }Catch{Write-Host "Failed to create host in Fog" -ForegroundColor Red
                      $error[0] | Format-List -Force
                      Exit 1
                      }
      
          #Get Task types to confirm Structure
               Try{
                   $TasktypesURL = $baseUri + "/tasktype"
                   $TasktypesResult = Invoke-RestMethod -Uri $TasktypesURL -Method GET -Headers $headers -ContentType "application/json"
                   $TasktypeID = ($TasktypesResult.tasktypes | Select-object name,id | Where-object {$_.name -eq "Deploy"}).id
                   }Catch{Write-Host "Failed to get Task types from Fog" -ForegroundColor Red
                      $error[0] | Format-List -Force
                      Exit 1
                      }
      
          #Create Task to Image Host    
              $ImageID = $image.id
              $HostID = $createHostResult.id  
      
              $TaskURL = $baseUri + "/host/" + $HostID + "/task"
              $TaskdataSet = @{
                  "hostname" = $createHostResult.name
                  "taskTypeID" = $TasktypeID
                  }
              Try{
                  $taskdataToSend = ConvertTo-JSON($TaskdataSet)
                  $TaskResult = Invoke-RestMethod -Method Post -Uri $TaskURL -Headers $headers -Body $taskdataToSend -ContentType "application/json"
                  }Catch{Write-Host "Failed to create Deploy Task in Fog" -ForegroundColor Red
                      $error[0] | Format-List -Force
                      Exit 1
                      }
      
      
      
      posted in Tutorials
      S
      scottybullet
    • RE: API - Create Host "error": "Required database field is empty"

      Got it, this is the syntax from Powershell

      $HostJson = @{
      “name”= $vmname
      “description”= $Description
      “macs” = @($MacAddress)
      “imageID”= $Image.id
      “imagename” = $ImageName
      }
      $CreateHostJson = ConvertTo-Json($HostJson)
      $createHostURL = $baseUri +“/host/create”
      $createHostResult = Invoke-RestMethod -Uri $createHostURL -Method POST -body $CreateHostJson -Headers $headers -ContentType “application/json”

      posted in FOG Problems
      S
      scottybullet

    Latest posts made by scottybullet

    • API - Powershell Create host and Deploy task script

      I hope this helps someone out. I am using this to deploy physicals from a Cloud Management Platform. I am sure others will have similar uses while integrating to other systems/tools.

      <#
      Description: Script that calls out to Fog Pxe Imaging Server to create a Host entry and start a deploy imaging task.
      Requirements: 
      -vComamnder 6.1.X or higher https://www.embotics.com
      -Powershell V4 or greater
      -Fog Version 1.4.4 or greater https://fogproject.org/
      
      Note:
      Your Environment may require additional or diffrent settings.  
      
      vCommander workflow Run Syntax:
      powershell.exe c:\Scripts\fog\DeployImage.ps1 -MachineName "#{target.settings.customAttribute['Name']}" -MacAddress "#{target.settings.customAttribute['MAC Address']}" -imagename "#{target.settings.customAttribute['Image']}"
      #>
                  
      
      [CmdletBinding()]
      	param(
              [switch]$Elevated,
              [Parameter(Mandatory=$True)]
              [String] $MachineName = $(Throw "Provide the target machines Name"),
              [String] $MacAddress = $(Throw "Provide the target machines MAC Address"),
              [String] $ImageName = $(Throw "Provide the Image Name to assign to the new target host")
              )
      
      #######################################################################################################################
      # Configure the variables below for the Fog Server
      #######################################################################################################################
          #FogServer
              $fogApiToken = 'Fog Api Token'
              $fogUserToken = 'Fog User Token'
              $fogServer = "fog IP addrress"
              $Description = "Created by vCommander"  
          
      ########################################################################################################################
      # Nothing to configure below this line - Starting the main function of the script
      ########################################################################################################################
      
      ########################################################################################################################
      # Setting Cert Policy - required for successful auth with the phpipam API if set to https
      ########################################################################################################################
      add-type @"
          using System.Net;
          using System.Security.Cryptography.X509Certificates;
          public class TrustAllCertsPolicy : ICertificatePolicy {
              public bool CheckValidationResult(
                  ServicePoint srvPoint, X509Certificate certificate,
                  WebRequest request, int certificateProblem) {
                  return true;
              }
          }
      "@
      [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
      [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
      
      ########################################################################################################################
          #Setup Auth headers and base url for FogServer
              $headers = @{};
              $headers.Add('fog-api-token', $fogApiToken);
              $headers.Add('fog-user-token', $fogUserToken);
              $baseUri = "http://$fogServer/fog"
          
          #Get Image List From Fog Server
              Try{
                  $ImageURL = $baseUri+"/image/"
                  $ImageResult = Invoke-RestMethod -Uri $ImageURL -Method GET -Headers $headers -ContentType "application/json"
                  $Image = $ImageResult.images | Select-object imageTypeID,id,name | Where-object {$_.name -eq $ImageName}
                  }Catch{Write-Host "Failed to get Image data from Fog" -ForegroundColor Red
                      $error[0] | Format-List -Force
                      Exit 1
                      }
      
          #GetHost List from fog Server ***Not nessicary but nice to have incase you want to use it for other data checks***
              Try{
                  $HostURL = $baseUri +"/host/"
                  $HostResult = Invoke-RestMethod -Uri $HostURL -Method GET -Headers $headers -ContentType "application/json"
                  }Catch{Write-Host "Failed to get HostList from Fog" -ForegroundColor Red
                      $error[0] | Format-List -Force
                      Exit 1
                      }
      
          #Create Host entry from vCommander
             $HostJson = @{
                                 "name"=  $MachineName
                                 "description"=  $Description
                                 "macs" =  @($MacAddress)
                                 "imageID"= $Image.id
                                 "imagename" =  $ImageName  
                                 }
              Try{                    
                  $CreateHostJson = ConvertTo-Json($HostJson)
                  $createHostURL = $baseUri +"/host/create"
                  $createHostResult = Invoke-RestMethod -Uri $createHostURL -Method POST -body $CreateHostJson -Headers $headers -ContentType "application/json"
                 }Catch{Write-Host "Failed to create host in Fog" -ForegroundColor Red
                      $error[0] | Format-List -Force
                      Exit 1
                      }
      
          #Get Task types to confirm Structure
               Try{
                   $TasktypesURL = $baseUri + "/tasktype"
                   $TasktypesResult = Invoke-RestMethod -Uri $TasktypesURL -Method GET -Headers $headers -ContentType "application/json"
                   $TasktypeID = ($TasktypesResult.tasktypes | Select-object name,id | Where-object {$_.name -eq "Deploy"}).id
                   }Catch{Write-Host "Failed to get Task types from Fog" -ForegroundColor Red
                      $error[0] | Format-List -Force
                      Exit 1
                      }
      
          #Create Task to Image Host    
              $ImageID = $image.id
              $HostID = $createHostResult.id  
      
              $TaskURL = $baseUri + "/host/" + $HostID + "/task"
              $TaskdataSet = @{
                  "hostname" = $createHostResult.name
                  "taskTypeID" = $TasktypeID
                  }
              Try{
                  $taskdataToSend = ConvertTo-JSON($TaskdataSet)
                  $TaskResult = Invoke-RestMethod -Method Post -Uri $TaskURL -Headers $headers -Body $taskdataToSend -ContentType "application/json"
                  }Catch{Write-Host "Failed to create Deploy Task in Fog" -ForegroundColor Red
                      $error[0] | Format-List -Force
                      Exit 1
                      }
      
      
      
      posted in Tutorials
      S
      scottybullet
    • RE: API - Create Host Deploy Task "error": "Invalid tasking type passed"

      Figured this out, I hope it helps someone out… this PS Script creates a Host and then creates a deploy task to the Image specified when the host was created.

      $vmname = "vmname"
      $MacAddress = "00:00:00:00:00:00"
      $ImageName = "ImageName"
      
      #######################################################################################################################
      # Configure the variables below for the Fog Server
      #######################################################################################################################
          #FogServer
              $fogApiToken = 'your token'
              $fogUserToken = 'your user token'
              $fogServer = "fog server IP or dns name"
              $Description = "Created by vCommander"   # www.embotics.com
          
      ########################################################################################################################
      # Nothing to configure below this line - Starting the main function of the script
      ########################################################################################################################
      
      ########################################################################################################################
      # Setting Cert Policy - required for successful auth with the server if set to https
      ########################################################################################################################
      add-type @"
          using System.Net;
          using System.Security.Cryptography.X509Certificates;
          public class TrustAllCertsPolicy : ICertificatePolicy {
              public bool CheckValidationResult(
                  ServicePoint srvPoint, X509Certificate certificate,
                  WebRequest request, int certificateProblem) {
                  return true;
              }
          }
      "@
      [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
      [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
      
      ########################################################################################################################
          #Setup Auth headers and base url for FogServer
              $headers = @{};
              $headers.Add('fog-api-token', $fogApiToken);
              $headers.Add('fog-user-token', $fogUserToken);
              $baseUri = "http://$fogServer/fog"
          
          #Get Image List From Fog Server
              $ImageURL = $baseUri+"/image/"
              $ImageResult = Invoke-RestMethod -Uri $ImageURL -Method GET -Headers $headers -ContentType "application/json"
              $Image = $ImageResult.images | Select-object imageTypeID,id,name | Where-object {$_.name -eq $ImageName}
             
      
          #GetHost List from fog Server
              $HostURL = $baseUri +"/host/"
              $HostResult = Invoke-RestMethod -Uri $HostURL -Method GET -Headers $headers -ContentType "application/json"
      
          #Create Host entry from vCommander
             $HostJson = @{
                                 "name"=  $vmname
                                 "description"=  $Description
                                 "macs" =  @($MacAddress)
                                 "imageID"= $Image.id
                                 "imagename" =  $ImageName  
                                 }
              $CreateHostJson = ConvertTo-Json($HostJson)
              $createHostURL = $baseUri +"/host/create"
              $createHostResult = Invoke-RestMethod -Uri $createHostURL -Method POST -body $CreateHostJson -Headers $headers -ContentType "application/json"
      
          #Get Task types to confirm Structure
               $TasktypesURL = $baseUri + "/tasktype"
               $TasktypesResult = Invoke-RestMethod -Uri $TasksURL -Method GET -Headers $headers -ContentType "application/json"
               $TasktypeID = ($TasktypesResult.tasktypes | Select-object name,id | Where-object {$_.name -eq "Deploy"}).id
      
          #Create Task to Image Host    
              $ImageID = $image.id
              $HostID = $createHostResult.id  
      
              $TaskURL = $baseUri + "/host/" + $HostID + "/task"
              $TaskdataSet = @{
                  "hostname" = $createHostResult.name
                  "taskTypeID" = $TasktypeID
                  }
              $taskdataToSend = ConvertTo-JSON($TaskdataSet)
              $TaskResult = Invoke-RestMethod -Method Post -Uri $TaskURL -Headers $headers -Body $taskdataToSend -ContentType "application/json"
      
      posted in FOG Problems
      S
      scottybullet
    • RE: API - Create Host Deploy Task "error": "Invalid tasking type passed"

      @george1421
      Correct, this will be API specific and I am getting the ID of the Deploy task type form another api call. the raw json I am passing is this:

      {
          "typeID":  "1",
          "imageID":  "1",
          "type":  "1",
          "stateID":  1
      }
      

      I saw a Sample to run a single Snapin Task as :

      since I am only running a Deploy Task I would assume to meed the hostID in the URL as i am

      http://10.10.12.24/fog/host/12/task
      

      my ImageID is 1 since it’s the first one I have created and type is 1 for Deploy task… I was just guessing at TypeID and StateID.

      posted in FOG Problems
      S
      scottybullet
    • RE: API - Create Host Deploy Task "error": "Invalid tasking type passed"

      This is what a qued deploy task looks like from the api:

      
      id                 : 2
      name               : Deploy Task
      checkInTime        : 0000-00-00 00:00:00
      hostID             : 2
      stateID            : 1
      createdTime        : 2017-12-06 18:35:47
      createdBy          : fog
      isForced           : 0
      scheduledStartTime : 0000-00-00 00:00:00
      typeID             : 1
      pct                : 0000000000
      bpm                : 
      timeElapsed        : 
      timeRemaining      : 
      dataCopied         : 
      percent            : 
      dataTotal          : 
      storagegroupID     : 1
      storagenodeID      : 1
      NFSFailures        : 
      NFSLastMemberID    : 0
      shutdown           : 
      passreset          : 
      isDebug            : 0
      imageID            : 1
      wol                : 1
      image              : @{imageTypeID=1; imagePartitionTypeID=1; id=1; name=Ubuntu1604minimal; description=Base Ubuntu 16.04 Image; path=Ubuntu1604minimal; createdTime=2017-12-06 15:07:51; createdBy=fog; building=0; size=60477440.000000:20961034240.000000:; 
                           osID=50; deployed=2017-12-06 15:55:46; format=0; magnet=; protected=0; compress=6; isEnabled=1; toReplicate=1; srvsize=984037345; os=; imagepartitiontype=; imagetype=; imagetypename=Single Disk - Resizable; 
                           imageparttypename=Everything; osname=Linux; storagegroupname=default; hosts=System.Object[]; storagegroups=System.Object[]}
      host               : @{id=2; name=005056a47ffc; description=Created by FOG Reg on December 6, 2017, 3:37 pm; ip=; imageID=1; building=0; createdTime=2017-12-06 15:37:39; deployed=0000-00-00 00:00:00; createdBy=fog; useAD=; ADDomain=; ADOU=; ADUser=; 
                           ADPass=; ADPassLegacy=; productKey=; printerLevel=; kernelArgs=; kernel=; kernelDevice=; init=; pending=; pub_key=; sec_tok=; sec_time=0000-00-00 00:00:00; pingstatus=<i class="icon-ping-down fa fa-exclamation-circle red fa-1x" 
                           title="No such device or address"></i>; biosexit=; efiexit=; enforce=; primac=00:50:56:a4:7f:fc; imagename=Ubuntu1604minimal; hostscreen=; hostalo=; inventory=; macs=System.Object[]}
      type               : @{id=1; name=Deploy; description=Deploy action will send an image saved on the FOG server to the client computer with all included snapins.; icon=download; kernel=; kernelArgs=type=down; type=fog; isAdvanced=0; access=both}
      state              : @{id=1; name=Queued; description=Task has been created and FOG is waiting for the Host to check-in.; order=1; icon=bookmark-o}
      storagenode        : @{id=1; name=DefaultMember; description=Auto generated fog nfs group member; isMaster=1; storagegroupID=1; isEnabled=1; isGraphEnabled=1; path=/images/; ftppath=/images/; bitrate=; snapinpath=/opt/fog/snapins; 
                           sslpath=/opt/fog/snapins/ssl; ip=10.10.12.24; maxClients=10; user=fog; pass=I1MKdP3eIKFmA4jgrbHjO9+J3LohoizYUag9qOqj4Rg=; key=; interface=ens160; bandwidth=0; webroot=/fog/; storagegroup=}
      storagegroup       : @{id=1; name=default; description=Auto generated fog nfs group}
      
      posted in FOG Problems
      S
      scottybullet
    • API - Create Host Deploy Task "error": "Invalid tasking type passed"

      After Creating hosts and Assigning the image now trying to create a deploy task. I am getting “Invalid tasking type passed” This is what i am running:

      $TaskURL = $baseUri + "/host/" + $HostID + "/task"
              $TaskdataSet = @{
                  "imageID" = $Image.id
                  "type" = "1"
                  "typeID" = $TasktypeID
                  "stateID" = 1
                  }
              $taskdataToSend = ConvertTo-JSON($TaskdataSet)
              $TaskResult = Invoke-RestMethod -Method Post -Uri $TaskURL -Headers $headers  -Body $taskdataToSend -ContentType "application/json"
      
      posted in FOG Problems
      S
      scottybullet
    • RE: API - Create Host "error": "Required database field is empty"

      Got it, this is the syntax from Powershell

      $HostJson = @{
      “name”= $vmname
      “description”= $Description
      “macs” = @($MacAddress)
      “imageID”= $Image.id
      “imagename” = $ImageName
      }
      $CreateHostJson = ConvertTo-Json($HostJson)
      $createHostURL = $baseUri +“/host/create”
      $createHostResult = Invoke-RestMethod -Uri $createHostURL -Method POST -body $CreateHostJson -Headers $headers -ContentType “application/json”

      posted in FOG Problems
      S
      scottybullet
    • RE: API - Create Host "error": "Required database field is empty"

      Thanks, Is there any reason the Image name wouldn’t get populated? This works minus the image name:
      $HostJson = @{
      “name”= $vmname
      “description”= $Description
      “macs” = @($MacAddress)
      “imagename” = $ImageName
      }
      $CreateHostJson = ConvertTo-Json($HostJson)
      $createHostURL = $baseUri +“/host/create”
      $createHostResult = Invoke-RestMethod -Uri $createHostURL -Method POST -body $CreateHostJson -Headers $headers -ContentType “application/json”

      posted in FOG Problems
      S
      scottybullet
    • API - Create Host "error": "Required database field is empty"

      Hello, I am trying to do a create host api call to eventually automate imaging some hardware. I can get data from fog all day long but when it comes to posting data to create a host it gives me this error: “error”: “Required database field is empty” this is what my post looks like:

       $CreateHostJson = @{
                                  "name"=  "$vmname"
                                  "description"=  "$Description"
                                  "primac" =  "$MacAddress"
                                  "imagename" =  "$ImageName"    
                                  }
              $createHostURL = $baseUri +"/host/create/"
              $createHostResult = Invoke-RestMethod -Uri $createHostURL -Method POST -Headers $headers -body $CreateHostJson -ContentType "application/json"
      

      Any help would be appreciated

      posted in FOG Problems
      S
      scottybullet