<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>I wasn't reading the debug output closely enough and didn't see
      before that my keystone command generates a URL of
      ...tenants/{Name=Jet-Home} instead of the suggested one of
      ...tenants?{Name=Jet-Home}.  I also received a suggestion in
      direct email to try .../tenants?Name=Jet-Home.<br>
      <br>
      I resorted to curl to try both of those, and each one returns the
      entire list of tenants.<br>
      <br>
      I also tried putting the name in a request body (I didn't think
      you could send data in a GET request, but apparently you can, and
      it is expecting and parsing JSON):<br>
      <br>
      curl -i -X GET '<a class="moz-txt-link-freetext" href="https://proxy.nebula-dev:35357/v2.0/tenants">https://proxy.nebula-dev:35357/v2.0/tenants</a>' -d
      '{"Name":"Jet-Home"}' -H "User-Agent: python-keystoneclient" -H
      "Content-type: application/json" -H "X-Auth-Token: REDACTED"<br>
      <br>
      and that just returns the entire list of tenants also.<br>
      <br>
      (If I don't set the Content-type, I get "Expecting to find
      application/json in Content-Type header".)<br>
      <br>
      This isn't exactly a deal breaker, but the API doc does say that a
      lookup by name should work, and I'd like to know if there's a way
      to do that or whether the doc or the implementation are in error.</tt><br>
    <br>
    <div class="moz-cite-prefix">On 1/15/2015 2:41 PM, Peter Scott
      wrote:<br>
    </div>
    <blockquote cite="mid:54B84222.8010600@jpl.nasa.gov" type="cite">
      <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
      I tried this approach with the following command line:<br>
      <br>
      $ keystone --debug tenant-get '{name=Jet-Home}'<br>
      <br>
      It didn't work; it seems that it doesn't work because it doesn't
      like the proposed syntax:<br>
      <br>
      DEBUG:keystoneclient.auth.identity.v2:Making authentication
      request to <a moz-do-not-send="true"
        class="moz-txt-link-freetext"
        href="https://proxy.nebula-dev:8770/v2.0/tokens">https://proxy.nebula-dev:8770/v2.0/tokens</a><br>
      INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS
      connection (1): proxy.nebula-dev<br>
      DEBUG:requests.packages.urllib3.connectionpool:"POST /v2.0/tokens
      HTTP/1.1" 200 2966<br>
      <br>
      Looks like it generated the right call:<br>
      <br>
      DEBUG:keystoneclient.session:REQ: curl -i -X GET <a
        moz-do-not-send="true" class="moz-txt-link-freetext"
        href="https://proxy.nebula-dev:35357/v2.0/tenants/">https://proxy.nebula-dev:35357/v2.0/tenants/</a>{name=Jet-Home}
      -H "User-Agent: python-keystoneclient" -H "X-Auth-Token:
      TOKEN_REDACTED"<br>
      INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS
      connection (1): proxy.nebula-dev<br>
      DEBUG:requests.packages.urllib3.connectionpool:"GET
      /v2.0/tenants/%7Bname=Jet-Home%7D HTTP/1.1" 404 101<br>
      <br>
      But it didn't like that (404 not found):<br>
      <br>
      DEBUG:keystoneclient.session:RESP:<br>
      DEBUG:keystoneclient.session:Request returned failure status: 404<br>
      <br>
      This is where it falls back to fetching all tenants to search
      within the list  client-side:<br>
      <br>
      DEBUG:keystoneclient.session:REQ: curl -i -X GET <a
        moz-do-not-send="true" class="moz-txt-link-freetext"
        href="https://proxy.nebula-dev:35357/v2.0/tenants">https://proxy.nebula-dev:35357/v2.0/tenants</a>
      -H "User-Agent: python-keystoneclient" -H "X-Auth-Token:
      TOKEN_REDACTED"<br>
      INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS
      connection (1): proxy.nebula-dev<br>
      DEBUG:requests.packages.urllib3.connectionpool:"GET /v2.0/tenants
      HTTP/1.1" 200 963<br>
      [...]<br>
      <br>
      On 1/9/2015 <b>李旦</b> <a moz-do-not-send="true"
href="mailto:openstack%40lists.openstack.org?Subject=Re%3A%20%5BOpenstack%5D%20Get%20tenant%20by%20name&In-Reply-To=%3CA0257811F020DE4698F0891EF93864DB0132E5A1%40mbx04.360buyAD.local%3E"
        title="[Openstack] Get tenant by name">lidan17 at jd.com</a>
      wrote:<br>
      <blockquote type="cite">
        <pre>Maybe you need:
curl -i -X GET <a moz-do-not-send="true" href="http://IPAddr:35357/v2.0/tenants?%7Bname=XXXX">http://IPAddr:35357/v2.0/tenants?{name=XXXX</a>} -H "User-Agent: python-keystoneclient" -H "X-Auth-Token: XXXXXXXXXXXXXXXXXXXXXX"

Hope this helps.

Best Regards,
Daniel</pre>
      </blockquote>
      <blockquote type="cite"><br>
        <div class="moz-cite-prefix">On 1/8/2015 5:42 PM, Peter Scott
          wrote:<br>
        </div>
        <blockquote cite="mid:54AF3220.2020200@jpl.nasa.gov" type="cite">Hello. 

          The v2.0 API documentation at <a moz-do-not-send="true"
            class="moz-txt-link-freetext"
            href="http://developer.openstack.org/api-ref-identity-v2.html">http://developer.openstack.org/api-ref-identity-v2.html</a>
          says that it is possible to look up a tenant by name.  It
          comes right after the "list all tenants" call and looks the
          same, although if I understand it correctly it takes a request
          body with a 'name' parameter. <br>
          <br>
          However, I can't find any Python support for that lookup nor a
          curl example.  Can someone supply either a curl example or a
          python call that looks up a tenant by name please? <br>
        </blockquote>
      </blockquote>
      <br>
    </blockquote>
    <br>
  </body>
</html>