forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Lai, Weijian <laiweijian4@huawei.com> Co-committed-by: Lai, Weijian <laiweijian4@huawei.com>
47 lines
5.1 KiB
HTML
47 lines
5.1 KiB
HTML
<a name="EN-US_TOPIC_0000001910007948"></a><a name="EN-US_TOPIC_0000001910007948"></a>
|
|
|
|
<h1 class="topictitle1">Response</h1>
|
|
<div id="body1558602472849"><p id="EN-US_TOPIC_0000001910007948__p18688042817">After sending a request, you will receive a response, including the status code, response header, and response body.</p>
|
|
<div class="section" id="EN-US_TOPIC_0000001910007948__en-us_topic_0170917209_en-us_topic_0168405765_section968114282311"><h4 class="sectiontitle">Status Code</h4><p id="EN-US_TOPIC_0000001910007948__en-us_topic_0170917209_en-us_topic_0168405765_p4624111624411">A status code is a group of digits, ranging from 1<em id="EN-US_TOPIC_0000001910007948__i332210270475">xx</em> to 5<em id="EN-US_TOPIC_0000001910007948__i911973184710">xx</em>. It indicates the status of a request. For more information, see <a href="modelarts_03_0094.html">Status Code</a>.</p>
|
|
<p id="EN-US_TOPIC_0000001910007948__en-us_topic_0170917209_en-us_topic_0168405765_p2861496519">For example, if status code <span class="parmvalue" id="EN-US_TOPIC_0000001910007948__parmvalue15742182474811"><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_0000001910007948__en-us_topic_0170917209_en-us_topic_0168405765_section7804143005810"><h4 class="sectiontitle">Response Header</h4><p id="EN-US_TOPIC_0000001910007948__en-us_topic_0170917209_en-us_topic_0168405765_p384320471837">Similar to a request, a response also has a header, for example, <span class="parmvalue" id="EN-US_TOPIC_0000001910007948__en-us_topic_0170917209_en-us_topic_0168405765_parmvalue1720109175113"><b>Content-type</b></span>.</p>
|
|
<p id="EN-US_TOPIC_0000001910007948__p1169716258304"><a href="#EN-US_TOPIC_0000001910007948__en-us_topic_0170917209_en-us_topic_0168405765_fig4865141011511">Figure 1</a> shows the response header fields for the API used to obtain a user token.</p>
|
|
<p id="EN-US_TOPIC_0000001910007948__en-us_topic_0170917209_en-us_topic_0168405765_p4430113619484"><span class="parmname" id="EN-US_TOPIC_0000001910007948__en-us_topic_0170917209_en-us_topic_0168405765_parmname963417819525"><b>x-subject-token</b></span> is the desired user token. This token can then be used to authenticate the calling of other APIs.</p>
|
|
<div class="fignone" id="EN-US_TOPIC_0000001910007948__en-us_topic_0170917209_en-us_topic_0168405765_fig4865141011511"><a name="EN-US_TOPIC_0000001910007948__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 fields of the response to the request for obtaining a user token</span><br><span><img id="EN-US_TOPIC_0000001910007948__en-us_topic_0170917209_en-us_topic_0168405765_image48651610135113" src="figure/en-us_image_0000001943967489.png" height="304.2375" width="523.6875" title="Click to enlarge" class="imgResize"></span></div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001910007948__en-us_topic_0170917209_en-us_topic_0168405765_section034615592583"><h4 class="sectiontitle">Response Body</h4><p id="EN-US_TOPIC_0000001910007948__en-us_topic_0170917209_en-us_topic_0168405765_p133921631940">The body of a response is often returned in structured format as specified in the <strong id="EN-US_TOPIC_0000001910007948__b197441717154818">Content-Type</strong> header field. The response body transfers content except the response header.</p>
|
|
<p id="EN-US_TOPIC_0000001910007948__en-us_topic_0170917209_en-us_topic_0168405765_p157041652367">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_0000001910007948__en-us_topic_0170917209_en-us_topic_0168405765_screen65818201917">{
|
|
"token": {
|
|
"expires_at": "2019-02-13T06:52:13.855000Z",
|
|
"methods": [
|
|
"password"
|
|
],
|
|
"catalog": [
|
|
{
|
|
"endpoints": [
|
|
{
|
|
"region_id": "aaa",
|
|
......</pre>
|
|
<p id="EN-US_TOPIC_0000001910007948__en-us_topic_0170917209_en-us_topic_0168405765_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="EN-US_TOPIC_0000001910007948__en-us_topic_0170917209_en-us_topic_0168405765_screen102091730125513">{
|
|
"error_msg": "The format of message is error",
|
|
"error_code": "AS.0001"
|
|
}</pre>
|
|
<p id="EN-US_TOPIC_0000001910007948__en-us_topic_0170917209_en-us_topic_0168405765_p1589911464018">In the error response body, <strong id="EN-US_TOPIC_0000001910007948__b56191737571">error_code</strong> is an error code, and <strong id="EN-US_TOPIC_0000001910007948__b8138184317714">error_msg</strong> provides information about the error. For more details, see <a href="modelarts_03_0095.html">Error Codes</a>.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="modelarts_03_0144.html">Calling APIs</a></div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script language="JavaScript">
|
|
<!--
|
|
image_size('.imgResize');
|
|
var msg_imageMax = "view original image";
|
|
var msg_imageClose = "close";
|
|
//--></script> |