This example illustrates how to get a customer’s site identifiers using PowerShell.

functionGetSites{param([Parameter(Mandatory=$true)][string]$customerId,[Parameter(Mandatory=$true)][string]$bearerToken)$requestUri=[string]::Format("https://catalogs.apps.cloud.com/{0}/sites",$customerId)$headers=@{"Accept"="application/json";"Authorization"="CwsAuth bearer=$bearerToken"}$response=Invoke-RestMethod-Uri$requestUri-MethodGET-Headers$headersreturn$response}$customerId="customer1"#Replace with your customerId$bearerToken="ey1.."#See Prerequisites for all API calls section for a sample of how to get your bearer token$response=GetSites$customerId$bearerToken

This example illustrates how to get a customer’s site identifiers using C#.

publicstaticasyncTask<string>GetSites(stringcustomerId,stringbearerToken){varrequestUri=string.Format("https://catalogs.apps.cloud.com/{0}/sites",customerId);using(varclient=newHttpClient()){client.DefaultRequestHeaders.Accept.ParseAdd("application/json");client.DefaultRequestHeaders.Authorization=newAuthenticationHeaderValue("CwsAuth","Bearer="+bearerToken);varresponse=awaitclient.GetAsync(requestUri);if(response!=null){varcontent=awaitresponse.Content.ReadAsStringAsync();// Parsing the JSON content is left as an exercise to the reader.// Consult Json.NET documentation on newtonsoft.com for more information.returncontent;}returnnull;}}