GDAP API: Delete Published Template
Introduction
This article is describing our current GDAP API endpoint parameters, payloads and which call methods to use for specific tasks, and how to combine these workflows in C# implementation for Deleting your published Template(s).
Resource Links
Swagger UI - https://dev-gdap.azurewebsites.net/api/swagger/ui
Base URL: https://dev-gdap.azurewebsites.net/api/
API: Delete my custom template
Url: {baseurl}DeleteTemplate
Method: DELETE
Parameters
Key | Value | Description |
providerId | 918c6a1a-******-e0343eea7e0b | Microsoft Partner Tenant Id |
templateId | 2d4dc098-a298-46ec-8a93-c969477a693d | Template Id Here |
Headers
Key | Value | Description |
Authorization | Bearer {accesstoken} | Your access token here |
Example:
GET - https://dev-gdap.azurewebsites.net/api/DeleteTemplate?providerId=918c6a1a-****-43ec-a8ea-e0343eea7e0b&templateId=d6d2544c-9bec-4536-a1da-6d0a1d181831
JSON Response 1 (If access is valid and the account has permissions) :
{
"Result": "Accepted",
"Message": "Template will be removed from the list now."
}
JSON Response 2 (If the access token is not valid or lacks permissions for the call):
null
Response type will default to - 401 (Unauthorized)
C# Method Example:
public async Task<string> DeleteTemplate(string baseUrl, string providerId, string bearer, string templateId)
{
string uri = $"{baseUrl}DeleteTemplate?providerId={providerId}&templateId={templateId}";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
request.Method = "DELETE";
request.Headers.Add("Authorization", $"Bearer {bearer}");
request.Accept = "application/json";
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
using (HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
{
return await reader.ReadToEndAsync();
}
}
Calling this method from code:
var TemplatesDeletionResult = await gdapTemplateOps.DeleteTemplate(CurrentBaseUrl, "ProviderIdHere", bearerToken.access_token, TemplateId);
Was this article helpful?
Articles in this section
- GDAP API: Express Customer Transition
- GDAP API: Delete Published Template
- GDAP API: Transition Customer With Template Roles
- GDAP API: Get Published Templates
- GDAP API: Provision Security Groups Based On Template Roles
- GDAP API: Publish Customized Template
- GDAP API: Get Roles
- GDAP API: Get Relationships
- GDAP API: List Customers
- GDAP API: Synchronize Partner Customers
Add comment
Please sign in to leave a comment.