How to unpublish applications from a catalog in Azure account

Use REST APIs to unpublish applications from a catalog in your Azure account.

You can make API requests using the PowerShell code, C# code, or any tool that supports invoking the REST API.

Remove apps from a catalog documentation.

Steps to unpublish applications from a catalog in Azure account

To unpublish applications from a catalog in your Azure account, use the following procedure:

Unpublish applications from a catalog in Azure account using any REST API tool

Learn from the following example about how to unpublish an existing application from a catalog in your Azure account using any REST API tool.

Request

DELETE https://api.cloud.com/catalogservice/{customerId}/{siteId}/catalogs/{catalogId}/apps/{appId} HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: CwsAuth bearer=<token-from-prerequisites>
<!--NeedCopy-->

Response

HTTP/1.1 204 NoContent
citrix-transactionid: c2bc6a4c-a807-46dc-847a-4fcb4c971953
content-Length: 0
content-Type: application/json; charset=utf-8
date: "Tue, 03 Oct 2017 22:15:10 GMT"
<!--NeedCopy-->

Interpreting the request URL

appId

appId should be replaced with the actual app ID of the application you want to unpublish. See How to get all catalog applications API to obtain the appId for all your published apps.

Interpreting the response

The response, in case of success, will have status code “204” without response body.

Unpublish applications from a catalog in Azure account using PowerShell

Learn from the following example about how to unpublish an existing application from a catalog in your Azure account using PowerShell code.

function UnPublishCatalogApplication {
  param (
    [Parameter(Mandatory=$true)]
    [string] $customerId,
    [Parameter(Mandatory=$true)]
    [string] $siteId,
    [Parameter(Mandatory=$true)]
    [string] $bearerToken,
    [Parameter(Mandatory=$true)]
    [string] $catalogId,
    [Parameter(Mandatory=$true)]
    [string] $appId
  )

  $requestUri = [string]::Format("https://api.cloud.com/catalogservice/{0}/{1}/catalogs/{2}/apps/{3}", $customerId, $siteId, $catalogId, $appId)
  $headers = @{"Accept"="application/json";
               "Authorization"="CwsAuth bearer=$bearerToken"}

  $response = Invoke-RestMethod -Uri $requestUri -Method DELETE -Headers $headers
  return $response
}

$customerId = "customer1" #Replace with your customerId
$siteId = "61603f15-cdf9-4c7f-99ff-91636601a795" #Replace with your site ID
$bearerToken = "ey1.." #See Prerequisites for all API calls section for a sample of how to get your bearer token
$catalogId = "56f1cbf3-1cc6-40cd-9c82-c95633ba88bb" #Replace with your catalog ID
$appId = "50af6370-fff1-4fc9-b082-a33761fd2f20" #Replace with your app id
$response = UnPublishCatalogApplications $customerId $siteId $bearerToken $catalogId $appId
<!--NeedCopy-->

Unpublish applications from a catalog in Azure account using C# code

Learn from the following example about how to unpublish an existing application from a catalog in your Azure account using C# code.

public static async Task<string> UnPublishCatalogApplication(
    string customerId,
    string siteId,
    string bearerToken,
    string catalogId,
    string appId)
{
    var requestUri = string.Format("https://api.cloud.com/catalogservice/{0}/{1}/catalogs/{2}/apps/{3}", customerId, siteId, catalogId, appId);
    using (var client = new HttpClient())
    {
        client.DefaultRequestHeaders.Accept.ParseAdd("application/json");
        client.DefaultRequestHeaders.Authorization =
                   new AuthenticationHeaderValue("CwsAuth", "Bearer=" + bearerToken);

        var response = await client.DeleteAsync(requestUri);

        if (response != null)
        {
            var content = await response.Content.ReadAsStringAsync();
            return content;
        }

        return null;
    }
}
<!--NeedCopy-->
Resources
Catalog service Quick Deploy APIs OpenAPI Specification
Copy Download
How to unpublish applications from a catalog in Azure account