Error on API form

i have created a API and it seems to work when i Fetch schema but when i use the form i’m getting a error 400…

This just started happening and i’m not sure if it’s related to the release of the new app connect …

I have the debuger on and it’s responding with this message
{
“detail”: “Input data validation error: {‘loc’: (‘ root ’,), ‘msg’: ‘value is not a valid dict’, ‘type’: ‘type_error.dict’}”
}

I really need help with this…

1 Like

This issue was never resolved and my api is not working

Can you provide some more info?
Would be nice if we can see some code of the form and screenshot of the server action

1 Like

Hello Franse

here are a couple of screenshots that explain the flow better…mind you that all this was working before the something the server connect code changes…i tried to go back and it didn’t work either…

Thank you in advance

.

Pass Errors checkbox is checked, the error you’re seeing could be the remote API returning that error.

Use a service like Beeceptor and change the API Action to hit that mock API so you can see what data your Wappler app is sending. Most likely, the remote API service is not receiving data correctly from Wappler.

in the second image as you can se when i fetch the api data from server connect the data is displayed which to my understand means the api is sending and receiving but on the page it’s just not showing…

Correct me if i’m wrong…

That screenshot proves an example request is working.

However, I can see there’s an input field “description” on your form. So, you’re no longer making an example request, but actually injecting the description into the API Action, right?

Yes…this api is a copy of the original and the only diffrence is the description input field and I generated that form as I have before using the wappler generator…here is the original.

he generator…

Let’s try something, instead of putting JSON directly there in JSON data, put a Group step and inside it put a Set Value description = {{ $_POST.descriptions }}.

no sure i’m doing it right please verify…

ok i changed it a bit but it still doesn’t display on page

  1. Move the API Action outside the Group
  2. Give the Group a name
  3. In API Action JSON data, put {{groupName}}, where groupName is the name you gave to the Group

Regarding point 3, not sure if it works like that, or if we have to apply a JSON encode formatter, I don’t remember what’s it called, and I’m not sure if Wappler shows it in the UI

Edit: Found the JSON encode formatter:

So the expression probably is {{groupName.toJSON()}}

i moved it outside the group and named the group and added to the json text…still the same error

  1. API Action needs to go after the Group, else it can’t use that appnotification variable
  2. Literally erase everything in JSON Data, and just type {{ appnotification.toJSON() }}

i did that and when i tried testing it the fetch gave another error

That’s because Wappler editor doesn’t run the steps, running that example would run with JSON Data as:

{{ "this is just a test".toJSON() }}

Which is obviously not what you want.

Easiest way to move forward, is to ignore that error, and try to see if the actual problem (on your real web page) is fixed :slight_smile:

I tried it also on the page and it didn’t work and the network tab showed the same 400 error

Ok, weird. So, running out of options, you really have to do this:

I’ll try it and respond tomorrow with the results…

Thank you for your patience

What about adding another header
accept application/json