ms::Graph method check_async_operation (protected)

 <instance of ms::Graph[i]> check_async_operation location

Defined in packages/xooauth/tcl/ms-procs.tcl

For async operations, the MSGraph API returns the location to be checked for finishing via the "location" reply header field. Perform the checking only when the location has the expected structure. ns_log notice "check_async_operation $location"

Parameters:
location

Partial Call Graph (max 5 caller/called nodes):
%3

Testcases:
No testcase defined.
Source code:
if {![regexp {^/teams\('([^']+)'\)/operations\('([^']+)'\)$} $location . id opId]} {
    error "teams check_async_operation '$location' is not in the form of /teams({id})/operations({opId})"
}

set r [:request -method GET -token [:token] -url ${location}]

#ns_log notice "/checkAsync GET Answer: $r"
set status [dict get $r status]
if {$status == 200} {
    set jsonDict [dict get $r JSON]
    ns_log notice "check_async_operation $location -> [dict get $jsonDict status]"
    return [dict get $jsonDict status]
} elseif {$status == 404} {
    #
    # MSGraph returns sometimes 404 even for valid
    # operation IDs. Probably, the call was to early for
    # the cloud....
    #
    return NotFound
}
return $r
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: