Search code examples
databaseformshttprequestvelo

POST http request for WIX database gives error


I built a wix website and wanted to have a database to accept data from a Form. I wrote the codes in wix corvid to accept data after some research. Please refer to attached image links for the code.

In order to test the same, I used http://www.apirequest.io. And it gives me the following error:

Error Submitting Request Error: Request has been terminated Possible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc. If you site enforces CORS (i.e. Access-Control-Allowed-Origin is set to something other than *), then you may need to allow http://www.apirequest.io.

Regarding the permissions, I have made sure from the settings that 'Anyone can submit data to this collection'.

I am an absolute beginner for web development and http requests. Please support where I went wrong. I would be happy to do further reading on these subjects, please help.

enter image description here

enter image description here


Solution

  • The above question is solved and now it seems that it shouldn't have been here! I was making an error in generating the Http Request.

    In case any anyone else is working with wix, the above code is correct in the attached images is correct.

    The following http request triggers it:

    POST /_functions/firstfunc HTTP/1.1 Host: example.com Content-Type: application/json Content-Length: 45

    {"Title": "Mr.", "Name": "John", "Age": "58"}