VMware Cloud Community
SurenGoel04
Contributor
Contributor

API call to find the org membership of a user

We are integrating vCD portal to out main MSP portal and working on to have user login to its organization via url redirection (via API). For example,

https://vcd/api/admin/user/5 does not return which organization user belongs to

how can we find that information?

Thanks
Reply
0 Kudos
3 Replies
cenkcil
Contributor
Contributor

Apparently, by querying organization first you have to retrieve users listed like below and then somehow map and save these user with the organization for further queries.

I don't see any other option at current REST API functionality.

Another workaround perhaps you can name users with organization name at the end as full name such as, "FirstName LastName - Organiztion Name" and then you can parse it.

https://domainname.com/api/org/431612bf-2a0a-4a15-987c-4f8554accc11

<Users>

        <UserReference href="https://domainname.com/api/admin/user/b4139511-dd71-48c2-bded-cc0d88fb91a2" name="username1" type="application/vnd.vmware.admin.user+xml"/>

        <UserReference href="https://domainname.com/api/admin/user/c93a0991-b4bc-4a61-b186-9f0c58025619" name="username2" type="application/vnd.vmware.admin.user+xml"/>

type="application/vnd.vmware.admin.user+xml"/>

    </Users>

Reply
0 Kudos
jnivoit
VMware Employee
VMware Employee

You can use the /api/query?type=adminUser query and it will get you a result like:

<QueryResultRecords  name="adminUser" page="1" pageSize="25" total="7" href="https://172.16.1.2:8443/api/query?type=adminUser&page=1&pageSize=25&format=records" type="application/vnd.vmware.vcloud.query.records+xml">

    <AdminUserRecord deployedVMQuota="0" deployedVMQuotaRank="-1" fullName="vappauthor" identityProviderType="INTEGRATED" isEnabled="true" isLdapUser="false" name="vappauthor" numberOfDeployedVMs="0" numberOfStoredVMs="0" org="https://172.16.1.2:8443/api/org/838d246e-a26f-4003-971d-f9c839bd6235" storedVMQuota="0" storedVMQuotaRank="-1" href="https://172.16.1.2:8443/api/admin/user/742e8118-033f-430c-bb0d-283040f48717"/>

</QueryResultRecords>

the "org=" attribute gives you the information you need.

Reply
0 Kudos
jnivoit
VMware Employee
VMware Employee

FYI, in the next release of vCD, the <User> will contain an UP <Link>  back to the <Org>.

Reply
0 Kudos