Recommended solutions based on your search
Check if you didn't set RequestProperty Content-Type to the wrong type or if you're trying to send the wrong file to the server.
401 means "Unauthorized", so there must be something with your credentials. You need to pass the authentication to let the server know its a valid user. Check whether the authentication details are provided.
Solutions on the web
java.io.IOException: Server returned HTTP response code: 400 for URL: https://api.example.com/api-token-auth/