How to accept POST submission with token or user id/pwd

Hi,

Need some help. I have to build a page on WIX to accept a call back submission from another system, which will be “accepting” POST calls similar to below. Please note, it’s “accepting” not “sending”. The value of “theToken” is a JWT token generated by the other system, they can also use user id/pwd, but I am not sure how to setup a page on WIX to accept POST submission.

return fetch(URL_on_wix,
{
method: ‘post’,
headers: {
‘Authorization’: 'Bearer '+theToken,
‘content-type’: ‘application/json’
},
body:
‘{“data1”: “1234”, “data2”:“5678” }’
})

   .then( (httpResponse) => { 
      ..... 
   }); 

I tried to setup a page that is hidden but permission still allows calls from everyone. If I create a simple test.html and submit to the URL, “wixLocation.query” picks up the parameters correctly and have no problem accessing the page directly from browser. However, if I use curl as below, keep getting 403 forbidden error, both with and without the token or user id/pwd provided. Any idea?

$ curl -X POST “https://xxxxxxx.wixsite.com/test1/testing” -H “Content-Type: application/json” -d ‘{“data1”:“1234”,“date2”:“5678”}’

403 Forbidden

403 Forbidden


nginx/1.13.7

or

curl -X POST -F ‘username=helloworld’ -F ‘password=something’ “https://xxxxxxx.wixsite.com/test1/testing” -H “Content-Type: application/json”

403 Forbidden

403 Forbidden


nginx/1.13.7

Followed a few examples on the net and found that if I try with curl command as below it returns a long html string which I don’t understand. Tried save that to a HTML file but when opened with IE/Chrome, the content is blank…

$ curl -H “Authorization: Token xxxxxxxxxxxxxx” https://xxxxxxx.wixsite.com/test1/testing

<meta charset="utf-8"/> 
test1






don’t worry, I figured it out myself after studying about Wix http-functions wix-http-functions - Velo API Reference - Wix.com