Switching API Platform caused requests to lack body

  • Goal: Be able to make PATCH/PUT/POST API calls that contain request body

  • Steps: Not sure about this one. In my case the issue occured after switching our API Platform from Swagger to Scalar

  • Details: The behaviour was observed on feature environment after switching API Platform from Swagger to Scalar. The same application with no modification manages to make PATCH, PUT and POST requests succesfully on environments that use the Swagger API Platform (eg. staging), yet the calls fail on the environment using the Scalar (feature).

The Retool queries are triggered with additionalScope property, that contains data to be sent as request body and the code is identical in both cases:

const promises = array
.filter((name) => !!name)
.map((name) => {
  const commonPayload = {
    name,
    systems: multiselectSystems.value,
  };
  switch (selectAssetType.value) {
    case "system":
      return createSystem.trigger({
        additionalScope: {
          ...commonPayload,
        },
      });
    default:
  }
});

return Promise.all(promises).then(() => {
// do stuff...
});

The API query configuration looks the same for both environments too:

The calls made with the use of Swagger API Platform are succesful and the request body is there and is correct:
image
image

But the behaviour is different when using the Scala API Platform. The request fail and it seems that the request body is not passed to the original request even though the data is visible in the Retool query call:
image

Really the only difference between both environments is the API Platform used, but the schemas in both are nearly identical. Any ideas what can cause the different behaviour?

1 Like

After further investigation it seems to be related to latest OpenAPI Resource not being fully supported(?) by Retool. More details here: OpenAPI Resource: Specification version 3.0.4 does not send request body

2 Likes

Hi @szlezakbartosz,

Thanks for reporting this and sharing the other thread. It does look like a bug :thinking:

Are you able to test your query as a regular rest api request (instead of using our open api integration)? I am curious if that works as a workaround?

Hi @Tess ,
thank you for your response. Yes, the regular rest api requests work just fine. @BBS-PejoTech already provided more data regarding the subject in the thread linked above. Let's maybe close this one and continue there to keep it simple, since this is the same issue and he explained it clearer I think :slight_smile:

Sounds good :slightly_smiling_face: I'll mark a "solution" on here so folks can find the current Rest api workaround, which I recognize still isn't ideal.

I'll follow up on the other thread with any updates about the bug. You should be able to "watch" the other thread for an updates

1 Like