Following the documentation for the Duo Security Admin API, I am trying to create/delete a user. The documentation only indicates that a post command needs to be used. No examples are given and Iām not sure where to start.
I am trying to create a user and also delete a user using the following code. Neither works as I am not seeing the user being created or deleted in my admin console.
{"code": 40101, "message": "Missing request credentials", "stat": "FAIL"}
When I paste my URL I get this error and user is not created. What am I doing wrong?
import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;
public class duo {
public static void main(String[] args) throws IOException, InterruptedException {
// Create a neat value object to hold the URL
URL url;
url = new URL("https://api-e9770554.duosecurity.com/admin/v1/users");
// Open a connection(?) on the URL(??) and cast the response(???)
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
// Now it's "open", we can set the request method, headers etc.
connection.setRequestProperty("accept", "application/json");
// This line makes the request
InputStream responseStream = connection.getInputStream();
}
}