doc-exports/docs/sfs/api-ref/sfs_02_0012.html
zhangyue 49ac6fa9ce SFS HPC API DOC
Reviewed-by: Miskanin, Jan <jan.miskanin@t-systems.com>
Co-authored-by: zhangyue <zhangyue164@huawei.com>
Co-committed-by: zhangyue <zhangyue164@huawei.com>
2024-08-16 12:25:57 +00:00

41 lines
4.8 KiB
HTML

<a name="sfs_02_0012"></a><a name="sfs_02_0012"></a>
<h1 class="topictitle1">Response</h1>
<div id="body1559725760180"><div class="section" id="sfs_02_0012__en-us_topic_0170155703_section968114282311"><h4 class="sectiontitle">Status Code</h4><p id="sfs_02_0012__en-us_topic_0170155703_p4624111624411">After sending a request, you will receive a response, including a status code, response header, and response body.</p>
<p id="sfs_02_0012__en-us_topic_0170155703_p124381044137">A status code is a group of digits, ranging from 1xx to 5xx. It indicates the status of a request. For more information, see <a href="sfs_02_0089.html">Status Codes</a>.</p>
<p id="sfs_02_0012__en-us_topic_0170155703_p2861496519">For example, if status code <span class="parmvalue" id="sfs_02_0012__en-us_topic_0170155703_parmvalue343043992219"><b>201</b></span> is returned for calling the API used to , the request is successful.</p>
</div>
<div class="section" id="sfs_02_0012__en-us_topic_0170155703_en-us_topic_0113746487_section61333484715"><h4 class="sectiontitle">Response Header</h4><p id="sfs_02_0012__en-us_topic_0170155703_p384320471837">Similar to a request, a response also has a header, for example, <strong id="sfs_02_0012__en-us_topic_0170155703_b1985552133610">Content-Type</strong>.</p>
<p id="sfs_02_0012__en-us_topic_0170155703_p4430113619484"><a href="#sfs_02_0012__en-us_topic_0170155703_fig4865141011511">Figure 1</a> shows the response header fields for the API used to . The <strong id="sfs_02_0012__en-us_topic_0170155703_b15219862413">X-Subject-Token</strong> header field is the desired user token. This token can then be used to authenticate the calling of other APIs.</p>
<div class="note" id="sfs_02_0012__en-us_topic_0170155703_note29537174719"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="sfs_02_0012__en-us_topic_0170155703_p595414144718">For security purposes, you are advised to set the token in ciphertext in configuration files or environment variables and decrypt it when using it.</p>
</div></div>
<div class="fignone" id="sfs_02_0012__en-us_topic_0170155703_fig4865141011511"><a name="sfs_02_0012__en-us_topic_0170155703_fig4865141011511"></a><a name="en-us_topic_0170155703_fig4865141011511"></a><span class="figcap"><b>Figure 1 </b>Header fields of the response to the request for obtaining a user token</span><br><span><img id="sfs_02_0012__en-us_topic_0170155703_image1197523984615" src="en-us_image_0000001773129352.png" title="Click to enlarge" class="imgResize"></span></div>
</div>
<div class="section" id="sfs_02_0012__en-us_topic_0170155703_en-us_topic_0113746487_section2045571671419"><h4 class="sectiontitle">(Optional) Response Body</h4><p id="sfs_02_0012__en-us_topic_0170155703_en-us_topic_0113746487_p64711881416">The body of a response is often returned in a structured format (for example, JSON or XML) as specified in the <strong id="sfs_02_0012__en-us_topic_0170155703_b13357143052813">Content-Type</strong> header field. The response body transfers content except the response header.</p>
</div>
<p id="sfs_02_0012__en-us_topic_0170155703_p157041652367">The following is part of the response body for the API used to .</p>
<p id="sfs_02_0012__en-us_topic_0170155703_p127537375412">If an error occurs during API calling, an error code and a message will be displayed. The following shows an error response body.</p>
<div class="codecoloring" codetype="Java" id="sfs_02_0012__en-us_topic_0170155703_screen102091730125513"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span>
<span class="normal">4</span></pre></div></td><td class="code"><div><pre><span></span><span class="p">{</span>
<span class="w"> </span><span class="s">&quot;error_msg&quot;</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;The request message format is invalid.&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="s">&quot;error_code&quot;</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;IMG.0001&quot;</span>
<span class="p">}</span>
</pre></div></td></tr></table></div>
</div>
<p id="sfs_02_0012__en-us_topic_0170155703_p1589911464018">In the response body, <strong id="sfs_02_0012__en-us_topic_0170155703_b1022472112479">error_code</strong> is an error code, and <strong id="sfs_02_0012__en-us_topic_0170155703_b18234321154714">error_msg</strong> provides information about the error.</p>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="sfs_02_0008.html">Calling APIs</a></div>
</div>
</div>
<script language="JavaScript">
<!--
image_size('.imgResize');
var msg_imageMax = "view original image";
var msg_imageClose = "close";
//--></script>