Verifies if the endpoints REST API URLs provided by the Resource Provider are valid and accessible by providing some test URLs in the request body.

Call this API before registering a Resource Provider.

This API tries to access test URLs and if all the tests succeed, it returns a 200 code. If any of the tests fail, it returns a 409 code. If the API succeeds the admin can proceed to actually registering the RP with the system. Use this API to prevent the overhead involved in fixing the system, if something is wrong with the Resource Provider.

Request

The Verify Resource Provider request may be specified as follows.

Method Request URI HTTP Version

POST

https://<admin-endpoint>/resourceProviders?verify=true

HTTP/1.1

URI Parameters

None.

Request Headers

None

Request Body

  Copy Code
<ResourceProviderVerification  xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/windowsazure">
	 <ResourceProvider>
<Name>DADHQ32B</Name>
<DisplayName>DisplayName:DADHQ32B</DisplayName>
<Enabled>true</Enabled>
<PassThroughEnabled>true</PassThroughEnabled>
<AdminEndpoint><ForwardingAddress>http://energy:8005/dummy/DADHQ32B/AdminEndpoint</ForwardingAddress></AdminEndpoint> 
<TenantEndpoint><ForwardingAddress>http://energy:8005/dummy/DADHQ32B/TenantEndpoint</ForwardingAddress></TenantEndpoint> 
<NotificationEndpoint><ForwardingAddress>http://energy:8005/dummy/DADHQ32B/NotificationEndpoint</ForwardingAddress></NotificationEndpoint>
	 </ResourceProvider>
	 <TestUrls>
		 <TestUrl> http://energy:8005/dummy/DADHQ32B/AdminEndpoint /service1/URL1 </TestUrl>
		 <TestUrl> http://energy:8005/dummy/DADHQ32B/TenantEndpoint /907a4d2a-4bf7-4d00-a692-ef1983f81fbe/services/rpname/Url2</TestUrl>
	 </TestUrls>
</ResourceProviderVerification>

Response

Returns 200 code if all test URLs return successful codes, and 409 code if one of the tests failed.

Response Body

  Copy Code
<ResourceProviderVerificationResults>
	<TestResult>
	<TestUrl>> http://energy:8005/dummy/DADHQ32B/AdminEndpoint /service1/URL1</TestUrl>
	<ResponseStatusCode>200</ResponseStatusCode>
	</TestResult>
	<TestResult>
	<TestUrl> http://energy:8005/dummy/DADHQ32B/TenantEndpoint /907a4d2a-4bf7-4d00-a692-ef1983f81fbe/services/rpname/Url2</TestUrl>
	<ResponseStatusCode>401</ResponseStatusCode>
	</TestResult>
</ResourceProviderVerificationResults>

Example

Verify if the endpoints REST API URLs provided by the Resource Provider are valid and accessible by providing some test URLs in the request body.

  Copy Code
public void CreateResourceProvider(string adminServiceEndpoint)
{
	HttpClient httpClient = new HttpClient();
	httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("BASIC", Convert.ToBase64String(UnicodeEncoding.Unicode.GetBytes("AdminPortal:" + ”password”)))));

		string requestUri = adminServiceEndpoint + "resourceproviders?verify=true";
			var verificationInfo = new ResourceProviderVerification()
			{
				ResourceProvider = new ResourceProvider("BotResProvider", "BotResProviderName")
					{
						Enabled = true,
						AdminEndpoint = new AdminEndpoint("http://energy:8005/dummy/DADHQ32B/AdminEndpoint"),
						TenantEndpoint = new TenantEndpoint("http://energy:8005/dummy/DADHQ32B/TenantEndpoint"),
						NotificationEndpoint = new NotificationEndpoint("http://energy:8005/dummy/DADHQ32B/NotificationEndpoint"),

				},
				TestUrls = new Uri[]
					{
						new Uri(adminServiceEndpoint + "/services/BotResProvider/Url1"), // Test admin endpoint
						new Uri(tenantServiceEndpoint + "/" + tenantSubscriptionId + "/services/BotResProvider/Url2")  // Test tenant endpoint
				}
		};

			Console.WriteLine(httpClient.PostAsXmlAsync<ResourceProviderVerification>(requestUri, verificationInfo).Result.EnsureSuccessStatusCode() + "\n Successfully verified Resource Provider");
}