xo::REST method request (protected)
<instance of xo::REST> request -method method \ [ -content_type content_type ] [ -token token ] [ -vars vars ] \ -url url
Defined in packages/xooauth/tcl/rest-procs.tcl
- Switches:
- -method (required)
- -content_type (optional, defaults to
"application/json; charset=utf-8"
)- -token (optional)
- -vars (optional)
- -url (required)
- Testcases:
- No testcase defined.
Source code: set tokenArgs [expr { [info exists token] ? [list "Authorization" "Bearer $token"] : {} }] if {$vars ne "" || $method eq "POST"} { set body [:body -content_type $content_type -vars $vars] set r [ns_http run -method $method -headers [ns_set create headers {*}$tokenArgs "Content-type" $content_type] -expire 30 -body $body $url] } else { set r [ns_http run -method $method -headers [ns_set create headers {*}$tokenArgs] -expire 10 $url] } set content_type [ns_set iget [dict get $r headers] content-type ""] #ns_log notice "[self] $method $url\n" # [expr {[info exists body] ? "$body\n" : ""}] # "Answer: $r ($content_type)" return [:with_json_result r]XQL Not present: Generic, PostgreSQL, Oracle