Request and save file

From UBot Studio
Jump to: navigation, search

request and save file is a command that sends a request to a specified URL and saves the response content to a file.

This command is useful for situations in which an API returns a downloadable file.

Parameters

URL: The URL from which the file should be downloaded.

File Name: The name and path under which the downloaded file should be saved.

Method: The HTTP method to use for the request. Options include "GET", "POST", "PUT", and "DELETE".

Data: (optional) The data to send with the request. This should be an object in yaml or json format.

Headers: (optional) Any headers that should be sent with the request. This should be an object in yaml or json format.

Example

ui console view
request and save file("https://placekitten.com/200/300","C:\\Users\\Documents\\cat.png","GET","","")
log image("C:\\Users\\Documents\\cat.png",50)

The script above sends a "GET" request to the specified URL. The response, which is expected to be a file, is saved to "C:\Users\Documents\cat.png". It then displays the image in the console.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox