doc-exports/docs/dns/api-ref/dns_api_80007.html
Qin Ying, Fan cf1007c84e DNS API 20240223 version
Reviewed-by: Hajba, László Antal <laszlo-antal.hajba@t-systems.com>
Co-authored-by: Qin Ying, Fan <fanqinying@huawei.com>
Co-committed-by: Qin Ying, Fan <fanqinying@huawei.com>
2024-05-16 13:48:49 +00:00

47 lines
4.4 KiB
HTML

<a name="dns_api_80007"></a><a name="dns_api_80007"></a>
<h1 class="topictitle1">Obtaining a Project ID</h1>
<div id="body8662426"><div class="section" id="dns_api_80007__en-us_topic_0121673684_section1876711368114"><h4 class="sectiontitle">Scenarios</h4><p id="dns_api_80007__en-us_topic_0121673684_p177063681115">A project ID is required for some URLs when an API is called. Therefore, you need to obtain a project ID in advance. Two methods are available:</p>
<ul id="dns_api_80007__en-us_topic_0121673684_ul2770123611111"><li id="dns_api_80007__en-us_topic_0121673684_li157701436141116"><a href="#dns_api_80007__en-us_topic_0121673684_section86806471133">Obtain the Project ID by Calling an API</a></li><li id="dns_api_80007__en-us_topic_0121673684_li07701836121118"><a href="#dns_api_80007__en-us_topic_0121673684_section32975495318">Obtain the Project ID from the Console</a></li></ul>
</div>
<div class="section" id="dns_api_80007__en-us_topic_0121673684_section86806471133"><a name="dns_api_80007__en-us_topic_0121673684_section86806471133"></a><a name="en-us_topic_0121673684_section86806471133"></a><h4 class="sectiontitle">Obtain the Project ID by Calling an API</h4><p id="dns_api_80007__en-us_topic_0121673684_p31183326524">You can obtain the project ID by calling the IAM API used to query project information based on the specified criteria.</p>
<p id="dns_api_80007__en-us_topic_0121673684_p857314915139">The API used to obtain a project ID is GET https://{Endpoint}/v3/projects. {Endpoint} is the IAM endpoint and can be obtained from <a href="https://docs.otc.t-systems.com/additional/endpoints.html" target="_blank" rel="noopener noreferrer">Regions and Endpoints</a>. </p>
<p id="dns_api_80007__en-us_topic_0121673684_p3770181514218">The following is an example response. The value of <strong id="dns_api_80007__en-us_topic_0121673684_b842352706123544">id</strong> is the project ID.</p>
<pre class="screen" id="dns_api_80007__en-us_topic_0121673684_screen14199113161316">{
"projects": [
{
"domain_id": "65ewtrgaggshhk1223245sghjlse684b",
"is_domain": false,
"parent_id": "65ewtrgaggshhk1223245sghjlse684b",
"name": "project_name",
"description": "",
"links": {
"next": null,
"previous": null,
"self": "https://www.example.com/v3/projects/a4adasfjljaaaakla12334jklga9sasfg"
},
"id": "a4adasfjljaaaakla12334jklga9sasfg",
"enabled": true
}
],
"links": {
"next": null,
"previous": null,
"self": "https://www.example.com/v3/projects"
}
}</pre>
</div>
<div class="section" id="dns_api_80007__en-us_topic_0121673684_section32975495318"><a name="dns_api_80007__en-us_topic_0121673684_section32975495318"></a><a name="en-us_topic_0121673684_section32975495318"></a><h4 class="sectiontitle">Obtain a Project ID from the Console</h4><div class="p" id="dns_api_80007__en-us_topic_0121673684_p1356864351018">A project ID needs to be specified in the URIs of some APIs. Therefore, you need to obtain the project ID before calling APIs. The following procedure describes how to obtain a project ID:<ol id="dns_api_80007__en-us_topic_0121673684_ol7453556171010"><li id="dns_api_80007__en-us_topic_0121673684_li645315621018">Log in to the management console.</li><li id="dns_api_80007__en-us_topic_0121673684_li142001547118">Click the username and select <strong id="dns_api_80007__en-us_topic_0121673684_b10350181718117">My Credentials</strong> from the drop-down list.<p id="dns_api_80007__en-us_topic_0121673684_p13639183110119">On the <strong id="dns_api_80007__en-us_topic_0121673684_b19682129101113">My Credentials</strong> page, view project IDs in the project list.</p>
<div class="fignone" id="dns_api_80007__en-us_topic_0121673684_fig12841949131317"><span class="figcap"><b>Figure 1 </b>Viewing project IDs</span><br><span><img id="dns_api_80007__en-us_topic_0121673684_image1184449141315" src="en-us_image_0000001508295281.png"></span></div>
<p id="dns_api_80007__en-us_topic_0121673684_p55531521415">In multi-project scenarios, expand the region, and obtain your sub-project ID from the <strong id="dns_api_80007__en-us_topic_0121673684_b314916613146">Project ID</strong> column.</p>
</li></ol>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dns_api_80000.html">Appendix</a></div>
</div>
</div>