1
0
forked from docs/doc-exports
doc-exports/docs/css/api-ref/css_03_0140.html
Zheng, Xiu 3fa966049f css api 20240704 version
Reviewed-by: Kacur, Michal <michal.kacur@t-systems.com>
Co-authored-by: Zheng, Xiu <zhengxiu@huawei.com>
Co-committed-by: Zheng, Xiu <zhengxiu@huawei.com>
2024-07-22 17:01:37 +00:00

40 lines
4.2 KiB
HTML

<a name="css_03_0140"></a><a name="css_03_0140"></a>
<h1 class="topictitle1">Returned Values</h1>
<div id="body8662426"><div class="section" id="css_03_0140__en-us_topic_0170917209_en-us_topic_0168405765_section968114282311"><h4 class="sectiontitle">Status Code</h4><p id="css_03_0140__en-us_topic_0170917209_en-us_topic_0168405765_p4624111624411">After sending a request, you will receive a response containing the status code, response header, and response body.</p>
<p id="css_03_0140__en-us_topic_0170917209_en-us_topic_0168405765_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="css_03_0075.html">Status Code</a>.</p>
<p id="css_03_0140__en-us_topic_0170917209_en-us_topic_0168405765_p2861496519">If status code 201 is returned for the calling of the API for obtaining a user token, the request is successful.</p>
</div>
<div class="section" id="css_03_0140__en-us_topic_0170917209_en-us_topic_0168405765_section7804143005810"><h4 class="sectiontitle">Response Header</h4><p id="css_03_0140__en-us_topic_0170917209_en-us_topic_0168405765_p384320471837">A response header corresponds to a request header, for example, <span class="parmvalue" id="css_03_0140__en-us_topic_0170917209_parmvalue946210448619"><b>Content-Type</b></span>.</p>
<p id="css_03_0140__en-us_topic_0170917209_en-us_topic_0168405765_p4430113619484"><a href="#css_03_0140__en-us_topic_0170917209_en-us_topic_0168405765_fig4865141011511">Figure 1</a> shows the response header for the API of obtaining a user token, where <span class="parmname" id="css_03_0140__en-us_topic_0170917209_parmname109780549620"><b>x-subject-token</b></span> is the desired user token. Then, you can use the token to authenticate the calling of other APIs.</p>
<div class="fignone" id="css_03_0140__en-us_topic_0170917209_en-us_topic_0168405765_fig4865141011511"><a name="css_03_0140__en-us_topic_0170917209_en-us_topic_0168405765_fig4865141011511"></a><a name="en-us_topic_0170917209_en-us_topic_0168405765_fig4865141011511"></a><span class="figcap"><b>Figure 1 </b>Header of the response to the request for obtaining a user token</span><br><span><img id="css_03_0140__en-us_topic_0170917209_en-us_topic_0168405765_image48651610135113" src="en-us_image_0000001554710113.png"></span></div>
</div>
<div class="section" id="css_03_0140__en-us_topic_0170917209_en-us_topic_0168405765_section034615592583"><h4 class="sectiontitle">Response Body</h4><p id="css_03_0140__en-us_topic_0170917209_en-us_topic_0168405765_p133921631940">A response body is generally returned in a structured format, corresponding to the <strong id="css_03_0140__en-us_topic_0170917209_b59654378715">Content-Type</strong> in the response header, and is used to transfer content other than the response header.</p>
<p id="css_03_0140__en-us_topic_0170917209_en-us_topic_0168405765_p157041652367">The following shows part of the response body for the API of obtaining a user token.</p>
<pre class="screen" id="css_03_0140__en-us_topic_0170917209_en-us_topic_0168405765_screen65818201917">{
"token": {
"expires_at": "2019-02-13T06:52:13.855000Z",
"methods": [
"password"
],
"catalog": [
{
"endpoints": [
{
"region_id": "xxx",
......</pre>
<p id="css_03_0140__en-us_topic_0170917209_en-us_topic_0168405765_p127537375412">If an error occurs during API calling, the system returns an error code and a message to you. The following shows the format of an error response body:</p>
<pre class="screen" id="css_03_0140__en-us_topic_0170917209_en-us_topic_0168405765_screen102091730125513">{
"error_msg": "The format of message is error",
"error_code": "AS.0001"
}</pre>
<p id="css_03_0140__en-us_topic_0170917209_en-us_topic_0168405765_p1589911464018">In the preceding information, <strong id="css_03_0140__en-us_topic_0170917209_b54237551882">error_code</strong> is an error code, and <strong id="css_03_0140__en-us_topic_0170917209_b17424195519816">error_msg</strong> describes the error.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="css_03_0137.html">Calling APIs</a></div>
</div>
</div>