Set UserOptions fields via REST

Idea ID 2834168

Set UserOptions fields via REST

It has to be possible to set fields of UserOptions via REST.

At the moment it is possible to use a REST call to open a request for an offering without filling in the UserOptions, even if they are marked as mandatory.
In my opinion this is a major failure.
However, in my opinion it is not enough to prevent this, but it should also be possible to order an offering via REST, just like via the portal. This includes the specification of UserOptions.

6 Comments
Micro Focus Expert
Micro Focus Expert

You should be able to create a Request by API and pass User Option details embedded in the JSON Payload.

This is not officially documented and hence the Idea posted here should be considered by Product Management for official support. Yet with this disclaimer, you can try the following:  

 

1) Invoke the createRequest API as in https://<YOUR_SMAX_HOS>/rest/<TENANT_ID>/ess/request/createRequest

2) The JSON Body should be as in the following example:

{

         "entities": [{

                   "entity_type": "Request",

                   "properties": {

                            "Description": "Test",

                            "DisplayLabel": "Test Title",

                            "RequestedForPerson": "<Some User ID>",

                            "RequestsOffering": "<Your Offering ID>",

                            "RequestedByPerson": "<Some User ID>",

                            "ImpactScope":"Enterprise",

                            "Urgency":"SlightDisruption",

                            "UserOptions": "{\"complexTypeProperties\":[{\"properties\":{\"OPTION1_c\":\"OPTION_1_VALUE\",\"OPTION2_c\":\"OPTION2_VALUE\", ... }}]}"

                   }

         }],

         "operation": "CREATE"

}

 

Again - the above has been used for some special cases, and you may try it. But the feature described here should be added to the official supported documentation for supported adoption.

 

Thanks for your help, your solution works 😊
But of course it would be even better if this would be officially supported.

Micro Focus Expert
Micro Focus Expert

Thanks for trying it out and confirming. We will be considering the point of making this 'officially' supported.

Micro Focus Expert
Micro Focus Expert
Status changed to: Waiting for Votes

Thank you for sharing your idea! It’s open for comments and kudos, and we’re looking forward to input from the community. Once there is enough community traction, it will be further reviewed by the product team.

Micro Focus Expert
Micro Focus Expert

Ideally, the REST API should be enhanced so that it becomes consistent with the way that user options can be accessed from within business rules (i.e. entity.UserOption.OptionName)

e.g.


{
         "entities": [{
                   "entity_type": "Request",
                   "properties": {
                            "DisplayLabel": "Test Title",

...

                            "UserOptions
                            {
                                    "OPTION1_c": "OPTION_1_VALUE",
                                    "OPTION2_c": "OPTION2_VALUE",
                                    ...
                             }
                   }
         }],
         "operation": "CREATE"
}

Not directly related to this use case, but very similar nonetheless:
The same could be done for complex properties (in the SACM area)

Andre

Vice Admiral Vice Admiral
Vice Admiral

I like the idea and I agree this is a bug (perhaps design bug) and no enhancement request. There are much more API calls faulty or missing, e.g. the response of an API call to receive a request with its user options, all user options only contain their ids and not the display value. This should also be fixed.

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.