doc-exports/docs/opengauss/api-ref/opengauss_api_0011.html
Ru, Li Yi d97aea4dd2 opengauss_api
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-09-06 09:04:21 +00:00

41 lines
4.4 KiB
HTML

<a name="EN-US_TOPIC_0000001947569801"></a><a name="EN-US_TOPIC_0000001947569801"></a>
<h1 class="topictitle1">Response</h1>
<div id="body1592884185818"><div class="section" id="EN-US_TOPIC_0000001947569801__section968114282311"><h4 class="sectiontitle">Status Code</h4><p id="EN-US_TOPIC_0000001947569801__p4624111624411">After sending a request, you will receive a response, including the status code, response header, and response body.</p>
<p id="EN-US_TOPIC_0000001947569801__p124381044137">A status code is a group of digits ranging from 1xx to 5xx. It indicates the status of a response. For more information, see <a href="opengauss_api_0032.html">Status Codes</a>.</p>
<p id="EN-US_TOPIC_0000001947569801__p2861496519">For example, if status code <strong id="EN-US_TOPIC_0000001947569801__b033215334346">201</strong> is returned for calling 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 a user token</a>, the request is successful.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001947569801__en-us_topic_0113746487_section61333484715"><h4 class="sectiontitle">Response Header</h4><p id="EN-US_TOPIC_0000001947569801__p384320471837">Similar to a request, a response also has a header, for example, <span class="parmvalue" id="EN-US_TOPIC_0000001947569801__en-us_topic_0170210614_en-us_topic_0170195383_parmvalue1720109175113"><b>Content-Type</b></span>.</p>
<p id="EN-US_TOPIC_0000001947569801__p4430113619484"><a href="#EN-US_TOPIC_0000001947569801__fig4865141011511">Figure 1</a> shows the response header 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 a user token</a>. The <span class="parmname" id="EN-US_TOPIC_0000001947569801__parmname73711320153512"><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="EN-US_TOPIC_0000001947569801__fig4865141011511"><a name="EN-US_TOPIC_0000001947569801__fig4865141011511"></a><a name="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_0000001947569801__image48651610135113" src="figure/en-us_image_0000001917290796.png"></span></div>
</div>
<div class="section" id="EN-US_TOPIC_0000001947569801__en-us_topic_0113746487_section2045571671419"><h4 class="sectiontitle">(Optional) Response Body</h4><p id="EN-US_TOPIC_0000001947569801__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="EN-US_TOPIC_0000001947569801__b531219178360">Content-Type</strong> header field. The response body transfers content except the response header.</p>
<div class="p" id="EN-US_TOPIC_0000001947569801__p157041652367">The following is part of the response body 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 a user token</a>.<pre class="screen" id="EN-US_TOPIC_0000001947569801__screen01152675713">{
"token": {
"expires_at": "2019-02-13T06:52:13.855000Z",
"methods": [
"password"
],
"catalog": [
{
"endpoints": [
{
"region_id": "az-01",
......</pre>
</div>
<div class="p" id="EN-US_TOPIC_0000001947569801__p127537375412">If an error occurs during API calling, an error code and a message will be displayed. The following shows an error response body.<pre class="screen" id="EN-US_TOPIC_0000001947569801__screen198081822715">{
"error_code": "AS.0001",
"error_msg": "The format of message is error"
}
</pre>
</div>
<p id="EN-US_TOPIC_0000001947569801__p1589911464018">In the response body, <strong id="EN-US_TOPIC_0000001947569801__en-us_topic_0170210614_en-us_topic_0170195383_b5649173911322">error_code</strong> is an error code, and <strong id="EN-US_TOPIC_0000001947569801__en-us_topic_0170210614_en-us_topic_0170195383_b9768124353218">error_msg</strong> provides information about the error.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="opengauss_api_0008.html">Calling APIs</a></div>
</div>
</div>