AMS (Account Management Service) Combined API Doc

API change history

(Soft) Deletes a role definition.

This method expects all role assignments referencing this role to be (soft) deleted separately before (soft) deleting the role definition.

Try it

Request

Request URL

Request parameters

  • integer

    Format - int32. The ID of the role that needs to be deleted.

Request headers

  • string

    Specifies which version of the contract the client is targeting. e.g. 1, 2, 3

  • string

    The correlationId is defined by the client to be able to correlate all traces for a logical operation. Several calls to the service can use the same correlationId. e.g. FC4B9855-B73B-4C15-9566-9768E2705425

  • string

    The requestId is defined by the client to be able to correlate all traces for a specific service request. For each call to the service the client generates a new unique identifier. e.g. C05B0EA7-1126-4CD4-9607-C1BC6F16342C

  • (optional)
    string

    CorrelationVector. A lightweight vector for identifying and measuring causality. e.g. tul4NUsfs9Cl7mOf.0

  • (optional)
    string

    Purpose. Used to indicate the purpose of the request (Live, Test, TiP, E2E). If no purpose is provided, Ams will use the default purpose associated with the incoming client certificate. e.g. Test, Tip

  • (optional)
    string

    Identity Environment. Used to indicate the environment (Production, Integration) for performing identity-related operations (example: Calling AAD). If no identity environment is provided, Ams will use the default identity environment associated with the incoming client certificate.

  • (optional)
    string

    Entity Environment. Used to indicate the environment (Production, Integration) for performing entity-related operations (example: Calling Jarvis Customer Master). If no entity environment is provided, Ams will use the default entity environment associated with the incoming client certificate.

  • (optional)
    string

    AAD access token. AAD/EvoSts token used to call Azure Graph API.

Request body

Responses

200 OK

(OK) - Upon success

Representations

{}
{
  "type": "object",
  "properties": {}
}
{}
{
  "type": "object",
  "properties": {}
}
<System.Object />
{
  "type": "object",
  "properties": {}
}
<System.Object />
{
  "type": "object",
  "properties": {}
}

404 Not Found

(Not Found) if the role cannot be found. Other status codes as appropriate.

Code samples

@ECHO OFF

curl -v -X DELETE "https://api.partnercenter.microsoft-ppe.com/ams/roles/{roleId}"
-H "MS-Contract-Version: "
-H "MS-CorrelationId: "
-H "MS-RequestId: "
-H "MS-CV: "
-H "MS-Ams-Purpose: "
-H "MS-Ams-IdentityEnvironment: "
-H "MS-Ams-EntityEnvironment: "
-H "X-AadUserTicket: "

--data-ascii "{body}" 
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;

namespace CSHttpClientSample
{
    static class Program
    {
        static void Main()
        {
            MakeRequest();
            Console.WriteLine("Hit ENTER to exit...");
            Console.ReadLine();
        }
        
        static async void MakeRequest()
        {
            var client = new HttpClient();
            var queryString = HttpUtility.ParseQueryString(string.Empty);

            // Request headers
            client.DefaultRequestHeaders.Add("MS-Contract-Version", "");
            client.DefaultRequestHeaders.Add("MS-CorrelationId", "");
            client.DefaultRequestHeaders.Add("MS-RequestId", "");
            client.DefaultRequestHeaders.Add("MS-CV", "");
            client.DefaultRequestHeaders.Add("MS-Ams-Purpose", "");
            client.DefaultRequestHeaders.Add("MS-Ams-IdentityEnvironment", "");
            client.DefaultRequestHeaders.Add("MS-Ams-EntityEnvironment", "");
            client.DefaultRequestHeaders.Add("X-AadUserTicket", "");

            var uri = "https://api.partnercenter.microsoft-ppe.com/ams/roles/{roleId}?" + queryString;

            var response = await client.DeleteAsync(uri);
        }
    }
}	
// // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class JavaSample 
{
    public static void main(String[] args) 
    {
        HttpClient httpclient = HttpClients.createDefault();

        try
        {
            URIBuilder builder = new URIBuilder("https://api.partnercenter.microsoft-ppe.com/ams/roles/{roleId}");


            URI uri = builder.build();
            HttpDelete request = new HttpDelete(uri);
            request.setHeader("MS-Contract-Version", "");
            request.setHeader("MS-CorrelationId", "");
            request.setHeader("MS-RequestId", "");
            request.setHeader("MS-CV", "");
            request.setHeader("MS-Ams-Purpose", "");
            request.setHeader("MS-Ams-IdentityEnvironment", "");
            request.setHeader("MS-Ams-EntityEnvironment", "");
            request.setHeader("X-AadUserTicket", "");


            // Request body
            StringEntity reqEntity = new StringEntity("{body}");
            request.setEntity(reqEntity);

            HttpResponse response = httpclient.execute(request);
            HttpEntity entity = response.getEntity();

            if (entity != null) 
            {
                System.out.println(EntityUtils.toString(entity));
            }
        }
        catch (Exception e)
        {
            System.out.println(e.getMessage());
        }
    }
}

<!DOCTYPE html>
<html>
<head>
    <title>JSSample</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>

<script type="text/javascript">
    $(function() {
        var params = {
            // Request parameters
        };
      
        $.ajax({
            url: "https://api.partnercenter.microsoft-ppe.com/ams/roles/{roleId}?" + $.param(params),
            beforeSend: function(xhrObj){
                // Request headers
                xhrObj.setRequestHeader("MS-Contract-Version","");
                xhrObj.setRequestHeader("MS-CorrelationId","");
                xhrObj.setRequestHeader("MS-RequestId","");
                xhrObj.setRequestHeader("MS-CV","");
                xhrObj.setRequestHeader("MS-Ams-Purpose","");
                xhrObj.setRequestHeader("MS-Ams-IdentityEnvironment","");
                xhrObj.setRequestHeader("MS-Ams-EntityEnvironment","");
                xhrObj.setRequestHeader("X-AadUserTicket","");
            },
            type: "DELETE",
            // Request body
            data: "{body}",
        })
        .done(function(data) {
            alert("success");
        })
        .fail(function() {
            alert("error");
        });
    });
</script>
</body>
</html>
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    
    NSString* path = @"https://api.partnercenter.microsoft-ppe.com/ams/roles/{roleId}";
    NSArray* array = @[
                         // Request parameters
                         @"entities=true",
                      ];
    
    NSString* string = [array componentsJoinedByString:@"&"];
    path = [path stringByAppendingFormat:@"?%@", string];

    NSLog(@"%@", path);

    NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
    [_request setHTTPMethod:@"DELETE"];
    // Request headers
    [_request setValue:@"" forHTTPHeaderField:@"MS-Contract-Version"];
    [_request setValue:@"" forHTTPHeaderField:@"MS-CorrelationId"];
    [_request setValue:@"" forHTTPHeaderField:@"MS-RequestId"];
    [_request setValue:@"" forHTTPHeaderField:@"MS-CV"];
    [_request setValue:@"" forHTTPHeaderField:@"MS-Ams-Purpose"];
    [_request setValue:@"" forHTTPHeaderField:@"MS-Ams-IdentityEnvironment"];
    [_request setValue:@"" forHTTPHeaderField:@"MS-Ams-EntityEnvironment"];
    [_request setValue:@"" forHTTPHeaderField:@"X-AadUserTicket"];
    // Request body
    [_request setHTTPBody:[@"{body}" dataUsingEncoding:NSUTF8StringEncoding]];
    
    NSURLResponse *response = nil;
    NSError *error = nil;
    NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];

    if (nil != error)
    {
        NSLog(@"Error: %@", error);
    }
    else
    {
        NSError* error = nil;
        NSMutableDictionary* json = nil;
        NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
        NSLog(@"%@", dataString);
        
        if (nil != _connectionData)
        {
            json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
        }
        
        if (error || !json)
        {
            NSLog(@"Could not parse loaded json with error:%@", error);
        }
        
        NSLog(@"%@", json);
        _connectionData = nil;
    }
    
    [pool drain];

    return 0;
}
<?php
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once 'HTTP/Request2.php';

$request = new Http_Request2('https://api.partnercenter.microsoft-ppe.com/ams/roles/{roleId}');
$url = $request->getUrl();

$headers = array(
    // Request headers
    'MS-Contract-Version' => '',
    'MS-CorrelationId' => '',
    'MS-RequestId' => '',
    'MS-CV' => '',
    'MS-Ams-Purpose' => '',
    'MS-Ams-IdentityEnvironment' => '',
    'MS-Ams-EntityEnvironment' => '',
    'X-AadUserTicket' => '',
);

$request->setHeader($headers);

$parameters = array(
    // Request parameters
);

$url->setQueryVariables($parameters);

$request->setMethod(HTTP_Request2::METHOD_DELETE);

// Request body
$request->setBody("{body}");

try
{
    $response = $request->send();
    echo $response->getBody();
}
catch (HttpException $ex)
{
    echo $ex;
}

?>
########### Python 2.7 #############
import httplib, urllib, base64

headers = {
    # Request headers
    'MS-Contract-Version': '',
    'MS-CorrelationId': '',
    'MS-RequestId': '',
    'MS-CV': '',
    'MS-Ams-Purpose': '',
    'MS-Ams-IdentityEnvironment': '',
    'MS-Ams-EntityEnvironment': '',
    'X-AadUserTicket': '',
}

params = urllib.urlencode({
})

try:
    conn = httplib.HTTPSConnection('api.partnercenter.microsoft-ppe.com')
    conn.request("DELETE", "/ams/roles/{roleId}?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################

########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64

headers = {
    # Request headers
    'MS-Contract-Version': '',
    'MS-CorrelationId': '',
    'MS-RequestId': '',
    'MS-CV': '',
    'MS-Ams-Purpose': '',
    'MS-Ams-IdentityEnvironment': '',
    'MS-Ams-EntityEnvironment': '',
    'X-AadUserTicket': '',
}

params = urllib.parse.urlencode({
})

try:
    conn = http.client.HTTPSConnection('api.partnercenter.microsoft-ppe.com')
    conn.request("DELETE", "/ams/roles/{roleId}?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################
require 'net/http'

uri = URI('https://api.partnercenter.microsoft-ppe.com/ams/roles/{roleId}')

request = Net::HTTP::Delete.new(uri.request_uri)
# Request headers
request['MS-Contract-Version'] = ''
# Request headers
request['MS-CorrelationId'] = ''
# Request headers
request['MS-RequestId'] = ''
# Request headers
request['MS-CV'] = ''
# Request headers
request['MS-Ams-Purpose'] = ''
# Request headers
request['MS-Ams-IdentityEnvironment'] = ''
# Request headers
request['MS-Ams-EntityEnvironment'] = ''
# Request headers
request['X-AadUserTicket'] = ''
# Request body
request.body = "{body}"

response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
    http.request(request)
end

puts response.body