HTTP Request Question : Scriptable

PHOTO EMBED

Sat May 08 2021 13:32:09 GMT+0000 (Coordinated Universal Time)

Saved by @zangwang

let req = new Request("https://httpbin.org/post");
req.method = "post";
req.headers = {
	"x-something": "foo bar",
	"Content-Type": "application/json"
};
req.body = JSON.stringify({
	foo: "bar",
	qux: 42
});

// use loadJSON because the API answers with JSON
let res = await req.loadJSON();
log(JSON.stringify(res, null, 2));
content_copyCOPY

https://www.reddit.com/r/Scriptable/comments/ir8cum/http_request_question/