HPE OneView
cancel
Showing results for 
Search instead for 
Did you mean: 

REST API assign server profile from a template

 
SOLVED
Go to solution
BradV
Trusted Contributor

REST API assign server profile from a template

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.

6 REPLIES 6
DaveArko
Occasional Advisor
Solution

Re: REST API assign server profile from a template

 

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

"A profile object will be returned with the configuration based on this template. Specify the profile name and server hardware to assign. If template has any fibre channel connection which is configured to boot from user defined targets but boot target is not specified in template, then boot target must be specified for that connection during creation of profile. This profile object can subsequently be used for the POST https://{appl}/rest/server-profiles/ API."
 
So basically you will do a GET using this path (with {id} of that of your template), and then modify it as needed (with the server-hardware URI, etc), then POST it back to /rest/server-profiles to create and assign the profile.
BradV
Trusted Contributor

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!

DaveArko
Occasional Advisor

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!

 

BradV
Trusted Contributor

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.

DaveArko
Occasional Advisor

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.

 

BradV
Trusted Contributor

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!