Fetch() POST and the body

I can set the header for a POST request with fetch() - but how can I set the body of the request to pass some data for the POST request? If I add the data with “?mydata=…” to the URL of the fetch request I change the request to GET since passing the data as part of the URL is not allowed for a POST request. Is there a way to add a body using the fetch() command?

Ah – I’m doing it wrong.

What I presume we want to do is to take the $Text of this note, optionally pass it through an export template, and post that to the server. Is that what you’d expect?

1 Like

using $Text would be a way to go. Currently I simply miss any option to add a body with data to the POST command :wink:

It is indeed an oversight. I’ll try to get it into the next backstage release.

2 Likes

With the 9.7 released today, I don’t see any reference to updates in fetch() that will let optionally include a body in POST requests. Was the feature implemented in this release, but simply not documented?

1 Like

I believe it was, and the lack of documentation is an oversight. Let me check…

1 Like

Nope: this didn’t make it into 9.7. I’ll try to get it done pronto.

2 Likes