Ideally, the IS must have unwrap this JSON payload and convert it into the document type(order here).
However, I see that the values under the order document in debug mode are coming as null.
If I pass the below JSON payload, it works fine.
Any suggestions as to why the request doesnt works while including the parent tag ‘order’.
Thanks
restv2 is now deprecated, you should create a proper API Descriptor as of now along with the ‘rad’ postfix. Also if you just want to invoke a service, use the following syntax and don’t forget to set the Content-Type to ‘application/json’
The confusion is because you only have one input and hence the API Descriptor assumes that the reference is the body, thus it commits “order” from the payload i.e. you have to provide the input as
{
"id": 100,
"status": "open"
}
If you want to have order then you will need to wrap it in a document e.g.
After you create a RAD for the resource, you get the swagger content in the “Swagger” tab of the RAD. Copy this content and check it on https://editor.swagger.io/ and as you can see the expected body for this POST request is only the properties (attached snapshot)
and this is for the service whose input is defined as you mentioned.
Also, for a service which has input expected to be a document and as @John_Carter4 mentioned it should be wrapped under another document see screenshot below
In this case, the expected input for the request would be with the parent element (order in your case), see the swagger editor
Isn’t my input same as yours with the exception that the order in my case is a document reference.
And if putting a document reference is a problem, does it implies that a input document to a restful flow service can’t have a document reference due to the above limitation.
As a further matter, calling the service with invoke in url directly and not through the rad, it works as expected. So, why the change in behavior b/w the 2 methodologies implementation (rad & invoke).
Hi,
You might need to refresh your API Descriptor after updating the service to include body. I noticed that mine didn’t reflect the signature changes until I did that. I agree that the current implementation is confusing and we should probably update the API Descriptor to allow you to choose if you want the order reference to be explicit or implied.
regards,
John.
@Farhan_Shirgill if you’re still in the early stages of development, I recommend taking a contract-first approach by using an editor like the one Sreekanth recommended, creating your API definition there, and then importing that definition into webMethods and letting webMethods create the artifacts as needed. I’ve used both approaches in the past and defining the API definition first via Swagger or Open API is the way to go.
That’s link is to the new rad approach. The labelling is a bit confusing because the legacy approach is prefixed with /rest/… whereas the new approach is …/rad/…