On Mon, 02 Jan 2017 13:14:16 GMT, Jacob Carlborg wrote:

On Mon, 02 Jan 2017 09:20:12 GMT, Inquie wrote:

Well, I don't seem to understand, I tried that, same issue.

I thought data added the resource to get rather than putting it in the url, tried a similar thing in soap and no worky either.

No, "greeting" needs to be part of the URL, it's the endpoint. The parameters (declared in the interface) are what go in the data, serialized as JSON. I tried your vibe.d application and it works, you just need to call it correctly. Here's an example using curl:

$ curl -H 'Content-Type: application/json' -X  PUT -d '{"text":"foobar"}' localhost/greeting
$ curl localhost/greeting
"foobar"

Note that the HTTP header Content-Type: application/json needs to be supplied for it to work as well. But I assume jQuery does that automatically, while curl doesn't.

I eventually got it to work. There seems to be a lot of broken code in the world ;/

GM_xmlhttpRequest({

method: "POST",
url: "http://127.0.0.1/add-chapter",
data: JSON.stringify({title:"test"}),
headers: {
	"Content-Type": "application/json",
},
onload: function(response) { alert(JSON.stringify(response)); }  

});

But it only works if you allow cross site content... (had to use a plugin that disables it for the site I was working on(youtube)).

(again, I tried both ways with the firs test case and it failed, while in the second it worked fine... so it might have been on my end, but I'm not gonna go try out the first example again... to much wasted time trying to get simple stuff to work in the first place)