- Community Home
- >
- Software
- >
- HPE OneView
- >
- Re: REST API assign server profile from a 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
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
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
07-30-2019 09:46 AM
07-30-2019 09:46 AM
Can someone point me to the correct API? I have a server profile template defined. I want to use that to assign/create a server profile for a given server. Not finding the correct reference.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2019 12:57 PM
07-30-2019 12:57 PM
Solution
The API you are looking for is documented in the server-profile-templates section of the API docs:
GET /rest/server-profile-templates/{id}/new-profile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2019 02:12 AM
07-31-2019 02:12 AM
Re: REST API assign server profile from a template
Thanks, but how does one identify the UUID? It says: "Retrieves a server profile template managed by the appliance based on its UUID." However, when I execute: GET ${OneView}/rest/server-profile-templates, I don't see anything labeled as UUID. Would the UUID be the last part of the URI? OK, I just tested that and it works. I think HPE needs to point that out in the API reference and/or modify the API to return the UUID as a seperate value. Thanks again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2019 09:31 AM
07-31-2019 09:31 AM
Re: REST API assign server profile from a template
I see your point - docs are using UUID and {Id} interchangeably. I submitted a request to have this improved. Thanks for your feedback!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2019 05:49 AM
08-07-2019 05:49 AM
Re: REST API assign server profile from a template
When I try this, what am I supposed to get back? The name is null. Uri is null. state says creating. taskuri is null. I look in the gui and there is no new server profile created. I do get back a json that looks like a server profile, but no "handle" that I can see to use to apply this new profile to a host.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2019 09:49 AM
08-07-2019 09:49 AM
Re: REST API assign server profile from a template
When you do a GET on https://<ov-appliance//rest/server-profile-templates/<templante-id>/new-profile you get back a profile object that needs some modifications. You need to fill in the missing info such as the "serverHardwareUri" (which you get from the server-hardare list). And "name". I just tried a simple template, and those were the two required things to fill in.
Then do a POST with that object to https://<ov-appliance>/rest/server-profiles and it should apply it to the server-hardware that you set via the serverHardwareUri attribute in the object.
You can ignore the state/taskuri, etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2019 04:11 AM
08-08-2019 04:11 AM
Re: REST API assign server profile from a template
Oh! That was not at all clear! Thanks! Most of the other functions return a task uri that you then reference. I was expecting something like that or an object reference, not the actual object. I'll work on that and see if I can implement properly.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2020 07:15 AM
04-08-2020 07:15 AM
Re: REST API assign server profile from a template
Finally got back to this. Did the following:
NEWPROF=$(curl --insecure \
--header "X-API-Version" ${currentVersion}" \
--header "auth: ${sessionID}" \
--request GET ${OneView}/rest/server-profile-templates/<id>/new-profile)
# The variable HARDW points to a file where I have extracted all of the hardware from OneView
DATA2=$(jq -r '.members[] | select(.serverName=="myservername")' ${HARDW}
HRDWURI=$(echo ${DATA2} | jq -r '.uri')
NAM=$(echo ${DATA2} | jq -r '.name')
NEWPROF=$(echo ${NEWPROF} | sed -e "s|\name\":\)null|\1\"${NAM}\"|")
NEWPROF=$(echo ${NEWPROF} | sed -e "s|\serverHardwareUri\":\)null|\1\"${HRDWURI}\"|")
curl --insecure
--header "X-API-Version" ${currentVersion}" \
--header "auth: ${sessionID}" \
--header "content-type: application/json" \
--include \
--data "${NEWPROF}" \
--request POST ${OneView}/rest/server-profiles
and I get back
parse error: Invalid numeric literal at line 1, column 9
I echoed ${NEWPROF} | jq -r '.' and it parses just fine. Any idea what might be wrong?