GDAP API: Publish Customized 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 Publishing Custom Role Template flow.
Resource Links
Swagger UI - https://dev-gdap.azurewebsites.net/api/swagger/ui
Base URL: https://dev-gdap.azurewebsites.net/api/
API: Publish my custom template
Url: {baseurl}PublishTemplate
Method: POST
Body
{
"PartnerId": "918c6a1a-339c-43ec-a8ea-e0343eea7e0b",
"TemplateId": null,
"AppliedRoles": [
{
"Id": "f023fd81-a637-4b56-95fd-791ac0226033",
"Name": "Service support administrator",
"Description": "Can read service health information and manage support tickets."
},
{
"Id": "eb1f4a8d-243a-41f0-9fbd-c7cdf6c5ef7c",
"Name": "Insights administrator",
"Description": "Has administrative access in the Insights app."
},
{
"Id": "d37c8bed-0711-4417-ba38-b4abe66ce4c2",
"Name": "Network administrator",
"Description": "Can manage network locations and review enterprise network design insights for Microsoft 365 Software as a Service applications."
}
],
"TemplateName": "Provide Template name HERE",
"Duration": "P2Y"
}
Headers
Key | Value | Description |
Authorization | Bearer {accesstoken} | Your access token here |
Example:
POST - https://dev-gdap.azurewebsites.net/api/PublishTemplate
JSON Response 1 (If access is valid and the account has permissions to the provided TenantId in template) :
{
"Result": "Accepted",
"Message": "Template data parsed and verfied. Template Id: 2d4dc098-a298-46ec-8a93-c969477a693d"
}
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> PublishTemplate(string baseUrl, string bearer, string templateBody)
{
string result = string.Empty;
string uri = $"{baseUrl}PublishTemplate";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
request.Method = "POST";
request.Headers.Add("Authorization", $"Bearer {bearer}");
request.Accept = "application/json";
request.ContentType = "application/json";
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
request.ContentLength = templateBody.Length;
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
{
streamWriter.Write(templateBody);
}
var httpResponse = (HttpWebResponse)await request.GetResponseAsync();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
result = streamReader.ReadToEnd();
}
return result;
}
Calling this method from code:
var publish = await gdapTemplateOps.PublishTemplate(CurrentBaseUrl, bearerToken.access_token, templatePayload);
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.