|
Post by AMI_SzuJin on Jan 27, 2022 9:32:10 GMT
Hi, I have questions about the property of odata.id in POST request body. When POST new session, @odata.id property in response body would like what Redfish Specification mention, shows the resource URI which I've just created. But when POST new account or new role, @odata.id property in response body shows collection resource like: { "@odata.id":"/redfish/v1/AccountService/Accounts" } or { "@odata.id":"/redfish/v1/AccountService/Roles" } Could you please explain why they are inconsistent? Or which result is more reasonable? Thanks, SzuJin
|
|
|
Post by shawn on Jan 27, 2022 9:50:26 GMT
That's strange. Could you give us a real example of it? From my understanding, when a user create a resource, the response should the information of the created resource. For example, when you create an account via /redfish/v1/AccountService/Accounts, the @odata.id in the response body might be "/redfish/v1/AccountService/Accounts/3" according to your uri rule.
Edit: By the way, there's a perfect example you could refer to in the DSP0266 13.3.4.2 Session login.
================================== Request:
POST /redfish/v1/SessionService/Sessions HTTP/1.1 Host: <host-path> Content-Type: application/json;charset=utf-8 Content-Length: <computed-length> Accept: application/json;charset=utf-8 OData-Version: 4.0
{ "UserName": "<username>", "Password": "<password>" }
================================== Response:
HTTP/1.1 201 Created Location: /redfish/v1/SessionService/Sessions/1 X-Auth-Token: <session-auth-token>
{ "@odata.id": "/redfish/v1/SessionService/Sessions/1", "@odata.type": "#Session.v1_0_0.Session", "Id": "1", "Name": "User Session", "Description": "User Session", "UserName": "<username>", "Password": null }
|
|
|
Post by mraineri on Jan 28, 2022 1:32:14 GMT
I agree with shawn; I'm not sure I follow the inconsistency.
As pointed out, the POST response body (if there is a response body) contains the representation of the new resource, and the @odata.id property would be the URI of the new member of the collection (and not the collection itself).
|
|
|
Post by AMI_SzuJin on Jan 28, 2022 8:51:13 GMT
Got it! Thanks for the reply.
|
|