doc-exports/docs/vpn/api-ref/vpn_api_0009.html
Hongwei, King Wang 32c06a10a2 vpn_api
Reviewed-by: Sarda, Priya <prsarda@noreply.gitea.eco.tsi-dev.otc-service.com>
Co-authored-by: Hongwei, King Wang <king.wanghongwei@huawei.com>
Co-committed-by: Hongwei, King Wang <king.wanghongwei@huawei.com>
2024-08-15 14:18:28 +00:00

224 lines
27 KiB
HTML

<a name="EN-US_TOPIC_0000001807370452"></a><a name="EN-US_TOPIC_0000001807370452"></a>
<h1 class="topictitle1">Request</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p1457111015284">This section describes the structure of a REST API request, and uses the IAM API for obtaining a user token as an example to demonstrate how to call an API. The obtained token can then be used to authenticate the calling of other APIs.</p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p35771017289"><strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b1457181019285">Request URI</strong></p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p165721016283">A request URI is in the following format:</p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p1257210162810"><strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b1492419134362">{URI-scheme}://{Endpoint}/{resource-path}?{query-string}</strong></p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p757191072816">Although a request URI is included in the request header, most programming languages or frameworks require the request URI to be separately transmitted.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_table155227296337" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters in a URI</caption><thead align="left"><tr id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_row752282916336"><th align="left" class="cellrowborder" valign="top" width="13.65%" id="mcps1.3.6.2.3.1.1"><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p185284413330">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="86.35000000000001%" id="mcps1.3.6.2.3.1.2"><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p3525050103315">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_row1452319293337"><td class="cellrowborder" valign="top" width="13.65%" headers="mcps1.3.6.2.3.1.1 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p985264415335">URI-scheme</p>
</td>
<td class="cellrowborder" valign="top" width="86.35000000000001%" headers="mcps1.3.6.2.3.1.2 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p105255507339">Protocol used to transmit requests. All APIs use HTTPS.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_row7523629133315"><td class="cellrowborder" valign="top" width="13.65%" headers="mcps1.3.6.2.3.1.1 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p158521344153314">Endpoint</p>
</td>
<td class="cellrowborder" valign="top" width="86.35000000000001%" headers="mcps1.3.6.2.3.1.2 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p35251750163317">Domain name or IP address of the server bearing the REST service. The endpoint varies between services in different regions.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_row8523132913338"><td class="cellrowborder" valign="top" width="13.65%" headers="mcps1.3.6.2.3.1.1 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p1485244410335">resource-path</p>
</td>
<td class="cellrowborder" valign="top" width="86.35000000000001%" headers="mcps1.3.6.2.3.1.2 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p8525165017334">Resource path of an API. Obtain the path from the URI of an API. For example, the <strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b61521716134817">resource-path</strong> of the API for obtaining a user token is <strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b16152141616487">/v3/auth/tokens</strong>.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_row185231129123319"><td class="cellrowborder" valign="top" width="13.65%" headers="mcps1.3.6.2.3.1.1 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p19852154419332">query-string</p>
</td>
<td class="cellrowborder" valign="top" width="86.35000000000001%" headers="mcps1.3.6.2.3.1.2 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p152565012338">(Optional) Query parameter. Ensure that a question mark (?) is included in front of each query parameter, which is in the format of <em id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_i192083518498">Parameter name</em><strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b10204357495">=</strong><em id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_i1720183511491">Parameter value</em>. For example, <strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b520153544918">?limit=10</strong> indicates that a maximum of 10 data records can be queried.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="note" id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_note11464132214811"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p1946572219817">To simplify the URI display, this document provides only the <strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b122111814175412">resource-path</strong> and request method in the URI of each API. The <strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b0522219163913">URI-scheme</strong> of all APIs is <strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b18522219143910">https</strong>, and the endpoints in a region are the same.</p>
</div></div>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p1313152617291"><strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b613112642912">Request Methods</strong></p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p613113263299">The HTTP protocol defines the following request methods for sending requests to a server.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_table5981026192920" frame="border" border="1" rules="all"><caption><b>Table 2 </b>HTTP methods</caption><thead align="left"><tr id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_row16131526102914"><th align="left" class="cellrowborder" valign="top" width="30%" id="mcps1.3.10.2.3.1.1"><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p1131326112917">Method</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="70%" id="mcps1.3.10.2.3.1.2"><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p13131112682911">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_row17131122617293"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.10.2.3.1.1 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p141318263293">GET</p>
</td>
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.10.2.3.1.2 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p9131326122915">Requests a server to return specified resources.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_row3131926162916"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.10.2.3.1.1 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p2131132620291">PUT</p>
</td>
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.10.2.3.1.2 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p113182662916">Requests a server to update specified resources.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_row41311526192917"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.10.2.3.1.1 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p21311265298">POST</p>
</td>
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.10.2.3.1.2 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p19131152616295">Requests a server to add resources or perform special operations.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_row21311526192915"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.10.2.3.1.1 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p1213142613298">DELETE</p>
</td>
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.10.2.3.1.2 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p1013182622917">Requests a server to delete a specified resource (for example, an object).</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_row18131126182916"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.10.2.3.1.1 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p17131162612911">HEAD</p>
</td>
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.10.2.3.1.2 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p513116261297">Requests resource headers from a server.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_row101311326142920"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.10.2.3.1.1 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p3131182672913">PATCH</p>
</td>
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.10.2.3.1.2 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p1313111263292">Requests a server to update part of specified resources.</p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p31311326182915">If the requested resource does not exist, the server may create a resource using the PATCH method.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="p" id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p14131152618291">For example, in the URI used to obtain a user token, the request method is POST. The request is as follows:<pre class="screen" id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_screen1514113317356">POST https://iam.eu-de.otc.t-systems.com/v3/auth/tokens</pre>
</div>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p813112262290"><strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b3131192613299">Request Header</strong></p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p513172672912">You can add additional fields, such as the fields required by a specified URI or HTTP method, to a request header. For example, to request authentication information, you can add <strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b1457352710227">Content-Type</strong> to specify the type of the request body.</p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p1413152652910">For details about common request headers, see <a href="#EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_table1510219261292">Table 3</a>.</p>
<div class="tablenoborder"><a name="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_table1510219261292"></a><a name="en-us_topic_0000001594352973_table1510219261292"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_table1510219261292" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Common fields in request headers</caption><thead align="left"><tr id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_row18132142662918"><th align="left" class="cellrowborder" valign="top" width="19.74%" id="mcps1.3.15.2.5.1.1"><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p613212262298">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="26.5%" id="mcps1.3.15.2.5.1.2"><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p19132192620298">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20.11%" id="mcps1.3.15.2.5.1.3"><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p11321826102910">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.650000000000006%" id="mcps1.3.15.2.5.1.4"><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p51329260299">Example</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_row19132142682915"><td class="cellrowborder" valign="top" width="19.74%" headers="mcps1.3.15.2.5.1.1 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p013212614295">Host</p>
</td>
<td class="cellrowborder" valign="top" width="26.5%" headers="mcps1.3.15.2.5.1.2 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p413282662913">Specifies the server to which a request is sent, which can be obtained from the URL of the service API. The value is in the format of <em id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_i2704047113310">Host name:Port number</em>. If the port number is not specified, the default port is used. The default port number for <strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b15395162510341">https</strong> is <strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b7395162518349">443</strong>.</p>
</td>
<td class="cellrowborder" valign="top" width="20.11%" headers="mcps1.3.15.2.5.1.3 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p1132826202916">No</p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p1313211265292">This field is mandatory for access key (AK)/secret access key (SK) authentication.</p>
</td>
<td class="cellrowborder" valign="top" width="33.650000000000006%" headers="mcps1.3.15.2.5.1.4 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p3132126132911">code.test.com</p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p1213252642916">or</p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p3132102602913">code.test.com:443</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_row31321526102917"><td class="cellrowborder" valign="top" width="19.74%" headers="mcps1.3.15.2.5.1.1 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p1013272616291">Content-Type</p>
</td>
<td class="cellrowborder" valign="top" width="26.5%" headers="mcps1.3.15.2.5.1.2 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p1013252616290">Specifies the type (or format) of a message body. The default value <em id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_i1588816501510">application/json</em> is recommended. Other values will be described in the specific APIs.</p>
</td>
<td class="cellrowborder" valign="top" width="20.11%" headers="mcps1.3.15.2.5.1.3 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p8132126192915">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="33.650000000000006%" headers="mcps1.3.15.2.5.1.4 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p213232632912">application/json</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_row41323268292"><td class="cellrowborder" valign="top" width="19.74%" headers="mcps1.3.15.2.5.1.1 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p10132126162911">Content-Length</p>
</td>
<td class="cellrowborder" valign="top" width="26.5%" headers="mcps1.3.15.2.5.1.2 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p1413222613291">Specifies the length of a request body, in bytes.</p>
</td>
<td class="cellrowborder" valign="top" width="20.11%" headers="mcps1.3.15.2.5.1.3 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p131321926152914">No</p>
</td>
<td class="cellrowborder" valign="top" width="33.650000000000006%" headers="mcps1.3.15.2.5.1.4 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p12133926192920">3495</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_row91331826192920"><td class="cellrowborder" valign="top" width="19.74%" headers="mcps1.3.15.2.5.1.1 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p01338262298">X-Project-Id</p>
</td>
<td class="cellrowborder" valign="top" width="26.5%" headers="mcps1.3.15.2.5.1.2 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p713362662915">Specifies a project ID. You can obtain the project ID by referring to <a href="vpn_api_0051.html#EN-US_TOPIC_0000001807530332">Obtaining the Project ID</a>.</p>
</td>
<td class="cellrowborder" valign="top" width="20.11%" headers="mcps1.3.15.2.5.1.3 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p14133826152917">No</p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p2133226162911">This field is mandatory for requests that use AK/SK authentication in the Dedicated Cloud (DeC) scenario or multi-project scenario.</p>
</td>
<td class="cellrowborder" valign="top" width="33.650000000000006%" headers="mcps1.3.15.2.5.1.4 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p1013311264292">e9993fc7************baa340f9c0f4</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_row6133192614294"><td class="cellrowborder" valign="top" width="19.74%" headers="mcps1.3.15.2.5.1.1 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p13133142618299">X-Auth-Token</p>
</td>
<td class="cellrowborder" valign="top" width="26.5%" headers="mcps1.3.15.2.5.1.2 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p91331326182913">Specifies a user token.</p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p121331426182916">A user token is carried in a response to the API for obtaining a user token. This API is the only one that does not require authentication.</p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p0133112652913">The value of <strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b142065810813">X-Subject-Token</strong> in the response header is the token.</p>
</td>
<td class="cellrowborder" valign="top" width="20.11%" headers="mcps1.3.15.2.5.1.3 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p12133162672911">No</p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p1113318268295">This field is mandatory for token authentication.</p>
</td>
<td class="cellrowborder" valign="top" width="33.650000000000006%" headers="mcps1.3.15.2.5.1.4 "><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p81332265291">The following is part of an example token:</p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p10133826122918">MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="note" id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_note5192144574315"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p613320268299">APIs also support AK/SK authentication, which uses SDKs to sign a request. During the signature, the <strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b1197310562914">Authorization</strong> (signature authentication) and <strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b189733561095">X-Sdk-Date</strong> (time when a request is sent) headers are automatically added to the request.</p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p719235154312">For details about AK/SK authentication, see <a href="vpn_api_0010.html#EN-US_TOPIC_0000001854169129">Authentication</a>.</p>
</div></div>
<div class="p" id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p13133126172914">The API for obtaining a user token does not require authentication. As such, only the <strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b19107112215912">Content-Type</strong> field needs to be added to the requests for calling this API. An example of such requests is as follows:<pre class="screen" id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_screen612110254390">POST https://iam.eu-de.otc.t-systems.com/v3/auth/tokensContent-Type:application/json</pre>
</div>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p1913362615294"><strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b313302614296">Request Body</strong></p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p171331026152918">This part is optional. A request body is generally sent in a structured format (for example, JSON or XML), which is specified by <strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b272411172915">Content-Type</strong> in the request header. It is used to transfer content other than the request header. If the request body contains full-width characters, these characters must be coded in UTF-8.</p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p12133142632917">Request bodies vary according to APIs. Some APIs do not require a request body, such as the APIs called using the GET and DELETE methods.</p>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p16133162617298">For the API used to obtain a user token, you can obtain the request parameters and parameter description from the API request. The following provides an example request with a body included. Replace <em id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_i1923978115817"><strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b12239178195816">username</strong></em>, <em id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_i92393835813"><strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b102391887580">domainname</strong></em>, <em id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_i162400819583"><strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b172404814582">********</strong></em> (login password), and <em id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_i162400815817"><strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b1424068185810">xxxxxxxxxxxxxxxxxx</strong></em> (project name, for example, <strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b840413429584">eu-de-01</strong>) with the actual values.</p>
<div class="note" id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_note5309165744716"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p13145108134814">The <strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b1536204163518">scope</strong> field specifies where a token takes effect. In the following example, the token takes effect only for the resources in a specified project. </p>
</div></div>
<div class="codecoloring" codetype="Json" id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_screen20719331058"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
<span class="normal"> 2</span>
<span class="normal"> 3</span>
<span class="normal"> 4</span>
<span class="normal"> 5</span>
<span class="normal"> 6</span>
<span class="normal"> 7</span>
<span class="normal"> 8</span>
<span class="normal"> 9</span>
<span class="normal">10</span>
<span class="normal">11</span>
<span class="normal">12</span>
<span class="normal">13</span>
<span class="normal">14</span>
<span class="normal">15</span>
<span class="normal">16</span>
<span class="normal">17</span>
<span class="normal">18</span>
<span class="normal">19</span>
<span class="normal">20</span>
<span class="normal">21</span>
<span class="normal">22</span>
<span class="normal">23</span>
<span class="normal">24</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">POST</span><span class="w"> </span><span class="err">h</span><span class="kc">tt</span><span class="err">ps</span><span class="p">:</span><span class="c1">//iam.eu-de.otc.t-systems.com/v3/auth/tokensContent-Type:application/json</span>
<span class="p">{</span>
<span class="w"> </span><span class="nt">&quot;auth&quot;</span><span class="p">:{</span>
<span class="w"> </span><span class="nt">&quot;identity&quot;</span><span class="p">:{</span>
<span class="w"> </span><span class="nt">&quot;methods&quot;</span><span class="p">:[</span>
<span class="w"> </span><span class="s2">&quot;password&quot;</span>
<span class="w"> </span><span class="p">],</span>
<span class="w"> </span><span class="nt">&quot;password&quot;</span><span class="p">:{</span>
<span class="w"> </span><span class="nt">&quot;user&quot;</span><span class="p">:{</span>
<span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="s2">&quot;username&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="nt">&quot;password&quot;</span><span class="p">:</span><span class="s2">&quot;********&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="nt">&quot;domain&quot;</span><span class="p">:{</span>
<span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="s2">&quot;domainname&quot;</span>
<span class="w"> </span><span class="p">}</span>
<span class="w"> </span><span class="p">}</span>
<span class="w"> </span><span class="p">}</span>
<span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nt">&quot;scope&quot;</span><span class="p">:{</span>
<span class="w"> </span><span class="nt">&quot;project&quot;</span><span class="p">:{</span>
<span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="s2">&quot;xxxxxxxxxxxxxxxxxx&quot;</span>
<span class="w"> </span><span class="p">}</span>
<span class="w"> </span><span class="p">}</span>
<span class="w"> </span><span class="p">}</span>
<span class="p">}</span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_p513412265296">If all data required by an API request is available, you can send the request to call the API through <a href="https://curl.haxx.se/" target="_blank" rel="noopener noreferrer">curl</a>, <a href="https://www.getpostman.com/" target="_blank" rel="noopener noreferrer">Postman</a>, or coding. In the response to the API for obtaining a user token, <strong id="EN-US_TOPIC_0000001807370452__en-us_topic_0000001594352973_b37316471402">x-subject-token</strong> carries a user token. You can use this token to authenticate the calling of other APIs.</p>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="vpn_api_0008.html">Calling APIs</a></div>
</div>
</div>