I’m working on creating a web API at my work place.
I’ve created a nodeJS web API - a compatible driver to use with MariaDB database.
Once the NodeJs Server.Js was ready, my first attempt was to run on a localhost using Postman.
using this URL: localhost:8000/user/register?id=2222 and call was successful
(both for Post and Get since the methods are doing the same thing for the sake of testing).
This maybe a Proxy issue - this is a work pc and I use VPN, in that case, shouldn’t the bad request error also appear for the Get call?
These are the methods as they appear in the Server.JS:
You’ll need to dive deep into this error, doesnt look like a Unity problem.
The fact it returns a 400 - Bad Request is simply because of the try/catch error handling.
Whats the exception and the message in the node.js (the catch(error)) ?
Check if it does help: node.js - how to print the data from post request on console - Stack Overflow
You gotta debug the whole request, find a way to print it and see what does differ from get/post.
Hey @gamedev1506 thanks for the tip to go back into node.js for testing.
I’ve debugged the calling of unitywebrequest.post, and it says in vs code where the node.js app is: post didn’t work Parameter at position 1 is undefined INSERT INTO TestTable (id) VALUES (?) - parameters:[undefined] sql: INSERT INTO TestTable (id) VALUES (?) - parameters:[undefined]