<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://m204wiki.rocketsoftware.com/index.php?action=history&amp;feed=atom&amp;title=%24Web_Api</id>
	<title>$Web Api - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://m204wiki.rocketsoftware.com/index.php?action=history&amp;feed=atom&amp;title=%24Web_Api"/>
	<link rel="alternate" type="text/html" href="https://m204wiki.rocketsoftware.com/index.php?title=$Web_Api&amp;action=history"/>
	<updated>2026-05-11T21:05:20Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://m204wiki.rocketsoftware.com/index.php?title=$Web_Api&amp;diff=117865&amp;oldid=prev</id>
		<title>Alex at 20:32, 20 January 2020</title>
		<link rel="alternate" type="text/html" href="https://m204wiki.rocketsoftware.com/index.php?title=$Web_Api&amp;diff=117865&amp;oldid=prev"/>
		<updated>2020-01-20T20:32:40Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 20:32, 20 January 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l3&quot;&gt;Line 3:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This method was first avaliable in Model 204 7.8.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This method was first avaliable in Model 204 7.8.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;var&amp;gt;$Web_APi&amp;lt;/var&amp;gt; indicates whether the current processing is the result of a request to &amp;lt;var class=&quot;product&quot;&amp;gt;[[Janus Web Server]]&amp;lt;/var&amp;gt;. The difference between $Web_Api and [[$Web]] is that the latter returns 0 on the transactional daemon child (or any transactional descendant) of a web thread whereas the former returns 1, indicating that the $web API is available to the threads.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;var&amp;gt;$Web_APi&amp;lt;/var&amp;gt; indicates whether the current processing is the result of a request to &amp;lt;var class=&quot;product&quot;&amp;gt;[[Janus Web Server]]&amp;lt;/var&amp;gt;. The difference between $Web_Api and [[$Web]] is that the latter returns 0 on the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Daemon class#Transactional_daemons|&lt;/ins&gt;transactional daemon child&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]] &lt;/ins&gt;(or any transactional descendant) of a web thread whereas the former returns 1, indicating that the $web API is available to the threads.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;var&amp;gt;$Web_Api&amp;lt;/var&amp;gt; takes no arguments and returns either a 0 or a 1.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;var&amp;gt;$Web_Api&amp;lt;/var&amp;gt; takes no arguments and returns either a 0 or a 1.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Alex</name></author>
	</entry>
	<entry>
		<id>https://m204wiki.rocketsoftware.com/index.php?title=$Web_Api&amp;diff=117861&amp;oldid=prev</id>
		<title>Alex: Created page with &quot;&lt;span class=&quot;pageSubtitle&quot;&gt;Determine whether web API is available&lt;/span&gt;  This method was first avaliable in Model 204 7.8.  &lt;var&gt;$Web_APi&lt;/var&gt; indicates whether the current...&quot;</title>
		<link rel="alternate" type="text/html" href="https://m204wiki.rocketsoftware.com/index.php?title=$Web_Api&amp;diff=117861&amp;oldid=prev"/>
		<updated>2020-01-20T16:57:00Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;span class=&amp;quot;pageSubtitle&amp;quot;&amp;gt;Determine whether web API is available&amp;lt;/span&amp;gt;  This method was first avaliable in Model 204 7.8.  &amp;lt;var&amp;gt;$Web_APi&amp;lt;/var&amp;gt; indicates whether the current...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;span class=&amp;quot;pageSubtitle&amp;quot;&amp;gt;Determine whether web API is available&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method was first avaliable in Model 204 7.8.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;var&amp;gt;$Web_APi&amp;lt;/var&amp;gt; indicates whether the current processing is the result of a request to &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;[[Janus Web Server]]&amp;lt;/var&amp;gt;. The difference between $Web_Api and [[$Web]] is that the latter returns 0 on the transactional daemon child (or any transactional descendant) of a web thread whereas the former returns 1, indicating that the $web API is available to the threads.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;var&amp;gt;$Web_Api&amp;lt;/var&amp;gt; takes no arguments and returns either a 0 or a 1.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;p class=&amp;quot;syntax&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;%rc&amp;lt;/span&amp;gt; = $Web_Api&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Return codes===&lt;br /&gt;
&amp;lt;table class=&amp;quot;syntaxTable&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Code&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Meaning&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;0&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Web API not available.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Web API available.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Usage notes==&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;var&amp;gt;$Web&amp;lt;/var&amp;gt; function is most useful for:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Preventing code that should only be run for a web request from running for 3270 (or other non-web) requests.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensuring that non-web, possibly 3270 specific code, is not run for web requests.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;While $web functions are available on transactional daemon descendants of web threads, &amp;quot;terminal&amp;quot; output is not captured to the web output buffer as it is for the web thread itself. If a transactional daemon wishes to add data to the web output buffer it should use [[$Web_Put_Text]] or [[$Web_Put_Bin]].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
In the example below, the variable %district is set from a form field when running a web request and from a screen field otherwise:&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;if $web_api then&lt;br /&gt;
   %district = $web_form_parm(&amp;#039;DISTRICT&amp;#039;)&lt;br /&gt;
else&lt;br /&gt;
   %district = %query:district&lt;br /&gt;
end if&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;$web_api&amp;lt;/var&amp;gt; has several advantages over other techniques for determining whether a request is running a web request, such as checking &amp;lt;var&amp;gt;[[$Web_Port]]&amp;lt;/var&amp;gt; or doing a &amp;lt;code&amp;gt;$VIEW(&amp;#039;IODEV&amp;#039;)&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;It is syntactically simple and easy to understand. &lt;br /&gt;
&amp;lt;li&amp;gt;It works correctly even when a request is being debugged using JANUSDEBUG. &lt;br /&gt;
&amp;lt;li&amp;gt;It works correctly and does not cause a &amp;quot;CONNECTION WAS LOST&amp;quot; user restart after the connection was closed either with a &amp;lt;var&amp;gt;[[$Web_Done]]&amp;lt;/var&amp;gt; or by the browser. This can be especially useful if there is web-specific processing, like APSY navigation code, that happens after a &amp;lt;var&amp;gt;$Web_Done&amp;lt;/var&amp;gt;.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Janus Web Server $functions]]&lt;/div&gt;</summary>
		<author><name>Alex</name></author>
	</entry>
</feed>