2022-12-12 08:54:40 +00:00
|
|
|
caption: tm-http-request
|
|
|
|
created: 20220908161746341
|
|
|
|
modified: 20220908161746341
|
|
|
|
tags: Messages
|
|
|
|
title: WidgetMessage: tm-http-request
|
|
|
|
type: text/vnd.tiddlywiki
|
|
|
|
|
|
|
|
The ''tm-http-request'' message is used to make an HTTP request to a server.
|
|
|
|
|
|
|
|
It uses the following properties on the `event` object:
|
|
|
|
|
|
|
|
|!Name |!Description |
|
|
|
|
|param |Not used |
|
|
|
|
|paramObject |Hashmap of parameters (see below) |
|
|
|
|
|
|
|
|
The following parameters are used:
|
|
|
|
|
|
|
|
|!Name |!Description |
|
|
|
|
|method |HTTP method (eg "GET", "POST") |
|
|
|
|
|body |String data to be sent with the request |
|
2023-01-13 11:34:25 +00:00
|
|
|
|query-* |Query string parameters with string values |
|
|
|
|
|header-* |Headers with string values |
|
2022-12-12 08:54:40 +00:00
|
|
|
|password-header-* |Headers with values taken from the password store |
|
2023-01-13 11:34:25 +00:00
|
|
|
|password-query-* |Query string parameters with values taken from the password store |
|
2022-12-12 08:54:40 +00:00
|
|
|
|var-* |Variables to be passed to the completion and progress handlers (without the "var-" prefix) |
|
|
|
|
|bind-status |Title of tiddler to which the status of the request ("pending", "complete", "error") should be bound |
|
|
|
|
|bind-progress |Title of tiddler to which the progress of the request (0 to 100) should be bound |
|
|
|
|
|oncompletion |Action strings to be executed when the request completes |
|
|
|
|
|onprogress |Action strings to be executed when progress is reported |
|
|
|
|
|
|
|
|
The following variables are passed to the completion handler:
|
|
|
|
|
|
|
|
|!Name |!Description |
|
|
|
|
|status |HTTP result status code (see [[MDN|https://developer.mozilla.org/en-US/docs/Web/HTTP/Status]]) |
|
|
|
|
|statusText |HTTP result status text |
|
|
|
|
|error |Error string |
|
|
|
|
|data |Returned data |
|
|
|
|
|headers |Response headers as a JSON object |
|
|
|
|
|
|
|
|
The following variables are passed to the progress handler:
|
|
|
|
|
|
|
|
|!Name |!Description |
|
|
|
|
|lengthComputable |Whether the progress loaded and total figures are valid - "yes" or "no" |
|
|
|
|
|loaded |Number of bytes loaded so far |
|
|
|
|
|total |Total number bytes to be loaded |
|
2023-01-05 17:12:13 +00:00
|
|
|
|
|
|
|
!! Examples
|
|
|
|
|
|
|
|
* [[Zotero's|https://www.zotero.org/]] API for retrieving reference items: [[WidgetMessage: tm-http-request Example - Zotero]]
|