|
Post by kennyfully on Dec 19, 2021 21:33:00 GMT
I have no problem using patch functions on an uri that doesn't have any fragments (#) on it. However, I am having a huge problem patching any uri that involves a fragment. If I am correct, the url that I will be patching will have 2 fragments (#) on it. I am very confused about how this can work out. I've been looking and reading the Redfish Specification document for a solution, but I can't seem to find any solutions. The below is just a modified example of the source of my problem.
{
"@odata.id": "/redfish/v1/Chassis/chassis/Assembly",
"@odata.type": "#Assembly.v1_3_0.Assembly",
"Assemblies": [
{
"@odata.id": "/redfish/v1/Chassis/chassis/Assembly#/Assemblies/0",
"@odata.type": "#Assembly.v1_3_0.AssemblyData", "LocationIndicatorActive": false }, {
"@odata.id": "/redfish/v1/Chassis/chassis/Assembly#/Assemblies/1",
"@odata.type": "#Assembly.v1_3_0.AssemblyData",
"LocationIndicatorActive": false
} ], "Assemblies@odata.count": 2,
"Id": "Assembly",
"Name": "Assembly Collection" }
|
|
|
Post by shawn on Dec 20, 2021 1:08:23 GMT
I don't quite understand your question but if you're trying to change "LocationIndicatorActive" in the "Assemblies" property in your case, you probably could refer to "PATCH on array properties" section in Redfish spec. The other possible ways are that if the "/redfish/v1/Chassis/chassis/Assembly#/Assemblies/1" is accessible like a real resource, you could access it without fragments (#), or deep operation if the service supports this feature, and you should capable updating it like a general resource.
However, I still don't see why we have to do it in a resource collection. Maybe it's useful for others but IMO I think operation on a single resource is much clear to do deep operation on it.
|
|
|
Post by kennyfully on Dec 20, 2021 2:53:47 GMT
Thank you very much for your help.
Yes, I'm trying to change "LocationIndicatorActive" in one of the objects in "Assemblies".
I will try to patch on the array property first and if I don't see any luck with that, I will try deep operations, just like you suggested. I appreciate your help. I will let you know if any of these suggestions solve my problem.
|
|
|
Post by mraineri on Dec 20, 2021 14:42:57 GMT
Keep in mind, URI values that contain a # are not targets for HTTP operations; the portion to the left of the # is the resource URI (which accepts HTTP operations), and the portion to the right is a JSON path descriptor to reference a location in the resource. For PATCHing an Assembly resource, you would PATCH "/redfish/v1/Chassis/chassis/Assembly". In the payload, you would follow the "PATCH on array properties" semantics Shawn pointed out. So, if you're trying to set the location indicator in array index 1, the payload would look like this:
{ "Assemblies": [ {}, { "LocationIndicatorActive": true } ] }
|
|
|
Post by kennyfully on Dec 20, 2021 23:33:29 GMT
Yes, indeed, this worked for me. I am very happy for all the help that was given to me! Thank you very much, shawn and mraineri! It really saved me from a world of trouble!
|
|