forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Lu, Huayi <luhuayi@huawei.com> Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
46 lines
4.2 KiB
HTML
46 lines
4.2 KiB
HTML
<a name="EN-US_TOPIC_0000001185833138"></a><a name="EN-US_TOPIC_0000001185833138"></a>
|
|
|
|
<h1 class="topictitle1">Response</h1>
|
|
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001185833138__sdf2869b4471243248a50cb5938552d6c"><h4 class="sectiontitle">Status Code</h4><p id="EN-US_TOPIC_0000001185833138__afd00b517b9244cbf94e851851e433700">After sending a request, you will receive a response, including a status code, response header, and response body.</p>
|
|
<p id="EN-US_TOPIC_0000001185833138__a1c8b49a1290d4bbc863d8eb8167f2bdf">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="dws_02_0038.html">Status Code</a>.</p>
|
|
<p id="EN-US_TOPIC_0000001185833138__a5c07a6b44bf349f3bb7a52a4efd5045b">For example, if status code <span class="parmvalue" id="EN-US_TOPIC_0000001185833138__parmvalue19312146167"><b>201</b></span> is returned for calling the API used to obtain a user token, the request is successful.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001185833138__sf5a3f3d7d80f474d9b0637bb8ce37caa"><h4 class="sectiontitle">Response Header</h4><p id="EN-US_TOPIC_0000001185833138__a4536ab3bf21a415fb1051df97c5535c3">Similar to a request, a response also has a header, for example, <strong id="EN-US_TOPIC_0000001185833138__b195181956105317">content-type</strong>.</p>
|
|
<p id="EN-US_TOPIC_0000001185833138__af745a7ca05c64314980abf44d691b888"><a href="#EN-US_TOPIC_0000001185833138__f84b86cb0c7364361a19a908603852b51">Figure 1</a> shows the response header fields for the API used to obtain a user token. The <strong id="EN-US_TOPIC_0000001185833138__b1768202235419">x-subject-token</strong> header field is the desired user token. You can use this token to authenticate the calling of other APIs.</p>
|
|
<div class="fignone" id="EN-US_TOPIC_0000001185833138__f84b86cb0c7364361a19a908603852b51"><a name="EN-US_TOPIC_0000001185833138__f84b86cb0c7364361a19a908603852b51"></a><a name="f84b86cb0c7364361a19a908603852b51"></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_0000001185833138__id2082b75f0e74ea6b4bc24a5df96c04f" src="figure/en-us_image_0000001185833158.png" height="311.22" width="523.6875" title="Click to enlarge" class="imgResize"></span></div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001185833138__s0a329452d9bf4528a1e68ff0db07e594"><h4 class="sectiontitle">Response Body</h4><p id="EN-US_TOPIC_0000001185833138__ab9181347db5141a0862d49ff1b532307">The body of a response is often returned in structured format (for example, JSON or XML) as specified in the <strong id="EN-US_TOPIC_0000001185833138__b185691717192111">Content-type</strong> header field. The response body transfers content except the response header.</p>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001185833138__a54fb4947f79143db9e1ea9f1be240c0f">The following is part of the response body for the API used to obtain a user token. </p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001185833138__s75067ec50d6249baa601eaab72d53e27">{
|
|
"token": {
|
|
"expires_at": "2019-02-13T06:52:13.855000Z",
|
|
"methods": [
|
|
"password"
|
|
],
|
|
"catalog": [
|
|
{
|
|
"endpoints": [
|
|
{
|
|
"region_id": "eu-de",
|
|
......</pre>
|
|
<p id="EN-US_TOPIC_0000001185833138__a25a736dbbf8f4cdcad04908d4a46e227">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="EN-US_TOPIC_0000001185833138__screen102091730125513">{
|
|
"error_msg": "The format of message is error",
|
|
"error_code": "AS.0001"
|
|
}</pre>
|
|
<p id="EN-US_TOPIC_0000001185833138__p1589911464018">In the response body, <strong id="EN-US_TOPIC_0000001185833138__b12791315192214">error_code</strong> is an error code, and <strong id="EN-US_TOPIC_0000001185833138__b187491618152217">error_msg</strong> provides information about the error.</p>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_02_0062.html">Calling APIs</a></div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script language="JavaScript">
|
|
<!--
|
|
image_size('.imgResize');
|
|
var msg_imageMax = "view original image";
|
|
var msg_imageClose = "close";
|
|
//--></script> |