2023 Sep 28 5:44 AM
Dear All,
We have documentations on getting the OpenAPI. And is working fine only for the Custom Odata with GET Method.
Whereas, am unable to convert POST Method from the same Custom Odata to OpenAPI.
Here is the Odata Screen from Gateway Client for which I would like to get OpenAPI. Please help me.
Thanks and regards,
Ramani
2023 Sep 28 12:18 PM
Hi Ramani,
That's the correct URL to get $metadata.
Looking at the metadata.xml and assuming it is what the $metadata request returns, I would have expected the POST request to fail because the fiPostingHeaderSet does not allow creating new entities.
Which means the service implementation and its $metadata are out of sync.
If this service was defined with transaction SEGW, then maybe the service developer forgot to tick the box for "creatable: true" on fiPostingHeaderSet.
You could manually tweak the metadata.xml file accordingly and run the OpenAPI converter to check whether it produces what you expect. Long-term you should contact the service developer to get $metadata back in sync with the implementation.
2023 Sep 28 8:11 AM
Guessing from the URL pattern I assume you are using OData V2, flPostingHeaderSet is an entity set, and you are trying to create a new entity in this entity set via a POST request.
This kind of request is supported by this OData-to-OpenAPI converter, see this example:
OData entity set: https://github.com/oasis-tcs/odata-openapi/blob/cdc96556b4111dfca658ac7b3678fdf8a5a81492/examples/od...
OpenAPI operation: https://github.com/oasis-tcs/odata-openapi/blob/a9ebd6a9d021bd670546d06d393dbc5bd942ee0a/examples/od...
2023 Sep 28 9:49 AM
Thanks Ralf Handl for your quick reply!
When I ran it with my metadata.xml, it created a json file next to it. But I unable to see the Entitysets with Post Method in it, still. As suggested, I did the odata-openapi3 MyMetadata.xml also.
I am expecting an entry in the JSON file with POST method on the entity FiHeaderToFiResult. But not found. Is there any way to achieve it please.
*Note: I have attached herewith the Metadata file
Thanks!
2023 Sep 28 10:23 AM
Hi Ramani,
The metadata.xml looks incomplete to me:
As a consequence there is no OpenAPI path where this POST method could be attached to.
Your screenshot above shows a POST request to fiPostingHeaderSet, but your metadata.xml says this is not allowed, sap:creatable is false:
<EntitySet Name="fiPostingHeaderSet" EntityType="ZFI_FS00_POSTING_SRV.fiPostingHeader" sap:creatable="false"The OpenAPI file can only reflect what your metadata.xml allows.
2023 Sep 28 10:42 AM
Hi Ralf Handl,
It is appreciated if you could tell me how to get the Metadata information with these information fully.
Here is the complete screenshot after the execution of the Post Method:
**This is what is execute is: /sap/opu/odata/sap/ZFI_FS00_POSTING_SRV/$metadata
Thanks, Ramani
2023 Sep 28 12:18 PM
Hi Ramani,
That's the correct URL to get $metadata.
Looking at the metadata.xml and assuming it is what the $metadata request returns, I would have expected the POST request to fail because the fiPostingHeaderSet does not allow creating new entities.
Which means the service implementation and its $metadata are out of sync.
If this service was defined with transaction SEGW, then maybe the service developer forgot to tick the box for "creatable: true" on fiPostingHeaderSet.
You could manually tweak the metadata.xml file accordingly and run the OpenAPI converter to check whether it produces what you expect. Long-term you should contact the service developer to get $metadata back in sync with the implementation.
2023 Sep 28 12:29 PM