doc-exports/docs/mrs/api-ref/mrs_02_0010.html
Yang, Tong bd2b57f749 MRS API 2.0.38.SP20 version
Reviewed-by: gtema <artem.goncharov@gmail.com>
Co-authored-by: Yang, Tong <yangtong2@huawei.com>
Co-committed-by: Yang, Tong <yangtong2@huawei.com>
2022-11-16 15:06:08 +00:00

40 lines
4.4 KiB
HTML

<a name="mrs_02_0010"></a><a name="mrs_02_0010"></a>
<h1 class="topictitle1">Response</h1>
<div id="body1559185429880"><div class="section" id="mrs_02_0010__en-us_topic_0170155703_section968114282311"><h4 class="sectiontitle">Status Code</h4><p id="mrs_02_0010__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="mrs_02_0010__en-us_topic_0170155703_p124381044137">A status code is a group of digits, ranging from 1<em id="mrs_02_0010__i017391614548">xx</em> to 5<em id="mrs_02_0010__i1017421617542">xx</em>. It indicates the status of a request. For more information, see <a href="mrs_02_0015.html">Status Codes</a>.</p>
<p id="mrs_02_0010__en-us_topic_0170155703_p2861496519">For the API to <a href="https://docs.otc.t-systems.com/en-us/api/iam/en-us_topic_0057845583.html" target="_blank" rel="noopener noreferrer">obtain request authentication</a>, if the status code <span class="parmvalue" id="mrs_02_0010__parmvalue173341316182710"><b>201</b></span> is returned after the API is called, the request is successful.</p>
</div>
<div class="section" id="mrs_02_0010__en-us_topic_0170155703_en-us_topic_0113746487_section61333484715"><h4 class="sectiontitle">Response Header</h4><p id="mrs_02_0010__en-us_topic_0170155703_p384320471837">Similar to a request, a response also has a header, for example, <strong id="mrs_02_0010__b2731055155417">Content-Type</strong>.</p>
<p id="mrs_02_0010__en-us_topic_0170155703_p4430113619484"><a href="#mrs_02_0010__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 request authentication</a>. The <span class="parmname" id="mrs_02_0010__parmname9859162513286"><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="mrs_02_0010__en-us_topic_0170155703_fig4865141011511"><a name="mrs_02_0010__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="mrs_02_0010__image1449194212713" src="en-us_image_0000001298246380.png"></span></div>
</div>
<div class="section" id="mrs_02_0010__en-us_topic_0170155703_en-us_topic_0113746487_section2045571671419"><h4 class="sectiontitle">(Optional) Response Body</h4><p id="mrs_02_0010__en-us_topic_0170155703_en-us_topic_0113746487_p64711881416">This part is optional. The body of a response is often returned in structured format (for example, JSON or XML) as specified in the <strong id="mrs_02_0010__b759917109561">Content-Type</strong> header field. The response body transfers content except the response header.</p>
</div>
<p id="mrs_02_0010__en-us_topic_0170155703_p157041652367">The following shows the response body for the API to <a href="https://docs.otc.t-systems.com/en-us/api/iam/en-us_topic_0057845583.html" target="_blank" rel="noopener noreferrer">obtain request authentication</a>. For the sake of space, only part of the content is displayed here.</p>
<pre class="screen" id="mrs_02_0010__en-us_topic_0170155703_screen65818201917">{
"token": {
"expires_at": "2019-02-13T06:52:13.855000Z",
"methods": [
"password"
],
"catalog": [
{
"endpoints": [
{
"region_id": "aaa"//The region ID "aaa" is used as an example.
...</pre>
<p id="mrs_02_0010__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="mrs_02_0010__en-us_topic_0170155703_screen102091730125513">{
"error_msg": "Invalid cluster name.",
"error_code": "12000002"
}</pre>
<p id="mrs_02_0010__en-us_topic_0170155703_p1589911464018">In the response body, <strong id="mrs_02_0010__b1998919475562">error_code</strong> is an error code, and <strong id="mrs_02_0010__b1299034775617">error_msg</strong> provides information about the error.</p>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_02_0002.html">Calling APIs</a></div>
</div>
</div>