Files
doc-exports/docs/fg/umn/functiongraph_01_1442.html
liusiying01 904c1aad8b FG UMN 20250526 version
Reviewed-by: Mützel, Andrea <andrea.muetzel@t-systems.com>
Co-authored-by: liusiying01 <liusiying@huawei.com>
Co-committed-by: liusiying01 <liusiying@huawei.com>
2025-10-06 15:14:20 +00:00

236 lines
32 KiB
HTML

<a name="functiongraph_01_1442"></a><a name="functiongraph_01_1442"></a>
<h1 class="topictitle1">Creating an HTTP Function</h1>
<div id="body8662426"><div class="section" id="functiongraph_01_1442__en-us_topic_0000001298667441_section163345291981"><h4 class="sectiontitle">Overview</h4><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p14195204111344">HTTP functions are designed to optimize web services and support multiple programming languages. You can send HTTP requests to URLs to trigger function execution.</p>
</div>
<div class="section" id="functiongraph_01_1442__en-us_topic_0000001298667441_section93711611195218"><h4 class="sectiontitle">Common Function Request Headers</h4><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p458117323522">The following table lists the default request header fields of an HTTP function.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="functiongraph_01_1442__en-us_topic_0000001298667441_table1758114322529" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Default request header fields</caption><thead align="left"><tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row25819320522"><th align="left" class="cellrowborder" valign="top" width="28.939999999999998%" id="mcps1.3.2.3.2.3.1.1"><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p155821132135214">Field</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="71.06%" id="mcps1.3.2.3.2.3.1.2"><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p11582232115216">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row1258223225211"><td class="cellrowborder" valign="top" width="28.939999999999998%" headers="mcps1.3.2.3.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p10582332165216">X-CFF-Request-Id</p>
</td>
<td class="cellrowborder" valign="top" width="71.06%" headers="mcps1.3.2.3.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p45822032145216">ID of the current request</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row15582132115211"><td class="cellrowborder" valign="top" width="28.939999999999998%" headers="mcps1.3.2.3.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p165826321528">X-CFF-Memory</p>
</td>
<td class="cellrowborder" valign="top" width="71.06%" headers="mcps1.3.2.3.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p958220323526">Allocated memory</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row1758214322529"><td class="cellrowborder" valign="top" width="28.939999999999998%" headers="mcps1.3.2.3.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p1658233220522">X-CFF-Timeout</p>
</td>
<td class="cellrowborder" valign="top" width="71.06%" headers="mcps1.3.2.3.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p2582153265217">Function timeout duration</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row1758213225215"><td class="cellrowborder" valign="top" width="28.939999999999998%" headers="mcps1.3.2.3.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p4582113235213">X-CFF-Func-Version</p>
</td>
<td class="cellrowborder" valign="top" width="71.06%" headers="mcps1.3.2.3.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p11582143211523">Function version</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row18583132195216"><td class="cellrowborder" valign="top" width="28.939999999999998%" headers="mcps1.3.2.3.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p55833324521">X-CFF-Func-Name</p>
</td>
<td class="cellrowborder" valign="top" width="71.06%" headers="mcps1.3.2.3.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p19583193255210">Function name</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row358363218523"><td class="cellrowborder" valign="top" width="28.939999999999998%" headers="mcps1.3.2.3.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p1058333211523">X-CFF-Project-Id</p>
</td>
<td class="cellrowborder" valign="top" width="71.06%" headers="mcps1.3.2.3.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p11583113275215">Project ID</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row258320324521"><td class="cellrowborder" valign="top" width="28.939999999999998%" headers="mcps1.3.2.3.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p125831932115216">X-CFF-Package</p>
</td>
<td class="cellrowborder" valign="top" width="71.06%" headers="mcps1.3.2.3.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p19583143255211">App to which the function belongs</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row7583183255217"><td class="cellrowborder" valign="top" width="28.939999999999998%" headers="mcps1.3.2.3.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p358323255213">X-CFF-Region</p>
</td>
<td class="cellrowborder" valign="top" width="71.06%" headers="mcps1.3.2.3.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p758393210525">Current region</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="functiongraph_01_1442__en-us_topic_0000001298667441_section550725153211"><h4 class="sectiontitle">Constraints</h4><ul id="functiongraph_01_1442__en-us_topic_0000001298667441_ul925212424331"><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li250281820598">HTTP functions do not distinguish between programming languages. The handler must be set in the <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b1112344220397">bootstrap</strong> file. You can directly write the startup command, and allow access over port <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b166684711397">8000</strong>. The bound IP address is <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b612354211394">127.0.0.1</strong>.</li><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li1066010214593">The HTTP response body cannot exceed 6 MB.<p id="functiongraph_01_1442__en-us_topic_0000001298667441_p127411714380"><a name="functiongraph_01_1442__en-us_topic_0000001298667441_li1066010214593"></a><a name="en-us_topic_0000001298667441_li1066010214593"></a>A valid HTTP function response must contain body(String), statusCode(int), headers(Map), and isBase64Encoded(boolean). By default, the response is encoded using Base64. The default value of isBase64Encoded is true. The same applies to other frameworks.</p>
</li><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li105804595916">The <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b17708166164018">bootstrap</strong> file is the startup file of the HTTP function. The HTTP function can only read <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b67084615403">bootstrap</strong> as the startup file name. If the file name is not <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b10708962402">bootstrap</strong>, the service cannot be started. For more information, see the <a href="#functiongraph_01_1442__en-us_topic_0000001298667441_li194597302096">bootstrap file example</a>.<p id="functiongraph_01_1442__en-us_topic_0000001298667441_p112014213108">If you run the JAR package, you are advised to add the JVM parameter <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b784833019404">-Dfile.encoding=utf-8</strong> to <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b3147436124013">bootstrap</strong>. Otherwise, garbled Chinese characters may be displayed.</p>
</li><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li8112907413">Only APIG triggers can be created for HTTP functions. </li><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li148215341895">HTTP functions cannot be executed for a long time, invoked asynchronously, or retried.</li><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li1473951143716">When a function initiates an HTTP request, the request IP address is dynamic for private network access and fixed for public network access. For more information, contact technical support.</li></ul>
</div>
<div class="section" id="functiongraph_01_1442__en-us_topic_0000001298667441_section121331213191314"><h4 class="sectiontitle">Creating and Configuring an HTTP Function</h4><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p512194512135">The following uses an example to describe how to create and configure an HTTP function.</p>
</div>
<div class="section" id="functiongraph_01_1442__en-us_topic_0000001298667441_section6480115018451"><div class="dropdownexpand"><div class="dropdowntitle" onclick="ExpandorCollapseNode(this)"><h4 class="sectiontitle">Step 1: Creating a Code Package</h4></div><div class="dropdowncontext"></div><div class="dropdowncontext"><ol id="functiongraph_01_1442__en-us_topic_0000001298667441_ol153901922133419"><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li16962035123511">Prepare a Node.js script. A code example is as follows:<pre class="screen" id="functiongraph_01_1442__en-us_topic_0000001298667441_screen166124112183">const http = require('http'); // Import Node.js core module
var server = http.createServer(function (req, res) { //create web server
res.writeHead(200, { 'Content-Type': 'text/html' });
res.write('&lt;html&gt;&lt;body&gt;&lt;h2&gt;This is http function.&lt;/h2&gt;&lt;/body&gt;&lt;/html&gt;');
res.end();
});
server.listen(8000, '127.0.0.1'); //6 - listen for any incoming requests
console.log('Node.js web server at port 8000 is running..')</pre>
</li><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li194597302096"><a name="functiongraph_01_1442__en-us_topic_0000001298667441_li194597302096"></a><a name="en-us_topic_0000001298667441_li194597302096"></a>You have prepared a <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b670902742319">bootstrap</strong> file as the startup file of the HTTP function.<p id="functiongraph_01_1442__en-us_topic_0000001298667441_p73365091516">The content of the <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b1540812535387">bootstrap</strong> file is as follows:</p>
<pre class="screen" id="functiongraph_01_1442__en-us_topic_0000001298667441_screen22081658101813">/opt/function/runtime/nodejs12.13/rtsp/nodejs/bin/node $RUNTIME_CODE_ROOT/index.js</pre>
</li><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li46036399226">Compress the preceding two files into a ZIP package.<div class="fignone" id="functiongraph_01_1442__en-us_topic_0000001298667441_fig8326655132718"><span class="figcap"><b>Figure 1 </b>Compressing files into a ZIP package</span><br><span><img id="functiongraph_01_1442__en-us_topic_0000001298667441_image5326155520270" src="en-us_image_0000002304899677.png" title="Click to enlarge" class="imgResize"></span></div>
<p id="functiongraph_01_1442__en-us_topic_0000001298667441_p1233151441911">For HTTP functions in Python, add the <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b12376135393911">-u</strong> parameter in the <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b2376953133919">bootstrap</strong> file to ensure that logs can be flushed to the disk. For example:</p>
<pre class="screen" id="functiongraph_01_1442__en-us_topic_0000001298667441_screen17767127335">/opt/function/runtime/python3.6/rtsp/python/bin/python3 <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b997174872213">-u</strong> $RUNTIME_CODE_ROOT/index.py</pre>
<p id="functiongraph_01_1442__en-us_topic_0000001298667441_p106688393223">To use another runtime, change the runtime path by referring to <a href="#functiongraph_01_1442__en-us_topic_0000001298667441_table14711164545017">Table 2</a>. The code package path does not need to be changed.</p>
<div class="tablenoborder"><a name="functiongraph_01_1442__en-us_topic_0000001298667441_table14711164545017"></a><a name="en-us_topic_0000001298667441_table14711164545017"></a><table cellpadding="4" cellspacing="0" summary="" id="functiongraph_01_1442__en-us_topic_0000001298667441_table14711164545017" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Paths for different runtimes</caption><thead align="left"><tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row37111645115020"><th align="left" class="cellrowborder" valign="top" width="30.330000000000002%" id="mcps1.3.5.2.3.5.2.3.1.1"><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p1571117452505">Runtime</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="69.67%" id="mcps1.3.5.2.3.5.2.3.1.2"><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p171113454506">Path</p>
</th>
</tr>
</thead>
<tbody><tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row12711174511509"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p67117451507">Java 8</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p87111945175013">/opt/function/runtime/java8/rtsp/jre/bin/java</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row1711345185015"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p147113457501">Java 11</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p197117457508">/opt/function/runtime/java11/rtsp/jre/bin/java</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row15633734275"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p796184016710">Java 17</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p596114401712">/opt/function/runtime/java17/rtsp/jre/bin/java</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row203382375711"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p09574219711">Java 21</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p9955427714">/opt/function/runtime/java21/rtsp/jre/bin/java</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row167111645145010"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p10711154519508">Node.js 6</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p107111045155019">/opt/function/runtime/nodejs6.10/rtsp/nodejs/bin/node</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row97111745185018"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p47118455504">Node.js 8</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p207119451508">/opt/function/runtime/nodejs8.10/rtsp/nodejs/bin/node</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row8711154565011"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p13711174510503">Node.js 10</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p9711164519509">/opt/function/runtime/nodejs10.16/rtsp/nodejs/bin/node</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row1171211458506"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p1871274510509">Node.js 12</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p271214545016">/opt/function/runtime/nodejs12.13/rtsp/nodejs/bin/node</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row5712124512505"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p87122045115016">Node.js 14</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p1071219454507">/opt/function/runtime/nodejs14.18/rtsp/nodejs/bin/node</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row1571254510508"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p271294515507">Node.js 16</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p17712114515507">/opt/function/runtime/nodejs16.17/rtsp/nodejs/bin/node</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row8712144525015"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p137126459505">Node.js 18</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p6712045115014">/opt/function/runtime/nodejs18.15/rtsp/nodejs/bin/node</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row87371541087"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p16230164414819">Node.js 20</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p1623018441585">/opt/function/runtime/nodejs20.15/rtsp/nodejs/bin/node</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row1871218454507"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p871219451503">Python 2.7</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p1271264511505">/opt/function/runtime/python2.7/rtsp/python/bin/python</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row1171264513508"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p1571264519503">Python 3.6</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p12712174510502">/opt/function/runtime/python3.6/rtsp/python/bin/python3</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row9712134512502"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p1871274545017">Python 3.9</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p671234517507">/opt/function/runtime/python3.9/rtsp/python/bin/python3</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row128225116917"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p108871710917">Python 3.10</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p8887671398">/opt/function/runtime/python3.10/rtsp/python/bin/python3</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row11953642915"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p19641391918">Python 3.12</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p11641499911">/opt/function/runtime/python3.12/rtsp/python/bin/python3</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row137121045125017"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p1871220450507">PHP 7.3</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p571234512506">/opt/function/runtime/php7.3/rtsp/php/bin/php</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row11341413201011"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p4779617111019">PHP 8.3</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p477961713104">/opt/function/runtime/php8.3/rtsp/php/bin/php</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row464118641112"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p15880153114">C# (.NET Core 2.1)</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p1458813156115">/opt/function/runtime/dotnet2.1/rtsp/dotnet/dotnet</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row1666668121111"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p999843181117">C# (.NET Core 3.1)</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p159919431114">/opt/function/runtime/dotnet3.1/rtsp/dotnet/dotnet</p>
</td>
</tr>
<tr id="functiongraph_01_1442__en-us_topic_0000001298667441_row1876161017115"><td class="cellrowborder" valign="top" width="30.330000000000002%" headers="mcps1.3.5.2.3.5.2.3.1.1 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p13390124813115">C# (.NET Core 6.0)</p>
</td>
<td class="cellrowborder" valign="top" width="69.67%" headers="mcps1.3.5.2.3.5.2.3.1.2 "><p id="functiongraph_01_1442__en-us_topic_0000001298667441_p63904487112">/opt/function/runtime/dotnet6.0/rtsp/dotnet/dotnet</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ol>
</div></div></div>
<div class="section" id="functiongraph_01_1442__en-us_topic_0000001298667441_section461413734619"><div class="dropdownexpand"><div class="dropdowntitle" onclick="ExpandorCollapseNode(this)"><h4 class="sectiontitle">Step 2: Deploying the Code Package</h4></div><div class="dropdowncontext"></div><div class="dropdowncontext"><ol id="functiongraph_01_1442__en-us_topic_0000001298667441_ol1519415451896"><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li1419511451497">On the <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b584044594019">Code</strong> page of the HTTP function, click <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b16840345154015">Upload</strong> &gt; <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b9840204574011">Local ZIP</strong>, and upload the prepared ZIP file.</li><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li1719574517917">Create a trigger.<ol type="a" id="functiongraph_01_1442__en-us_topic_0000001298667441_ol9925103812428"><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li182613514423">Choose <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b161291334116">Configuration</strong> &gt; <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b6130123114111">Triggers</strong> and click <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b213010394111">Create Trigger</strong>.</li><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li658812919263">Configure the trigger information..<div class="fignone" id="functiongraph_01_1442__en-us_topic_0000001298667441_fig171652713213"><span class="figcap"><b>Figure 2 </b>Creating a trigger</span><br><span><img id="functiongraph_01_1442__en-us_topic_0000001298667441_image14161227193217" src="en-us_image_0000002297455738.png" title="Click to enlarge" class="imgResize"></span></div>
<p id="functiongraph_01_1442__en-us_topic_0000001298667441_p114431128201611"></p>
<p id="functiongraph_01_1442__en-us_topic_0000001298667441_p1116754652720">In this example, <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b14855174012913">Security Authentication</strong> is set to <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b93041245590">None</strong>. You need to select an authentication mode based on site requirements.</p>
<div class="note" id="functiongraph_01_1442__en-us_topic_0000001298667441_note9961203311015"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="functiongraph_01_1442__en-us_topic_0000001298667441_ul57811452162713"><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li156201156202710"><strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b10511241151418">App</strong>: AppKey and AppSecret authentication. This mode is of high security and is recommended.</li><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li5120135914273"><strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b1648664565320">IAM</strong>: IAM authentication. This mode grants access permissions to IAM users only and is of medium security.</li><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li197811952122712"><strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b131515381111">None</strong>: No authentication. This mode grants access permissions to all users.</li></ul>
</div></div>
</li><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li187801028451">Click <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b1275371219493">OK</strong>.</li></ol>
</li><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li91958457917">Publish the API.<ol type="a" id="functiongraph_01_1442__en-us_topic_0000001298667441_ol165263918460"><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li1475073533115">On the <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b1341104014263">Triggers</strong> tab page, click an API name to go to the API overview page.<div class="fignone" id="functiongraph_01_1442__en-us_topic_0000001298667441_fig18251102218347"><span class="figcap"><b>Figure 3 </b>API trigger</span><br><span><img id="functiongraph_01_1442__en-us_topic_0000001298667441_image1225252213341" src="en-us_image_0000002331536373.png" title="Click to enlarge" class="imgResize"></span></div>
<p id="functiongraph_01_1442__en-us_topic_0000001298667441_p9189131961811"></p>
</li><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li13737114214317">Click <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b1152822882818">Edit</strong> in the upper right corner. The API basic information page is displayed.<div class="fignone" id="functiongraph_01_1442__en-us_topic_0000001298667441_fig116781546105617"><span class="figcap"><b>Figure 4 </b>Modifying an API</span><br><span><img id="functiongraph_01_1442__en-us_topic_0000001298667441_image1297810249284" src="en-us_image_0000002324141336.png" title="Click to enlarge" class="imgResize"></span></div>
<p id="functiongraph_01_1442__en-us_topic_0000001298667441_p16834593013"></p>
</li><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li187441424314">Change the value of <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b844374705019">Path</strong> to <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b104342050155014">/user/get</strong> and click <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b1539245410505">Finish</strong>.<div class="fignone" id="functiongraph_01_1442__en-us_topic_0000001298667441_fig15733183413382"><span class="figcap"><b>Figure 5 </b>Defining an API request</span><br><span><img id="functiongraph_01_1442__en-us_topic_0000001298667441_image1410192533414" src="en-us_image_0000002323978684.png" title="Click to enlarge" class="imgResize"></span></div>
<p id="functiongraph_01_1442__en-us_topic_0000001298667441_p24214103418"></p>
</li><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li662821943811">On the API details page, click <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b7654145418913">Publish</strong> in the upper right corner. On the displayed page, click <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b1744610301491">OK</strong>.</li></ol>
</li></ol>
</div></div></div>
<div class="section" id="functiongraph_01_1442__en-us_topic_0000001298667441_section65194207469"><div class="dropdownexpand"><div class="dropdowntitle" onclick="ExpandorCollapseNode(this)"><h4 class="sectiontitle">Step 3: Triggering Function Execution</h4></div><div class="dropdowncontext"></div><div class="dropdowncontext"><ol id="functiongraph_01_1442__en-us_topic_0000001298667441_ol614024344716"><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li153075165434">Go to the FunctionGraph console, choose <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b3710183842513">Functions</strong> &gt; <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b9279842182519">Function List</strong> in the navigation pane, and click the created HTTP function to go to its details page.</li><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li1399711813455">Choose <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b19984343508">Configuration</strong> &gt; <strong id="functiongraph_01_1442__en-us_topic_0000001298667441_b398416433018">Triggers</strong>, copy the URL as shown in , and access it using a browser.<div class="fignone" id="functiongraph_01_1442__en-us_topic_0000001298667441_fig20332315134115"><span class="figcap"><b>Figure 6 </b>Copying the URL</span><br><span><img id="functiongraph_01_1442__en-us_topic_0000001298667441_image103321715154110" src="en-us_image_0000002297623066.png" title="Click to enlarge" class="imgResize"></span></div>
<p id="functiongraph_01_1442__en-us_topic_0000001298667441_p16239321193115"></p>
</li><li id="functiongraph_01_1442__en-us_topic_0000001298667441_li18604114504613">View the request result.<div class="fignone" id="functiongraph_01_1442__en-us_topic_0000001298667441_fig996217418250"><span class="figcap"><b>Figure 7 </b>Viewing the request result</span><br><span><img id="functiongraph_01_1442__en-us_topic_0000001298667441_image128491352155515" src="en-us_image_0000002270169884.png" title="Click to enlarge" class="imgResize"></span></div>
</li></ol>
</div></div></div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="functiongraph_01_0153.html">Creating a Function from Scratch</a></div>
</div>
</div>
<script language="JavaScript">
<!--
image_size('.imgResize');
var msg_imageMax = "view original image";
var msg_imageClose = "close";
//--></script>