Is it possible to make a POST request with JSON?


#1

is it possible to make a POST request with the Generic JSON plugin?
I am new to React studio and I got the Get requests working, but can’t figure out to make the post requests.


#2

Hi, plugin should make post when you add row into (using Save data interaction) the Data sheet associated with JSON plugin. So add simply Save data interaction and check what kind of code the Studio will generate.


#3

Thanks I will look in to it.


#4

Did you get this working? Could you share some details?

Thanks!


#5

I tried this and don’t think it’ll do what I want.

I simply want user entered text to be posted using HTTP POST. I don’t need to first do HTTP GET which is what JSON plugin does, and I couldn’t get POST working anyways.

Hoping someone has a simple solution.

Thank you,


#6

hi do have you consider to use…

      		var ws = new WebSocket('wss://xxxxx.xx/xxxx');

            ws.addEventListener('open', () => {
					 var ss;

                ss = ypur_post_string
            var message = [];
            var obj = {
                'sql': encodeURI(ss)
            }
            message.push(obj);
              console.log('Sending:', message);

          
            });

            // Add a listener in order to process WebSocket messages received from the server
            ws.addEventListener('message', event => {

                           var dati = JSON.parse( event.data);
            });

#7

I never got it to work becouse I couldn’t figure out to make a propper login to my ruby/rails backend. But I started to use the firebase as backend instead becouse it handles all the login for you and it is pretty easy to use.
But if you don’t need a login I guess it’s just to use the save action on a button, and save it to the json sheet and then it should make a post request.


#8

I did it this way and it seems to work

var message = this.props.appActions.dataSlots[‘ds_message’];
message = encodeURI(message);

var http = new XMLHttpRequest();
var url = 'https://some_url’;

http.open(‘POST’, url, true);
http.setRequestHeader(‘Content-type’, ‘application/x-www-form-urlencoded’);
http.send(message);