forked from docs/doc-exports
Reviewed-by: Muller, Martin <martin.muller@t-systems.com> Co-authored-by: guoyanyan <guoyanyan3@huawei.com> Co-committed-by: guoyanyan <guoyanyan3@huawei.com>
66 lines
6.1 KiB
HTML
66 lines
6.1 KiB
HTML
<a name="EN-US_TOPIC_0170155703"></a><a name="EN-US_TOPIC_0170155703"></a>
|
|
|
|
<h1 class="topictitle1">Response</h1>
|
|
<div id="body1557988880616"><div class="section" id="EN-US_TOPIC_0170155703__section968114282311"><h4 class="sectiontitle">Status Code</h4><p id="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="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="en-us_topic_0121643825.html">Status Codes</a>.</p>
|
|
<p id="EN-US_TOPIC_0170155703__p2861496519">For example, if status code <span class="parmvalue" id="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="EN-US_TOPIC_0170155703__en-us_topic_0113746487_section61333484715"><h4 class="sectiontitle">Response Header</h4><p id="EN-US_TOPIC_0170155703__p384320471837">Similar to a request, a response also has a header, for example, <strong id="EN-US_TOPIC_0170155703__b1985552133610">Content-Type</strong>.</p>
|
|
<p id="EN-US_TOPIC_0170155703__p4430113619484"><a href="#EN-US_TOPIC_0170155703__fig4865141011511">Figure 1</a> shows the response header fields for the API used to . The <strong id="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="fignone" id="EN-US_TOPIC_0170155703__fig4865141011511"><a name="EN-US_TOPIC_0170155703__fig4865141011511"></a><a name="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="EN-US_TOPIC_0170155703__image48651610135113" src="en-us_image_0170178416.png" title="Click to enlarge" class="imgResize"></span></div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0170155703__en-us_topic_0113746487_section2045571671419"><h4 class="sectiontitle">(Optional) Response Body</h4><p id="EN-US_TOPIC_0170155703__en-us_topic_0113746487_p64711881416">The body of a response is often returned in structured format as specified in the <strong id="EN-US_TOPIC_0170155703__b13357143052813">Content-Type</strong> header field. The response body transfers content except the response header.</p>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0170155703__p157041652367">The following is part of the response body for the API used to .</p>
|
|
<div class="codecoloring" codetype="Java" id="EN-US_TOPIC_0170155703__screen65818201917"><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>
|
|
<span class="normal"> 5</span>
|
|
<span class="normal"> 6</span>
|
|
<span class="normal"> 7</span>
|
|
<span class="normal"> 8</span>
|
|
<span class="normal"> 9</span>
|
|
<span class="normal">10</span>
|
|
<span class="normal">11</span>
|
|
<span class="normal">12</span></pre></div></td><td class="code"><div><pre><span></span><span class="p">{</span>
|
|
<span class="w"> </span><span class="s">"token"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span>
|
|
<span class="w"> </span><span class="s">"expires_at"</span><span class="p">:</span><span class="w"> </span><span class="s">"2019-02-13T06:52:13.855000Z"</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="s">"methods"</span><span class="p">:</span><span class="w"> </span><span class="o">[</span>
|
|
<span class="w"> </span><span class="s">"password"</span>
|
|
<span class="w"> </span><span class="o">]</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="s">"catalog"</span><span class="p">:</span><span class="w"> </span><span class="o">[</span>
|
|
<span class="w"> </span><span class="p">{</span>
|
|
<span class="w"> </span><span class="s">"endpoints"</span><span class="p">:</span><span class="w"> </span><span class="o">[</span>
|
|
<span class="w"> </span><span class="p">{</span>
|
|
<span class="w"> </span><span class="s">"region_id"</span><span class="p">:</span><span class="w"> </span><span class="s">"az-01"</span><span class="p">,</span>
|
|
<span class="p">......</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<p id="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="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">"error_msg"</span><span class="p">:</span><span class="w"> </span><span class="s">"The format of message is error"</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="s">"error_code"</span><span class="p">:</span><span class="w"> </span><span class="s">"AS.0001"</span>
|
|
<span class="p">}</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<p id="EN-US_TOPIC_0170155703__p1589911464018">In the response body, <strong id="EN-US_TOPIC_0170155703__b1022472112479">error_code</strong> is an error code, and <strong id="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="en-us_topic_0121671868.html">Calling APIs</a></div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script language="JavaScript">
|
|
<!--
|
|
image_size('.imgResize');
|
|
var msg_imageMax = "view original image";
|
|
var msg_imageClose = "close";
|
|
//--></script> |