title: WidgetMessage: tm-http-request Example - Zotero
tags: $:/tags/Global
\procedure select-zotero-group()
Specify the Zotero group ID to import
<$edit-text tiddler="$:/config/zotero-group" tag="input"/> or
<$select tiddler="$:/config/zotero-group">
$select>
\end
\procedure zotero-save-item(item)
<$action-createtiddler
$basetitle={{{ =[[_zotero_import ]] =[- jsonget[key]] =[[ ]] =[
- jsonget[title]] +[join[]] }}}
text={{{ [
- jsonget[title]] }}}
tags="$:/tags/ZoteroImport"
zotero-group={{$:/config/zotero-group}}
>
<$action-setmultiplefields $tiddler=<> $fields="[
- jsonindexes[]addprefix[zotero-]]" $values="[
- jsonindexes[]] :map[
- jsongetelse[.XXXXX.]]"/>
<$list filter="[
- jsonindexes[creators]]" variable="creatorIndex">
<$action-setmultiplefields $tiddler=<> $fields="[
- jsonget[creators],,[creatorType]addprefix[zotero-]]" $values="[
- jsonget[creators],,[lastName]] [
- jsonget[creators],,[firstName]] +[join[, ]] :else[
- jsonget[creators],,[name]] "/>
$list>
$action-createtiddler>
\end zotero-save-item
\procedure zotero-save-items(data)
<$list filter="[jsonindexes[]] :map[jsonextract,[data]]" variable="item">
<$macrocall $name="zotero-save-item" item=<
- >/>
$list>
\end zotero-save-items
\procedure zotero-get-items(start:"0",limit:"25")
\procedure completion()
\import [subfilter{$:/core/config/GlobalImportFilter}]
<$action-log msg="In completion"/>
<$action-log/>
<$list filter="[compare:number:gteq[200]compare:number:lteq[299]]" variable="ignore">
<$macrocall $name="zotero-save-items" data=<>/>
<$list filter="[jsonget[total-results]subtractsubtractcompare:number:gt[0]]" variable="ignore">
<$macrocall $name="zotero-get-items" start={{{ [add] }}} limit=<>/>
$list>
$list>
\end completion
\procedure progress()
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
<$action-log message="In progress-actions"/>
\end progress
\procedure request-url()
\rules only transcludeinline transcludeblock filteredtranscludeinline filteredtranscludeblock
https://api.zotero.org/groups/{{$:/config/zotero-group}}/items/
\end request-url
<$wikify name="url" text=<>>
<$action-sendmessage
$message="tm-http-request"
url=<>
method="GET"
query-format="json"
query-sort="title"
query-start=<>
query-limit=<>
header-accept="application/json"
bind-status="$:/temp/zotero/status"
bind-progress="$:/temp/zotero/progress"
oncompletion=<>
onprogress=<