Files
doc-exports/docs/ims/dev/en-us_topic_0109822403.html
guoyanyan b3547b53d8 ims_dev_1109
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: guoyanyan <guoyanyan3@huawei.com>
Co-committed-by: guoyanyan <guoyanyan3@huawei.com>
2022-11-16 09:00:55 +00:00

30 lines
5.2 KiB
HTML

<a name="EN-US_TOPIC_0109822403"></a><a name="EN-US_TOPIC_0109822403"></a>
<h1 class="topictitle1">Querying an Images List</h1>
<div id="body44121179"><div class="section" id="EN-US_TOPIC_0109822403__section5997995"><h4 class="sectiontitle">Scenario</h4><p id="EN-US_TOPIC_0109822403__p3484145322518">Images can be created using search criteria.</p>
<div class="note" id="EN-US_TOPIC_0109822403__note44222521746"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0109822403__ul106941553121512"><li id="EN-US_TOPIC_0109822403__li33716531">You can type question marks (?) and ampersands (&amp;) at the end of the URI to define multiple search criteria. For details, see the example request.</li><li id="EN-US_TOPIC_0109822403__li9147183901514">The token obtained from Identity and Access Management (IAM) is valid for only 24 hours. If you want to use a token for authentication, you can cache it to avoid frequently calling the IAM API.</li></ul>
</div></div>
</div>
<div class="section" id="EN-US_TOPIC_0109822403__section16075620"><h4 class="sectiontitle">Involved APIs</h4><p class="litext" id="EN-US_TOPIC_0109822403__p616415594193">If you use a token for authentication, you must obtain the token and add <strong id="EN-US_TOPIC_0109822403__en-us_topic_0109822381_b842352706134841">X-Auth-Token</strong> to the request header of the IMS API when making an API call.</p>
<ul id="EN-US_TOPIC_0109822403__ul1840113419200"><li id="EN-US_TOPIC_0109822403__li6754315">IAM API used to obtain the token<p id="EN-US_TOPIC_0109822403__en-us_topic_0109822381_p1833933634"><a name="EN-US_TOPIC_0109822403__li6754315"></a><a name="li6754315"></a>URI format: POST https://<em id="EN-US_TOPIC_0109822403__en-us_topic_0109822381_i15500165112426">IAM endpoint</em>/v3/auth/tokens</p>
</li><li id="EN-US_TOPIC_0109822403__li40994058">IMS API used to query the image list<p id="EN-US_TOPIC_0109822403__p62932010202910"><a name="EN-US_TOPIC_0109822403__li40994058"></a><a name="li40994058"></a>URI format: GET https://<em id="EN-US_TOPIC_0109822403__i161571852155419">IMS endpoint</em>/v2/cloudimages</p>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0109822403__section10462857"><h4 class="sectiontitle">Procedure</h4><ol id="EN-US_TOPIC_0109822403__ol134841326152613"><li id="EN-US_TOPIC_0109822403__li1837051910476">Obtain the token.</li><li class="msonormal" id="EN-US_TOPIC_0109822403__li7546155813263">Send <strong id="EN-US_TOPIC_0109822403__b777533114554">GET https://</strong><em id="EN-US_TOPIC_0109822403__i276717276557">IMS endpoint</em><strong id="EN-US_TOPIC_0109822403__b53941435145516">/v2/cloudimages</strong>.</li><li class="msonormal" id="EN-US_TOPIC_0109822403__li2546758122614">Add <strong id="EN-US_TOPIC_0109822403__b84235270615255">X-Auth-Token</strong> to the request header.</li><li class="msonormal" id="EN-US_TOPIC_0109822403__li15546135822613">Type question marks (?) and ampersands (&amp;) at the end of the URI to define multiple search criteria, for example, https://<em id="EN-US_TOPIC_0109822403__i795621835712">IMS endpoint</em>/v2/cloudimages?__imagetype=gold&amp;sort_key=name&amp;limit=1.</li><li class="msonormal" id="EN-US_TOPIC_0109822403__li95461583263">Refer to "Querying Images" in the <strong id="EN-US_TOPIC_0109822403__b1788838614183927">Image Management Service API Reference</strong> for parameter descriptions and response details.<p id="EN-US_TOPIC_0109822403__p127871624103016">For details about status codes for request errors, see <a href="en-us_topic_0124290300.html">Status Codes</a>.</p>
</li></ol>
</div>
<div class="section" id="EN-US_TOPIC_0109822403__section33791047111111"><h4 class="sectiontitle">Common Query Methods</h4><ul id="EN-US_TOPIC_0109822403__ul1643114418195"><li id="EN-US_TOPIC_0109822403__li18431204121918">Public images<p id="EN-US_TOPIC_0109822403__p9431134161911"><a name="EN-US_TOPIC_0109822403__li18431204121918"></a><a name="li18431204121918"></a>GET /v2/images?__imagetype=gold&amp;visibility=public&amp;protected=true</p>
</li><li id="EN-US_TOPIC_0109822403__li1143117421919">Private images<p id="EN-US_TOPIC_0109822403__p543113410193"><a name="EN-US_TOPIC_0109822403__li1143117421919"></a><a name="li1143117421919"></a>GET /v2/images?owner={project_id}</p>
</li><li id="EN-US_TOPIC_0109822403__li194316413195">Available shared images<p id="EN-US_TOPIC_0109822403__p18431445195"><a name="EN-US_TOPIC_0109822403__li194316413195"></a><a name="li194316413195"></a>GET /v2/images?member_status=accepted&amp;visibility=shared&amp;__imagetype=shared</p>
</li><li id="EN-US_TOPIC_0109822403__li174314491910">Rejected images<p id="EN-US_TOPIC_0109822403__p74311547198"><a name="EN-US_TOPIC_0109822403__li174314491910"></a><a name="li174314491910"></a>GET /v2/images?member_status=rejected&amp;visibility=shared&amp;__imagetype=shared</p>
</li><li id="EN-US_TOPIC_0109822403__li743194191913">Unaccepted images<p id="EN-US_TOPIC_0109822403__p19431245196"><a name="EN-US_TOPIC_0109822403__li743194191913"></a><a name="li743194191913"></a>GET /v2/images?member_status=pending&amp;visibility=shared&amp;__imagetype=shared</p>
</li></ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0219492328.html">Common Scenarios</a></div>
</div>
</div>