WebClient dat simple put. and post

i am trying to do some http request with put and post methods …
i am very noob to the request and complex python scripts

For the get, method i am creating the link in the touch designer way “not python way”. I have nothing special in the callbacks. and everything works perfect for get method

I am creating the link by referencing in the URL field In the web client dat
Method : get.
URL: localhost :80/page1?a=0&b=1&c=2

I am trying to do for the put and post requests what i do with the Postman application
beyond the link
i have to send in the boddy as raw text:


how can i add the body raw text in a verry simple way ?

I searched al the topics on the webclient dat around the internet i watched a lot of videos … but every method that i tried to addapt in the callback returned wierrd errors from the server i conected too … The calbacks were ok whithout anny errors … but they were not sending the “item:type” as a raw text in the boddy .

hey @emiy , welcome to the forum.

As you want to craft some custom requests which go beyond a simple GET, that means you’ll have to get your feet wet with some basic Python. See the documentation of the request method of the webclientDAT Class (you’ll also end up on this help page if you click the Python blue/yellow question mark icon on the webclient1 parameter window:

I created some examples which do POST and PUT requests, and if you run them (right-click on each node, select "Run Script) you see the answer printed in the webclient1 node.

Content you send is usually encoded as either “application/x-www-form-urlencoded” or “application/json”.
It’s not fully clear to me which variant you need but I included samples for both.
These examples use the website http://httpbin.org which is great for testing HTTP requests, as it answers with the content you sent it. You’ll see it answers with either the form data or json data.

webclient_POST_and_PUT_examples.tox (958 Bytes)

thank you very much for your templates … since i don’t have a formal education in programming they helped me understand more … iv’e read the info’s in documentation but i didn’t understood then how exactly and how many og the parameters exactly do i need … the server for testing httpbin will be helpful as well.

Also, if it helps, I built a wrapper for the webClientDAT, taking care of some of the problems (only having one request at a time for example) and creating a simpler API. For example, it will auto-parse your data if it is a Dictionary to JSON. Also, endpoints are appended to the server that is the target, so only using the endpoints.