1
0
forked from docs/doc-exports
doc-exports/docs/drs/api-ref/drs_01_0007.html
Ru, Li Yi 9c5f69ed88 drs_api_20240415
Reviewed-by: Boka, Ladislav <ladislav.boka@t-systems.com>
Co-authored-by: Ru, Li Yi <liyiru7@huawei.com>
Co-committed-by: Ru, Li Yi <liyiru7@huawei.com>
2024-04-22 18:20:28 +00:00

44 lines
3.9 KiB
HTML

<a name="drs_01_0007"></a><a name="drs_01_0007"></a>
<h1 class="topictitle1">Returned Values</h1>
<div id="body0000001073398654"><div class="section" id="drs_01_0007__en-us_topic_0117388900_section11248050145310"><h4 class="sectiontitle">Status Code</h4><p id="drs_01_0007__en-us_topic_0117388900_p1032012505539">After sending a request, you will receive a response, including a status code, response header, and response body.</p>
<p id="drs_01_0007__en-us_topic_0117388900_p17320195012538">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="drs_api_0108.html">Status Code</a>.</p>
<p id="drs_01_0007__en-us_topic_0117388900_p5320115045311">For example, if status code 201 is returned for calling the API used to obtain a user token, the request is successful.</p>
</div>
<div class="section" id="drs_01_0007__en-us_topic_0117388900_section7525122275411"><h4 class="sectiontitle">Response Header</h4><p id="drs_01_0007__en-us_topic_0117388900_p15728221542">Similar to a request, a response also has a header, for example, <strong id="drs_01_0007__en-us_topic_0117388900_b928413914910">Content-Type</strong>.</p>
<p id="drs_01_0007__en-us_topic_0117388900_p18572222155417"><a href="#drs_01_0007__en-us_topic_0117388900_fig85721224549">Figure 1</a> shows the response header fields for the API used to obtain a user token is called. The <strong id="drs_01_0007__en-us_topic_0117388900_b6956118181112">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="drs_01_0007__en-us_topic_0117388900_fig85721224549"><a name="drs_01_0007__en-us_topic_0117388900_fig85721224549"></a><a name="en-us_topic_0117388900_fig85721224549"></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="drs_01_0007__image6230195920146" src="en-us_image_0000001782032750.png"></span></div>
</div>
<div class="section" id="drs_01_0007__en-us_topic_0117388900_section855317397543"><h4 class="sectiontitle">Response Body</h4><p id="drs_01_0007__en-us_topic_0117388900_p18620163910547">The body of a response is often returned in structured format as specified in the <strong id="drs_01_0007__en-us_topic_0117388900_b12645205131011">Content-type</strong> header field. The response body transfers content except the response header.</p>
<p id="drs_01_0007__en-us_topic_0117388900_p96201839195416">The following is part of the response body for the API used to obtain a user token. The following shows part of the response body for the API to obtain a user token.</p>
<pre class="screen" id="drs_01_0007__en-us_topic_0117388900_screen17620103912543">{
"token": {
"expires_at": "2019-02-13T06:52:13.855000Z",
"methods": [
"password"
],
"catalog": [
{
"endpoints": [
{
"region_id": "eu-de",
......</pre>
<p id="drs_01_0007__en-us_topic_0117388900_p16201392547">If an error occurs during API calling, the system returns an error code and message to you. The following shows the format of an error response body:</p>
<pre class="screen" id="drs_01_0007__en-us_topic_0117388900_screen13620113918541">{
"error_msg": "The format of message is error",
"error_code": "AS.0001"
}</pre>
<p id="drs_01_0007__en-us_topic_0117388900_p1362013396544">In the response body, <strong id="drs_01_0007__en-us_topic_0117388900_b47910615111">error_code</strong> is an error code, and <strong id="drs_01_0007__en-us_topic_0117388900_b1979196101114">error_msg</strong> provides information about the error.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="drs_01_0004.html">Calling APIs</a></div>
</div>
</div>