Home > Forum > General > REST API issue

REST API issue
0

Hello,

I have an external API: GET https://domain.com/api/employee/GetAll
I have created a process using REST API that get token, then get Employee. (START - FINISH)
GetAll - Retrieve the employees list. The HTTP verb for this method is GET.

When i run the process manually, it works. I have created a global cyclical action that starts my workflow (every day run), but it doesn't work:

Response Code:

Exceptions:
Error occurred : Cannot send a content-body with this verb-type.
System.Exception: Error occurred : Cannot send a content-body with this verb-type.
at WebCon.WorkFlow.BusinessLogic.Actions.Logic.Webservices.REST.ActionRunner.GetNotSerializedResponse(RestLogger log, Boolean expectContinue)
at WebCon.WorkFlow.BusinessLogic.Actions.Logic.Webservices.REST.InvokeRESTWebServiceAction.<FireActionAsync>d__5.MoveNext()



Do you have any ideas why it is happening?
Version 2023.1.2.68


Thanks.

MVP

Hi AndreeLi
I don't have an answer how you could deal with this error other than writing an SDK, but i've an explanation why it happens.

Webcon API is created using Swagger (OpenAPI) specification, so i would assume, that they are also using some kind of library to execute REST API actions.
Based on HTTP specification RFC 7231*
> A payload within a GET request message has no defined semantics;
sending a payload body on a GET request might cause some existing
implementations to reject the request.

GET requests shouldn't have a Body - data should be contained within the path or query part of the url, so properly implemented library shouldn't allow sending body when the verb is GET, and that is exactly what happens.

* https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.1
* https://stackoverflow.com/questions/73443585/why-http-get-with-request-body-in-swagger-node-js-not-working
* https://stackoverflow.com/questions/978061/http-get-with-request-body/38625554#38625554