Move Pending users to Active
Monday, March 27, 2023 at 11:26amWe use SSO so we don't sending out the invitation for users to activate their accounts. How can I programmatically activate the accounts using the .NET SDK. I can determine who's pending from the list of senders, but not sure how to update their status to ACTIVE.
We have used the invitation utility but want to automate the process.
Reply to: Move Pending users to Active
Monday, March 27, 2023 at 12:16pmHi Richard,
I doubt the .NET SDK has the ability to update sender status to ACTIVE, you can use below RESTful method instead:
public void ActivateSender(string senderId, string apiUrl, string apiKey)
{
HttpClient myClient = new HttpClient();
myClient.DefaultRequestHeaders.Add("Authorization", "Basic " + apiKey);
myClient.DefaultRequestHeaders.Add("Accept", "application/json");
StringContent jsonContent = new StringContent("{\"status\":\"ACTIVE\"}", Encoding.UTF8, "application/json");
var response = myClient.PostAsync(new Uri(apiUrl + $"/account/senders/{senderId}"), jsonContent).Result;
if (!response.IsSuccessStatusCode)
{
throw new Exception(response.Content.ReadAsStringAsync().Result);
}
}
ActivateSender("mChXnDrrh8A5", apiUrl, apiKey);
Duo