From MiniScript Wiki
Jump to navigation Jump to search

In Mini Micro, the http.put function sends data to a URL using the PUT method and returns the contents of the URL using the HTTP PUT protocol. It supports text, images, sounds, and raw binary data.


Parameter Name Meaning
url URL of the web page or resource to fetch
data Data to put can be a string or a map
headers optional map of HTTP headers

Usage Notes

The type of the value returned depends on the MIME type reported by the server, as follows:

MIME Type MiniScript Type
image Image object
audio Sound object
text, javascript, xml, or json string
any other type RawData object


The following example, typed on the Mini Micro command line puts data to a URL, retrieves a response, and displays Hello World from the test site

Note: depending on how the server is setup to respond to put requests you may get different types of data. the below example the server responds with application/octet-stream or a list of unicode number values which we must convert back into a string.

import "json" // for json.parse
import "listUtil" // for List.apply extension
request = http.put("", "Hello World")
request_data = json.parse(request)
buffer =
buffer.apply @char
buffer.join ""