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>
217 lines
25 KiB
HTML
217 lines
25 KiB
HTML
<a name="EN-US_TOPIC_0000001185673174"></a><a name="EN-US_TOPIC_0000001185673174"></a>
|
|
|
|
<h1 class="topictitle1">Making an API Request</h1>
|
|
<div id="body8662426"><p id="EN-US_TOPIC_0000001185673174__ac0b9367da063411caeb797391c021cdd">This section describes the structure of a REST API request, and describes how to call an API by obtaining a user token of the IAM service. The obtained token can then be used to authenticate the calling of other APIs.</p>
|
|
<div class="section" id="EN-US_TOPIC_0000001185673174__s4575482b25134dc1a9ca4df2c5d72c6b"><h4 class="sectiontitle">Request URI</h4><p id="EN-US_TOPIC_0000001185673174__af766cf5d49134c2aa1762e5cdeaba2a8">A request URI is in the following format:</p>
|
|
<p id="EN-US_TOPIC_0000001185673174__a20152f37743741c68faf1c89c6ff4d56"><strong id="EN-US_TOPIC_0000001185673174__en-us_topic_0171007788_en-us_topic_0121682347_en-us_topic_0113746487_b11186155382110">{URI-scheme}://{Endpoint}/{resource-path}?{query-string}</strong></p>
|
|
<p id="EN-US_TOPIC_0000001185673174__ab1c0a5c7cbff4193a5beeb9830ddce59">Although a request URI is included in the request header, most programming languages or frameworks require the request URI to be transmitted separately.</p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001185673174__t9af702b84a01463ba146da3540ec906f" frame="border" border="1" rules="all"><caption><b>Table 1 </b>URI parameter description</caption><thead align="left"><tr id="EN-US_TOPIC_0000001185673174__rdd5de970ddaf422083d586ecf42c0a9f"><th align="left" class="cellrowborder" valign="top" width="24.23%" id="mcps1.3.2.5.2.3.1.1"><p id="EN-US_TOPIC_0000001185673174__a19434eb2026742318d4d54bed50f9db8"><strong id="EN-US_TOPIC_0000001185673174__en-us_topic_0171007788_en-us_topic_0121682347_b23574928194256">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="75.77000000000001%" id="mcps1.3.2.5.2.3.1.2"><p id="EN-US_TOPIC_0000001185673174__aa99811d9a1354ffc90c399d3effe35f0"><strong id="EN-US_TOPIC_0000001185673174__en-us_topic_0171007788_en-us_topic_0121682347_en-us_topic_0113746487_b131565362615">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001185673174__r94b0864962c4486196d8896727b693f6"><td class="cellrowborder" valign="top" width="24.23%" headers="mcps1.3.2.5.2.3.1.1 "><p id="EN-US_TOPIC_0000001185673174__a2c7b5dd5b6924ceba3e67e0f162d9710">URI-scheme</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.77000000000001%" headers="mcps1.3.2.5.2.3.1.2 "><p id="EN-US_TOPIC_0000001185673174__a65fd32c6193a4d35a9e2ebd91dbc4476">Protocol used to transmit requests. All APIs use HTTPS.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001185673174__r8b17dfd690b64ff09a322e290bc49929"><td class="cellrowborder" valign="top" width="24.23%" headers="mcps1.3.2.5.2.3.1.1 "><p id="EN-US_TOPIC_0000001185673174__a192d0d49499b42dea9fcb9823bdcd208">Endpoint</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.77000000000001%" headers="mcps1.3.2.5.2.3.1.2 "><p id="EN-US_TOPIC_0000001185673174__p14221174382419">Domain name or IP address of the server bearing the REST service. The endpoint varies between services in different regions. It can be obtained from the "Regions and Endpoints" section.</p>
|
|
<p id="EN-US_TOPIC_0000001185673174__p15129619134716">For example, the endpoint of IAM in the <span class="parmname" id="EN-US_TOPIC_0000001185673174__parmname51291019104710"><b>eu-de</b></span> region is <span class="parmname" id="EN-US_TOPIC_0000001185673174__parmname144291017134818"><b>iam.eu-de.otc.t-systems.com</b></span>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001185673174__r2caabf3ab8f14411a6f80aa41240506a"><td class="cellrowborder" valign="top" width="24.23%" headers="mcps1.3.2.5.2.3.1.1 "><p id="EN-US_TOPIC_0000001185673174__a8b74dc44c0004466a75be092ed7e75fe">resource-path</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.77000000000001%" headers="mcps1.3.2.5.2.3.1.2 "><p id="EN-US_TOPIC_0000001185673174__a36c7839ff46e415ab57937cb8f804f52">Access path of an API for performing a specified operation. Obtain the path from the URI of an API. For example, the <strong id="EN-US_TOPIC_0000001185673174__b157741351114811">resource-path</strong> of the API used to obtain a user token is <strong id="EN-US_TOPIC_0000001185673174__b834310174917">/v3/auth/tokens</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001185673174__r336a33aad869453ea3919c876cf81c96"><td class="cellrowborder" valign="top" width="24.23%" headers="mcps1.3.2.5.2.3.1.1 "><p id="EN-US_TOPIC_0000001185673174__a0b78a40936c34cef85fc5803efa2cfa3">query-string</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.77000000000001%" headers="mcps1.3.2.5.2.3.1.2 "><p id="EN-US_TOPIC_0000001185673174__a76f53170251e4801a68c3596f892a7e9">Query parameter, which is optional. Ensure that a question mark (?) is included before each query parameter that is in the format of "<em id="EN-US_TOPIC_0000001185673174__i1380165245018">Parameter name=Parameter value</em>". For example, <span class="parmname" id="EN-US_TOPIC_0000001185673174__en-us_topic_0171007788_en-us_topic_0121682347_parmname250193215285"><b>?limit=10</b></span> indicates that a maximum of 10 data records will be displayed.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="note" id="EN-US_TOPIC_0000001185673174__nc562c1d3e5844b2ca08e95c5d047f130"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001185673174__ada8615b9cf1e4402a26a761e92759548">To simplify the URI display in this document, each API is provided only with a <strong id="EN-US_TOPIC_0000001185673174__b1216343116919">resource-path</strong> and a request method. The <strong id="EN-US_TOPIC_0000001185673174__b56987498210">URI-scheme</strong> of all APIs is <strong id="EN-US_TOPIC_0000001185673174__b6561531426">HTTPS</strong>, and the endpoints of all APIs in the same region are identical.</p>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001185673174__s3a0a7d00d5e8439199eae85866dd654c"><h4 class="sectiontitle">Request Methods</h4><div class="p" id="EN-US_TOPIC_0000001185673174__aecd3f42e72a84e4abe4b46bb918ab7d5">The HTTP protocol defines the following request methods that can be used to send a request to the server:
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001185673174__t3b46425c8c014a76abc28553bfc6a93e" frame="border" border="1" rules="all"><caption><b>Table 2 </b>HTTP methods</caption><thead align="left"><tr id="EN-US_TOPIC_0000001185673174__ra4b6b401721947ac83c014847719ae98"><th align="left" class="cellrowborder" valign="top" width="30%" id="mcps1.3.3.2.1.2.3.1.1"><p id="EN-US_TOPIC_0000001185673174__a13c783bbcf244f95b36f4004255f4050"><strong id="EN-US_TOPIC_0000001185673174__en-us_topic_0171007788_en-us_topic_0121682347_en-us_topic_0113746487_b1093312238395">Method</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="70%" id="mcps1.3.3.2.1.2.3.1.2"><p id="EN-US_TOPIC_0000001185673174__aa77de578fb984433a73cafde21ac8e94"><strong id="EN-US_TOPIC_0000001185673174__en-us_topic_0171007788_en-us_topic_0121682347_en-us_topic_0113746487_b169341023133919">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001185673174__r5d72afeaf52f444dae3326ad054a169e"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.3.2.1.2.3.1.1 "><p id="EN-US_TOPIC_0000001185673174__a5a33889fc201457eaa22f9fa4948abfd">GET</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.3.2.1.2.3.1.2 "><p id="EN-US_TOPIC_0000001185673174__afb9798e36e974910a58e4a5049c6a6b1">Requests the server to return specified resources.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001185673174__rd426fa26449542379f50afbd4eb0e987"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.3.2.1.2.3.1.1 "><p id="EN-US_TOPIC_0000001185673174__a549de39865d540f1803235d64a0a3f80">PUT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.3.2.1.2.3.1.2 "><p id="EN-US_TOPIC_0000001185673174__a1b6cfa2b7fce449b89828e57f7cd0c5d">Requests the server to update specified resources.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001185673174__rc804d98a2a1a4cbcb8b8b5f4492c29b2"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.3.2.1.2.3.1.1 "><p id="EN-US_TOPIC_0000001185673174__a9c4623a2b2e249799869a1eb3fef8e92">POST</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.3.2.1.2.3.1.2 "><p id="EN-US_TOPIC_0000001185673174__a631318c44c4b45fe9ec741be77b7dd7d">Requests the server to add resources or perform special operations.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001185673174__rfba912c6cf3d49c1960df2c69a43d0d4"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.3.2.1.2.3.1.1 "><p id="EN-US_TOPIC_0000001185673174__aff1a4f3ecc4f4159aa58a57040879ccc">DELETE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.3.2.1.2.3.1.2 "><p id="EN-US_TOPIC_0000001185673174__aab3690b4ec2f49a88a0d2a20bd9fdb84">Requests the server to delete specified resources, for example, an object.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001185673174__r3cbeb0876c174c16ae79e7e837caddc8"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.3.2.1.2.3.1.1 "><p id="EN-US_TOPIC_0000001185673174__a9a2e82c5bab74f5dbe00a9aa83e0cfc3">HEAD</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.3.2.1.2.3.1.2 "><p id="EN-US_TOPIC_0000001185673174__a9ab1370359984ddb847fb4dc423edd5f">Same as GET except that the server must return only the response header.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001185673174__rb160956154f9459297563674213e9223"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.3.2.1.2.3.1.1 "><p id="EN-US_TOPIC_0000001185673174__ac45fb7aecd48481bafd0d396b2b69edb">PATCH</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.3.2.1.2.3.1.2 "><p id="EN-US_TOPIC_0000001185673174__ad57dfa15e7014613ba806e1bcb8c3d78">Requests the server to update partial content of a specified resource.</p>
|
|
<p id="EN-US_TOPIC_0000001185673174__a769d314e6f5246aaa0d1f1aa4f4d6b14">If the resource does not exist, a new resource will be created.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001185673174__a852ab3e8af574869ae7d2a332b7d397a">For example, in the case of the API used to obtain a user token, the request method is POST. The request is as follows:</p>
|
|
</div>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001185673174__screen18112519144416">POST https://iam.eu-de.otc.t-systems.com/v3/auth/tokens</pre>
|
|
<div class="section" id="EN-US_TOPIC_0000001185673174__s75225d72d09f45f89d861c32d7811ec0"><h4 class="sectiontitle">Request Header</h4><p id="EN-US_TOPIC_0000001185673174__ad62ff9702c554d4a8c4486d22eb30016">You can also add additional header fields to a request, such as the fields required by a specified URI or HTTP method. For example, to request for the authentication information, add <span class="parmname" id="EN-US_TOPIC_0000001185673174__parmname209171753121711"><b>Content-type</b></span>, which specifies the request body type.</p>
|
|
<div class="p" id="EN-US_TOPIC_0000001185673174__adb039fb8e5bc4e1ba83a30b239330a13">For details about common request headers, see <a href="#EN-US_TOPIC_0000001185673174__t771a2351c332419f86fd66136fc5ebae">Table 3</a>.
|
|
<div class="tablenoborder"><a name="EN-US_TOPIC_0000001185673174__t771a2351c332419f86fd66136fc5ebae"></a><a name="t771a2351c332419f86fd66136fc5ebae"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001185673174__t771a2351c332419f86fd66136fc5ebae" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Common request header fields</caption><thead align="left"><tr id="EN-US_TOPIC_0000001185673174__reeb6a8cd47c340f78a07a0987473c794"><th align="left" class="cellrowborder" valign="top" width="19.919999999999998%" id="mcps1.3.5.3.2.2.5.1.1"><p id="EN-US_TOPIC_0000001185673174__a06d9a5c5ce6e4f5db0eacec794ed7a94"><strong id="EN-US_TOPIC_0000001185673174__en-us_topic_0171007788_en-us_topic_0121682347_en-us_topic_0113746487_b1355613001117">Field</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="26.32%" id="mcps1.3.5.3.2.2.5.1.2"><p id="EN-US_TOPIC_0000001185673174__ab63103d7318b46cc978c5fafec0caa2b"><strong id="EN-US_TOPIC_0000001185673174__en-us_topic_0171007788_en-us_topic_0121682347_en-us_topic_0113746487_b612662015512">Description</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20.11%" id="mcps1.3.5.3.2.2.5.1.3"><p id="EN-US_TOPIC_0000001185673174__a7482594ba97d402482e54bd3eb257aba"><strong id="EN-US_TOPIC_0000001185673174__en-us_topic_0171007788_en-us_topic_0121682347_en-us_topic_0113746487_b812872012519">Mandatory</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.650000000000006%" id="mcps1.3.5.3.2.2.5.1.4"><p id="EN-US_TOPIC_0000001185673174__ac5f53f4836c94f198bc1f7fe9cff9e3f"><strong id="EN-US_TOPIC_0000001185673174__en-us_topic_0171007788_en-us_topic_0121682347_en-us_topic_0113746487_b812932085119">Example</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001185673174__row821411541852"><td class="cellrowborder" valign="top" width="19.919999999999998%" headers="mcps1.3.5.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001185673174__p15264191183511">x-sdk-date</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="26.32%" headers="mcps1.3.5.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001185673174__p1926814111357">Time when the request is sent. The time is in <strong id="EN-US_TOPIC_0000001185673174__b1911116118">YYYYMMDD'T'HHMMSS'Z'</strong> format.</p>
|
|
<p id="EN-US_TOPIC_0000001185673174__p13270111103511">The value is the current GMT time of the system.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.11%" headers="mcps1.3.5.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001185673174__p202731111356">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.650000000000006%" headers="mcps1.3.5.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001185673174__p1427891113519">20150907T101459Z</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001185673174__r60283d3ae6324d20aeeca7244f54fc1a"><td class="cellrowborder" valign="top" width="19.919999999999998%" headers="mcps1.3.5.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001185673174__ae76bbd2a0d5f4da79a59c1c0ce442d9a">Host</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="26.32%" headers="mcps1.3.5.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001185673174__acfbd3a68ec11477c8ef77e5ffe56af63">Server information of the resource being requested. The value can be obtained from the URL of the service API. The value is in the format of <em id="EN-US_TOPIC_0000001185673174__en-us_topic_0171007788_en-us_topic_0121682347_i1012185414574">hostname[:port]</em>. If the port number is not specified, the default port is used. The default port number for HTTPS is <strong id="EN-US_TOPIC_0000001185673174__b1343812411410">443</strong>.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.11%" headers="mcps1.3.5.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001185673174__abbc3ebe9801c498b89eab681a68e31b2">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.650000000000006%" headers="mcps1.3.5.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001185673174__af02c5bd8acb541ca8faf67b77d8fc72f">code.test.com</p>
|
|
<p id="EN-US_TOPIC_0000001185673174__ab698f3e144454eecb214dbaa2c464fca">or</p>
|
|
<p id="EN-US_TOPIC_0000001185673174__a99cd85092e1b416a9833278da6f45829">code.test.com:443</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001185673174__rff1af139e623489680969182058cbd05"><td class="cellrowborder" valign="top" width="19.919999999999998%" headers="mcps1.3.5.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001185673174__a0446ea7b4a274a78973f56b75331c7a2">Content-Type</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="26.32%" headers="mcps1.3.5.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001185673174__a52955e1269db44c88597727f5bf0cc66">Request body MIME type. You are advised to use the default value <strong id="EN-US_TOPIC_0000001185673174__en-us_topic_0171007788_en-us_topic_0121682347_b842352706171425">application/json</strong>. For APIs used to upload objects or images, the value can vary depending on the flow type.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.11%" headers="mcps1.3.5.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001185673174__ac6dd0ac422524cba890678a68a974502">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.650000000000006%" headers="mcps1.3.5.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001185673174__a8762b993085a4846a14b0a23beef9d56">application/json</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001185673174__r6d866bd825814835a0df92089f7de129"><td class="cellrowborder" valign="top" width="19.919999999999998%" headers="mcps1.3.5.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001185673174__a413501a215ee4fed86fd86122c0c6e76">Content-Length</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="26.32%" headers="mcps1.3.5.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001185673174__a342281e3ab564717be7f29c8ed2cd27a">Length of the request body. The unit is byte.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.11%" headers="mcps1.3.5.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001185673174__a8f04ddb604594b4fbae6d12d3a832103">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.650000000000006%" headers="mcps1.3.5.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001185673174__ac4e7b16cdf4049c8ac5b06e3f59238d5">3495</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001185673174__rd3bc126a39e74f27bdc2e0e727f80d2f"><td class="cellrowborder" valign="top" width="19.919999999999998%" headers="mcps1.3.5.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001185673174__a7a03215d37fb4f0baae370bb2cb0ea6e">X-Project-id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="26.32%" headers="mcps1.3.5.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001185673174__a528f08291c6b4e3686d48a2856da7b73">Project ID. Obtain the project ID by following the instructions in <a href="dws_02_0011.html">Obtaining a Project ID</a>.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.11%" headers="mcps1.3.5.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001185673174__a6d829e06fbbd4ce1ae6c51a1c1d41867">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.650000000000006%" headers="mcps1.3.5.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001185673174__af4093f13647e48dd825ee1dcedf8e712">e9993fc787d94b6c886cbaa340f9c0f4</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001185673174__rf847a34e730941ef8f697125929b09db"><td class="cellrowborder" valign="top" width="19.919999999999998%" headers="mcps1.3.5.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001185673174__a3d04975a13644cc3835330fcba01536f">X-Auth-Token</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="26.32%" headers="mcps1.3.5.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001185673174__a0da9174621ea49cf917f7bf74a6c0644">User token.</p>
|
|
<p id="EN-US_TOPIC_0000001185673174__a959a7cab645f49c5b2c34d33def8da8b">The user token is a response to the API used to obtain a user token. This API is the only one that does not require authentication.</p>
|
|
<p id="EN-US_TOPIC_0000001185673174__af7baeb8f219d40da93ef8d0b656af2d6">The <strong id="EN-US_TOPIC_0000001185673174__b232885320109">X-Subject-Token</strong> value contained in the returned message header is the token.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.11%" headers="mcps1.3.5.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001185673174__a3112971a0bae42669e1bef17cb2be9f6">No</p>
|
|
<p id="EN-US_TOPIC_0000001185673174__ae1555c70e41a4acba5dc0d84598b633b">This parameter is mandatory for token-based authentication.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.650000000000006%" headers="mcps1.3.5.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001185673174__aee2de5289e004da3b4f29349c6958b7f">The following is part of an example token:</p>
|
|
<p id="EN-US_TOPIC_0000001185673174__a690dd9d15fab4d3caf3e920d67f27b92">MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001185673174__row87451312414"><td class="cellrowborder" valign="top" width="19.919999999999998%" headers="mcps1.3.5.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001185673174__p5388211133515">X-Language</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="26.32%" headers="mcps1.3.5.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001185673174__p16391101119350">Request language.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.11%" headers="mcps1.3.5.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001185673174__p539461143514">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.650000000000006%" headers="mcps1.3.5.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001185673174__p439731173518">en_us</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001185673174__a7ce99c8135d542989f3542afb96dd667">The API used to obtain a user token does not require authentication. Therefore, only the <strong id="EN-US_TOPIC_0000001185673174__b82371683910">Content-type</strong> field needs to be added to requests for calling the API. An example of such requests is as follows:</p>
|
|
</div>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001185673174__screen1661199175017">POST https://iam.eu-de.otc.t-systems.com/v3/auth/tokens
|
|
Content-type: application/json</pre>
|
|
<div class="section" id="EN-US_TOPIC_0000001185673174__s21ef4bef3df240f894aa42ca2d98b09d"><h4 class="sectiontitle">Request Body</h4><p id="EN-US_TOPIC_0000001185673174__a3bf1f51bf4824445bf1c20e429a46bf9">The body of a request is often sent in a structured format (JSON or XML) as specified in the <strong id="EN-US_TOPIC_0000001185673174__b632016401402">Content-type</strong> header field. The request body transfers content except the request header. If the request body contains Chinese characters, these characters must be coded in UTF-8.</p>
|
|
<p id="EN-US_TOPIC_0000001185673174__a50662a6ce4c846e7953ee4878b1ba180">The request body varies between APIs. Some APIs do not require the request body, such as the APIs requested using the GET and DELETE methods.</p>
|
|
<p id="EN-US_TOPIC_0000001185673174__a07dd23d016a54619aaf564145a0d5359">In the case of the API used to obtain a user token, the request parameters and parameter description can be obtained from the API request. The following provides an example request with a body included. Replace <em id="EN-US_TOPIC_0000001185673174__i197652019142215"><strong id="EN-US_TOPIC_0000001185673174__b07651719182216">user_name</strong></em>, <em id="EN-US_TOPIC_0000001185673174__i8766131962213"><strong id="EN-US_TOPIC_0000001185673174__b1276631915221">domainname</strong></em> (account name), <strong id="EN-US_TOPIC_0000001185673174__b67671319112220"><em id="EN-US_TOPIC_0000001185673174__i207661819192216">********</em></strong> (login password), and <strong id="EN-US_TOPIC_0000001185673174__b9768101918228"><em id="EN-US_TOPIC_0000001185673174__i176719198222">xxxxxxxxxxxxxxxxxx</em></strong> (project ID) with actual ones. Obtain the project ID from the database administrator.</p>
|
|
<div class="note" id="EN-US_TOPIC_0000001185673174__n63aedb76c20e4323affd745b04933f46"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001185673174__a8dac7f39ed004dada7547fcfb9a40b22">The <strong id="EN-US_TOPIC_0000001185673174__b55015220182">scope</strong> parameter specifies where a token takes effect. In the example, the token takes effect only on the resources specified by the project. In the following example, the token takes effect only for the resources in a specified project. For more information about this API, see Obtaining a User Token.</p>
|
|
</div></div>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001185673174__se0d2d43430e24faea81ddd913e36a0e5">POST https://iam.eu-de.otc.t-systems.com/v3/auth/tokens
|
|
Content-type: application/json
|
|
|
|
{
|
|
"auth": {
|
|
"identity": {
|
|
"methods": [
|
|
"password"
|
|
],
|
|
"password": {
|
|
"user": {
|
|
"name": "<em id="EN-US_TOPIC_0000001185673174__a947ddcb0a3af4c1bbe59952c3dce3aae"><strong id="EN-US_TOPIC_0000001185673174__ab9390728549046d58f0abf71820b0aa2">user_name</strong></em>",
|
|
"password": "<strong id="EN-US_TOPIC_0000001185673174__ae6a6bbef0e924a908d0989e8e324d857"><em id="EN-US_TOPIC_0000001185673174__ace154440292645b2a9e4f2bc71a87ecb">********</em></strong>",
|
|
"domain": {
|
|
"name": "<em id="EN-US_TOPIC_0000001185673174__afb31eb1106a24943adb45fab36aa01f5"><strong id="EN-US_TOPIC_0000001185673174__a77bb3bae7f3844d5a4d56f919ca1e194">domainname</strong></em>"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"scope": {
|
|
"project": {
|
|
"id": "<strong id="EN-US_TOPIC_0000001185673174__a9f27b6c79d1c4032bbcb0d9c7bf68b91"><em id="EN-US_TOPIC_0000001185673174__addc94293a7294b40bbd17d408ed794de">xxxxxxxxxxxxxxxxxx</em></strong>"
|
|
}
|
|
}
|
|
}
|
|
}</pre>
|
|
<p id="EN-US_TOPIC_0000001185673174__a36814ca50f85473cae3935be47d6dd22">If all data required for the 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 used to obtain a user token, <strong id="EN-US_TOPIC_0000001185673174__b08301128145718">x-subject-token</strong> is the desired user token. This token can then be used to authenticate the calling of other APIs.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_02_0062.html">Calling APIs</a></div>
|
|
</div>
|
|
</div>
|
|
|