Azure API管理Rest Serviceを初めて使用しました。私はsharedaccesstoken
で新しいAPI管理を作成しました。Azure API管理Restサービスを使用してユーザーを作成する
using (HttpClient httpClient = new HttpClient())
{
var request = new HttpRequestMessage(HttpMethod.Post, requestUrl);
request.Headers.Authorization =
new AuthenticationHeaderValue("SharedAccessSignature", sharedAccessSignature);
request.Content = new StringContent("{\"accountEnabled\": true,\"creationType\": \"LocalAccount\",\"displayName\": \"Alex Wu\",\"passwordProfile\": {\"password\": \"Test1234\",\"forceChangePasswordNextLogin\": false},\"signInNames\": [{\"type\": \"userName\",\"value\": \"AlexW\"},{\"type\": \"emailAddress\",\"value\": \"[email protected]\"}]}");
HttpResponseMessage response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
responseBody = await response.Content.ReadAsStringAsync();
}
私は上記のコードを実行し、エラーを取得:
{StatusCode: 405, ReasonPhrase: 'Method Not Allowed', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:{ Date: Wed, 30 Mar 2016 19:38:15 GMT Content-Length: 73 Allow: GET Content-Type: application/json; charset=utf-8}}
誰かが私はので、私はRESTサービスを介して、新規ユーザーを作成することができます前進を助けることができます。