forked from docs/doc-exports
Reviewed-by: Kacur, Michal <michal.kacur@t-systems.com> Co-authored-by: Xiong, Chen Xiao <chenxiaoxiong@huawei.com> Co-committed-by: Xiong, Chen Xiao <chenxiaoxiong@huawei.com>
40 lines
4.3 KiB
HTML
40 lines
4.3 KiB
HTML
<a name="dis_02_0518"></a><a name="dis_02_0518"></a>
|
|
|
|
<h1 class="topictitle1">Response</h1>
|
|
<div id="body8662426"><div class="section" id="dis_02_0518__en-us_topic_0170155703_section968114282311"><h4 class="sectiontitle">Status Code</h4><p id="dis_02_0518__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="dis_02_0518__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="dis_02_0022.html">Status Codes</a>.</p>
|
|
<p id="dis_02_0518__en-us_topic_0170155703_p2861496519">For example, if status code <span class="parmvalue" id="dis_02_0518__parmvalue85861957191220"><b>201</b></span> is returned for calling the API used to <a href="https://docs.otc.t-systems.com/en-us/api/iam/en-us_topic_0057845583.html" target="_blank" rel="noopener noreferrer">obtain a user token</a>, the request is successful.</p>
|
|
</div>
|
|
<div class="section" id="dis_02_0518__en-us_topic_0170155703_en-us_topic_0113746487_section61333484715"><h4 class="sectiontitle">Response Header</h4><p id="dis_02_0518__en-us_topic_0170155703_p384320471837">Similar to a request, a response also has a header, for example, <span class="parmvalue" id="dis_02_0518__en-us_topic_0170155703_parmvalue1720109175113"><b>Content-Type</b></span>.</p>
|
|
<p id="dis_02_0518__en-us_topic_0170155703_p4430113619484"><a href="#dis_02_0518__en-us_topic_0170155703_fig4865141011511">Figure 1</a> shows the response header fields for the API used to <a href="https://docs.otc.t-systems.com/en-us/api/iam/en-us_topic_0057845583.html" target="_blank" rel="noopener noreferrer">obtain a user token</a>. The <span class="parmname" id="dis_02_0518__parmname695100151618"><b>x-subject-token</b></span> 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="dis_02_0518__en-us_topic_0170155703_fig4865141011511"><a name="dis_02_0518__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="dis_02_0518__en-us_topic_0170155703_image48651610135113" src="en-us_image_0170647338.png"></span></div>
|
|
</div>
|
|
<div class="section" id="dis_02_0518__en-us_topic_0170155703_en-us_topic_0113746487_section2045571671419"><h4 class="sectiontitle">(Optional) Response Body</h4><p id="dis_02_0518__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="dis_02_0518__en-us_topic_0121682347_b13100151614438">Content-Type</strong> header field, such as JSON or XML. The response body transfers content except the response header.</p>
|
|
</div>
|
|
<p id="dis_02_0518__en-us_topic_0170155703_p157041652367">The following is part of the response body for the API used to <a href="https://docs.otc.t-systems.com/en-us/api/iam/en-us_topic_0057845583.html" target="_blank" rel="noopener noreferrer">obtain a user token</a>.</p>
|
|
<pre class="screen" id="dis_02_0518__en-us_topic_0170155703_screen65818201917">{
|
|
"token": {
|
|
"expires_at": "2019-02-13T06:52:13.855000Z",
|
|
"methods": [
|
|
"password"
|
|
],
|
|
"catalog": [
|
|
{
|
|
"endpoints": [
|
|
{
|
|
"region_id": "******",
|
|
......</pre>
|
|
<p id="dis_02_0518__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>
|
|
<pre class="screen" id="dis_02_0518__en-us_topic_0170155703_screen102091730125513">{
|
|
"error_msg": "The format of message is error",
|
|
"error_code": "AS.0001"
|
|
}</pre>
|
|
<p id="dis_02_0518__en-us_topic_0170155703_p1589911464018">In the response body, <strong id="dis_02_0518__b173971616132515">error_code</strong> is an error code, and <strong id="dis_02_0518__b1539811611255">error_msg</strong> provides information about the error.</p>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dis_02_0516.html">Calling APIs</a></div>
|
|
</div>
|
|
</div>
|
|
|