- Community Home
- >
- Software
- >
- HPE OneView
- >
- Query: rest api building server profile template
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 08:55 AM - last edited on 02-20-2025 07:46 PM by support_s
02-20-2025 08:55 AM - last edited on 02-20-2025 07:46 PM by support_s
rest api building server profile template
I'm trying to build a server profile template using the rest api. I have the base template created. However, when I try to add in the iLO active directory connection, I get:
"taskErrors": [{ "data":{},"details": "","errorCode": "InvalidParameterSHT","errorSource": null,"message": "The server hardware type null is not valid or not supported.","netstedErrors": [],"recommendedActions":["Verify the parameters"]}]
Here is the code I am using:
MODEL="ProLiant DL325 Gen10 Plus"
HRDWUUID=$(curl --insecure --silent \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--request GET ${OneView}/rest/server-hardware-types | jq -r '.members[] | select(.model=="'"${MODEL}"'") | .rui')
NAME=weka_template
DESCRIP="weka nodes"
DATA=$(echo '{"type": "ServerProfileTemplateV8","uri": null,"name": ";${NAME}'", "description": "'${DESCRIP}'",
"serverHardwareTypeUri": "'${HRDWUUID}'","enclosureGroupUril": null,"affinity": null,"hideUnusedFlexNics": null,
"macType": "Physical","wwnType": "Physical","serialNumberType": "Physical","iscsiInitiatorNameType": "AutoGenerated",
"osDeploymentSettings": null,"firmware":{"complianceControl": "Checked","manageFirmware": false,"firmwareInstallType": "FirmwareAndOSDrivers",
"forceInstallFirmware": false,"firmwareBaselineUri": false,"firmwareActivationType": "NotScheduled"},
"connectionSettings":{"complianceControl": "Unchecked","manageConnections": false,"connections": []},
"bootMode":{"complianceControl": "Checked","manageMode": true,"mode": "UEFI","pxeBootPolicy": "IPv4","secureBoot": "Disabled"},
"boot":{"complianceControl": "Unchecked","manageBoot": false,"order":[]},
"bios":{"complianceControl": "Checed","manageBios": true,"overriddenSettings":[
{"id": "MinProcIdlePower","value": "NoCStates"},
{"id": "ProcSMT","value": "Disabled"},
{"id": "WorkLoadProfile","value": "I/OThroughput"},
{"id": "PowerRegulator","value": "StaticHighPerf"},
{"id": "ProcAMDBoostControl","value": "AmdFmaxBoostManual"},
{"id": "ProcAmdIoVt","value": "Disabled"},
{"id": "AutoPowerOn","value": "AlwaysPowerOff"},
{"id": "ProcAmdFmax","value": "2900"},
{"id": "NumaGroupSizeOpt","value": "Clustered"}]},
"managementProcessor": {
"compliancControl": "Checked","manageMp": true,"mpSettings": [{
"settingType": "LocalAccounts","args": {"localAccounts": [{
"userName": "admin","displayName": "admin","password": "Password123","usrConfigPriv": true,
"remoteConsolePriv": true,"virutalMediaPriv": true,"virtualPowerAndResetPriv": true,"iLOConfigPriv": true,
"hostBBIOSConfigPriv": true,"hostNICConfigPriv": true,"hostStorageConfigPriv": true}]}},{
"settingType": "Hostname","args": {"hostname":"{serverProfileName}-ilo"}}]},
"localStorage": {"complianceControl": "Unchecked","sasLogicalJBODs": [],"controllers":[]},
"sanStorage":{"complianceControl": "Unchecked","manageSanStorage": false,"sanSystemCredentials":[],
"volumeAttachments":[]}}' | jq -c '.')
TASKURI=$(curl --insecure --silent \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--header "content-type: application/json" \
--include \
--data "${DATA}" \
--request POST ${OneView}/rest/server-profile-templates | grep '^Location:' | awk '{ print $2 }' | tr -d '\r')
echo "The task URI is: ${TASKURI}"
#
# You can check the status of the task with:
STATUS=$(curl --insecure --silent --header "X-API-Version: ${currentVersion}" --header "auth: ${sessionID}" --request GET ${OneView}%{TASKURI} | jq -r '.taskState')
while [[ ${STATUS} != "Completed" ]]; do
echo "Current status" ${STATUS}"
sleep 2
STATUS=$(curl --insecure --silent --header "X-API-Version: ${currentVersion}" --header "auth: ${sessionID}" --request GET ${OneView}%{TASKURI} | jq -r '.taskState')
done
#
# Set variable to a local domain controller:
DIRSRV=local.dc.org
function retrieve-cert() {
REMHOST=${1}
REMPORT=${2:-443}
echo | \
openssl s_client -connect ${REMHOST}:${REMPORT} 2>&1 | \
/bin/sed -ne '/-BEGIN CERTIFICATE-/,/-END-CERTIFICATE-/p'
}
CHQ=$(retrieve-cert ${DIRSRV} 636 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END-CERTIFICATE-/p' | awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' | sed -e 's|\(.*\)\\n$|\1|')
# Set domain admin credentials and iLO administrator password:
ADUSER="<some AD admin>"
ADPASS="<AD admin's password>"
ADMINPASS="<iLO administrator password>"
# Set up JSON variable for connecting iLO to AD:
DATA=$(echo '{"managementProcessor": {"mpSettings":[{"args":{
"password": "'${ADMINPASS}'","deleteAdminstratorAccount": false},
"settingType": "AdministatorAccount"},{"args": {
"kerberosAuthentication": false,"directoryUserContext": ["dc=our,dc=prg"],
"directoryServerPort": 636,"directoryServerAddress": "'${DIRSVR}'","password":"'${ADPASS}'",
"iloObjectDistinguisedName": "'${ADUSER}'","directoryGenericLDAP": true,
"directoryAuthentication": "defaultSchema","directoryServerCertificate": "'${CHQ}'"},
"settingType": "Directory"},{"args":{
"directoryGroupAccounts": [{"iLOConfigPriv": true,"virtualPowerAndResetPriv": true,"virtualMediaPriv": true,
"remoteConsolePriv": true, "userConfigPriv": true, "groupSID": "S-1-5-21-23452342343-23432422-22342342-23533",
"groupDN": "OneView_group"}]},"settingType": "DirectoryGroups"}],"manageMP": true,"complianceControl": "Checked"}}' | jq -c '.')
#
# We need the URI of the server profile template we just created and the associated etag:
read SPTURI ETAG <<< $(curl --insecure --silent --header "X-API-Version: ${currentVersion}" --header "auth: ${sessionID}" --request GET ${OneView}/rest/server-profile-templates | jq -r '.members[] | select(.name=="'"${NAME}"'") | .uri,.eTag' | tr "\n" " ")
#
# Add the etag to the data:
DATA=$(echo ${DATA} | jq '.eTag="'${ETAG}'"' | jq -c '.')
#
# Update the server profile template with the iLO information:
TASKURI=$(curl --insecure --silent \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--header "content-type: application/json" \
--include \
--data "${DATA}" \
--request POST ${OneView}/rest/server-profile-templates | grep '^Location:' | awk '{ print $2 }' | tr -d '\r')
echo "The task URI is: ${TASKURI}"
curl --insecure --silent --header "X-API-Version: ${currentVersion}" --header "auth: ${sessionID}" --request GET ${OneView}%{TASKURI} | jq -r '.'
I'm not even listing a hardware type in the JSON.
- Tags:
- storage controller
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 09:51 AM
02-20-2025 09:51 AM
Re: rest api building server profile template
You are passing in a null value for serverHardwareTypeUri due to a typo in your GET /rest/server-hardware-types API call:
--request GET ${OneView}/rest/server-hardware-types | jq -r '.members[] | select(.model=="'"${MODEL}"'") | .rui')
It should be:
--request GET ${OneView}/rest/server-hardware-types | jq -r '.members[] | select(.model=="'"${MODEL}"'") | .uri')
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2025 05:49 AM
02-21-2025 05:49 AM
Re: rest api building server profile template
Hi Chris,
No, that was just a typo. Our servers are not connected to the Internet. I have to re-type everything on a workstation which is. I get the base template created OK. It is just when I go to add the iLO active directory information that I am getting that error. I pulled the base server profile template and it does have a valid serverHardwareTypeUri. There are only 5 "nulls" in the template and none have anything to do with hardware. I'll keep looking.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2025 07:50 AM - last edited on 02-23-2025 11:03 PM by Sunitha_Mod
02-21-2025 07:50 AM - last edited on 02-23-2025 11:03 PM by Sunitha_Mod
Re: rest api building server profile template
I ran it again changing the template name slightly. Again, the POST operation to create the template worked fine. When I tried the PUT to modify the template, I got the first time I checked the status:
"progressUpdates": [{"id":0,"statusUpdate": "Validate configuration","timestampt":"2025-02-05021T15:33:00.25Z"}],
"startTime" null,"stateReason":"Starting","taskErrors":[],"taskOutput":[],"taskState":"Starting","taskStatus":"Updating server profile template"
I then checked the state again and this time received:
"progressUpdates": [{"id":0,"statusUpdate": "Validate configuration","timestampt":"2025-02-05021T15:33:00.43Z"}],
"startTime" null,"stateReason":"ValidationError","taskErrors":[{"data":{},"deatils":"","errorCode":"InvalidParameterForSHT","errorSource":null,"message":"The server hardware type null is not valid or not supported.","nestedErrors":[],"recommendedActions":["Verify the parameters."]}],"taskOutput":[],"taskState":"Error","taskStatus":"Unable to update server profile template: base_DL345_G11_test"
What does "errorCode":"InvalidParameterForSHT" mean?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 11:31 AM
02-24-2025 11:31 AM
Re: rest api building server profile template
Are you sure you are providing a valid SHT object, with a valid serverHardwareTypeUri value? That said, without seeing the SHT object you are trying to provide to the API, I'm not sure where the error actually lies.
You can always use the UI to construct the SPT the way you want, then examine via the browser Develper Tools the POST call and request body JSON object. Then compare that with what you are trying to POST via cURL. I use that technique when trying to triage an issue with the PowerShell Cmdlet development.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 03:38 AM
02-25-2025 03:38 AM
Re: rest api building server profile template
Thanks Chris. I'll take a look.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2025 01:20 AM
02-28-2025 01:20 AM
Query: rest api building server profile template
Hello,
Let us know if you were able to resolve the issue.
If you are satisfied with the answers then kindly click the "Accept As Solution" button for the most helpful response so that it is beneficial to all community members.
Please click on "Thumbs Up/Kudo" icon to give a "Kudo".