MaxURL / post_data - how to send a simple string?

giolivio's icon

Hello,

I'm facing an issue using MaxURL.

What I need to receive on the server is this type of string 

“Pippo Pluto Q=0.1 L=25”

First I tried the Post command, but it consider arguments as pair of key & value

post https://server.com/sad23423d Pippo Pluto Q=0.1 L=25

so what I receive on server side is this

{“Pippo”:”Pluto”,”Q”:”0.1=L=25"}

Then I tried to use a dictionary and send it as post_data

{

"http_method" : "post",

"post_data" : "Pippo Pluto Q=0.1 L=25",

}

but what I receive on server side is a bit better but still got brackets, quotes and is split in 2

{"Pippo Pluto Q":"0.1 L=25"}

So I tried URL formatting as post_data

{

"http_method" : "post",

"post_data" : "Pippo%20Pluto%20Q%3D0.1%20L%3D25",

}

what I receive is also a bit better but still got brackets, quotes and is split in 2 with one blank field

{"Pippo Pluto Q=0.1 L=25":""}

...

So in short how to get just a simple string with spaces sent over MaxURL?

TFL's icon

Seems like your server treats the data as json regardless of its formatting.

Try to add "headers" : [ "Content-Type: text/plain" ] in your request:

{
   "http_method" : "post",
   "url" : "https://server.com/sad23423d”,
   "headers" : ["Content-Type: text/plain"],
   "post_data" : "Pippo Pluto Q=0.1 L=25"
}

giolivio's icon

TFL you saved my day, that makes it!

I tried also adding headers, but didn't work
Honestly I just copy pasted from maxurl help, as I'm not much aware of this web dungeons


A huge thank you !!