-
-
Save jskopek/db2aeac10475f9e4aeb394fcfc193f4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<string> GenerateAccessPolicy(string name, int durationInMinutes, int permissions) | |
{ | |
// create access policy | |
var accessPolicyBody = new | |
{ | |
Name = name, | |
DurationInMinutes = durationInMinutes, | |
Permissions = permissions | |
}; | |
var bodyContent = JsonConvert.SerializeObject(accessPolicyBody); | |
HttpResponseMessage accessPolicyResponse = await _httpClient.PostAsync("AccessPolicies", new StringContent(bodyContent, Encoding.UTF8, "application/json")); | |
string responseContent = await accessPolicyResponse.Content.ReadAsStringAsync(); | |
var obj = JObject.Parse(responseContent); | |
return obj["d"]["Id"].ToString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment