Issues with POST in web component

This is my code:


But the api gives error 415 as we can see in the logs:

Use Do it to debug your blocks and show us a screenshot of the Do it result

Use the companion app and Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Tell us about your api.

Does it provide curl examples, if so show the relevant curl command?

The api is made with python and flask

Go on, what are its parameter requirements, are there any data submission examples?

@app.route('/api/register', methods=['POST'])
def register_user():
    data = request.json
    email = data.get('email')
    password = data.get('password')
    username = data.get('username')
Do It Result: "{"email":"test@gmail.com","password":"test password","username":"s4il"}"
---

Are you sure?
A screenshot would help to avoid misunderstandings...
I would remove that JsonObjectEncode block
Please show us a screenshot next time

Taifun

I posted a similar POST sample a day ago at

for linear cut analyses


I tried but still same error: 127.0.0.1 - - [07/Feb/2025 21:36:17] "POST /api/register HTTP/1.1" 415 -

:question:

we are are playing darts in a dark room, with a black dartboard...

Isn't that localhost?

Is your app talking to itself?

1 Like

It allways says that in logs, idk why, but that isn't teh problem since it works fine

Maybe you need to specify content type in some headers?

1 Like

I don't undestand what you mean by data submission examples

Maybe! How do you do that?

Ok, this looks better...
The difference was the double quotes at start and end

Taifun

Look in the last procedure:
image

I can't see it, it's blurry

I got it from the earlier sample in this thread.
That has the source.


(draggable)