Issues with setting up REST API in Service Designer

What product/components do you use and which version/fix level are you on?

  • webMethods Microservices Runtime 10.15.0.1
  • Service Designer 10.15

Is your question related to the free trial, or to a production (customer) instance?

We have a licensed version of Microservices Runtime. Service Designer is always free as far as I know.

What are you trying to achieve? Please describe it in detail.

I was following the guide to set up a REST API: REST Capabilities In Integration Server
But noticed that I cannot create a REST API descriptor in Service Designer without importing an existing OpenAPI / Swagger file. I believe this is an error, or that the documentation is outdated.

In any case, I have been able to set up REST resources, but when I use HTTP GET on what I think is the correct URL, I just receive the following:

<BODY bgcolor="#dddddd">
<TABLE bgcolor="#dddddd" border="1">
</TABLE>
</BODY>

The underlying service works perfectly when I’m not trying to call it through REST.

Please let me know what I might be missing. Thanks!

Hi Ludvig,

Please check if the underlying service executed when you used REST url? If it is not then check the url that you used?
Check that the the service output is defined as the output signature?
Additionally set the Accept HTTP header to application/json so that you can get the response as a json.

Regards,
Aishvarya

2 Likes

Hello Ludvig,

Integration Server supports generating REST APIs for both Swagger (Open API 2.0) and Open API 3.x specifications.
In case of Open API 3.x REST API Descriptor can be generated only from an Open API document which is imported through designer to generate the services, documents, resources and the descriptor.
For Swagger 2.0 though you can generate the descriptor and other assets by importing a swagger document as well as by creating REST resources first and then generating API descriptor for those resources.
In this case, you generate a Rest Resource, define API URLs with there corresponding HTTP methods, map them to the services.
Once you have these resources ready, you can then generate REST API Descriptor and add these resources to it. Rest Descriptor will have the swagger document tab that will have all the details related to the API.

To Access these resources, please use the generated basepath in the swagger document postfixed with the path.
URL should be in format below

<http|https>://<hostname>:<port>/<basepath>/<path>

Also please add the appropriate Accept header as defined by the produce element of the API to fetch the results in the required format.

Regards,
Sumit

1 Like

Thanks for the replies! This helped me track down the issue.

Firstly, I noted that you have to specify a OpenAPI/Swagger file when you create a REST resource with OpenAPI 3.0. For OpenAPI 2.0 you get an option to manually define your endpoints. This was not really an issue for me.

The main issue was that the URL that I had to call was
http://<hostname>:<port>/restv2/<folder-of-resource>:<name-of-resource>/<URL-template-defined-in-resource-configuration>.
So If my resource is called ‘ExampleResource’ and it is in a folder ‘Example’ in the package ‘Default’, and the resource contains a URL template ‘/ExampleResource/test’. Then I would have to call the endpoint
http://<hostname>:<port>/restv2/Example:ExampleResource/ExampleResource/test

There might be a simpler way of doing this. But I did not find this way of calling it documented anywhere, and I could not get it to work in another way.

Finally, I also had to specify ‘Content-Type: application/json’ in my HTTP headers in order to receive the result as JSON.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.