Reply To: Email password

#1071
AvatarMichael Davies
Participant

First off, I am very glad to hear about any LDAP attributes being able to be used in future, that would be ideal for me.  Do you support OpenLDAP as well as Microsoft AD?

Anyway, I think I have discovered a solution that will work for me (basically I am using a large policy for 99% of config and a small user specific policy just for email, then associating both with a given user – this seems to give better results than an empty password).

However looking into this further, I started to look at editing policies via your API and as per your documentation (https://www.hexnode.com/mobile-device-management/help/hexnode-mdm-api-documentation/#edit-policy), I was doing this:

curl -H “Authorization: <API KEY>” -H “Content-Type: application/json” -d ‘{ “policyName”: Sales Team Policy”,”policyDescription”:””, “ios”:{“password”:{“allow_simple”:true,”force_pin”:true,”forcePIN”:false,”max_failed_attempts”:-1, “max_grace_period”:-1,”max_inactivity”:-1,”max_pinage_in_days”:””,”min_complex_chars”:-1,”min_length”:-1,”pin_history”:””,”require_alphanumeric”:false},”delete_credentials”:[]},”ios_configured”:true }’ https://<portal&gt;.hexnodemdm.com/api/v1/policy/<ID>/ -X PUT

Obviously I put in appropriate API key, portal, and policy ID in.  This no longer seems to work:

{“detail”:”JSON parse error – No JSON object could be decoded”}

So I modified it to this, which seemed better formed JSON:

curl -H “Authorization: <API Key>” -H “Content-Type: application/json” -d ‘{ “name”: “Sales Team Policy”,”description”:””, “ios”:{“password”:{“allow_simple”:true,”force_pin”:true,”forcePIN”:false,”max_failed_attempts”:-1, “max_grace_period”:-1,”max_inactivity”:-1,”max_pinage_in_days”:30,”min_complex_chars”:-1,”min_length”:-1,”pin_history”:5,”require_alphanumeric”:false},”delete_credentials”:[]},”ios_configured”:true }’ https://<portal&gt;.hexnodemdm.com/api/v1/policy/<ID>/ -X PUT

But it failed in less obvious way:

{“detail”:”Sorry, Something went wrong, An unexpected condition was encountered while the server was attempting to fullfill the request”}

I also tried:

curl -H “Authorization: <API Key>” -H “Content-Type: application/json” -d ‘{ “name”: “foobar”,”description”:””, “android”:{“email”:{“account_name”:”%name%”,”account_description”:”Email”,”email_address”:”%email%”,”incoming_account_type”:”imap”,”incoming_server_host_name”:”<IP>”,”incoming_server_port”:993,”incoming_server_username”:”%username%”,”incoming_password”:”foobar”,”incoming_server_use_ssl”:true,”incoming_server_use_tls”:false,”incoming_server_use_certificate”:false,”out_account_type”:”smtp”,”out_server_host_name”:”<IP>”,”out_server_port”:587,”out_server_username”:”%username%”,”out_password”:”foobar”,”out_server_use_ssl”:false,”out_server_use_tls”:true,”out_server_use_certificate”:false}},”android_configured”:true }’ https://<portal&gt;.hexnodemdm.com/api/v1/policy/<ID>/ -X PUT

Same: {“detail”:”Sorry, Something went wrong, An unexpected condition was encountered while the server was attempting to fullfill the request”}

Am I doing something wrong or is this a limitation of a trial account I am not aware of?  One thing I did notice with latter two was: while they did not edit the policy settings specified in the JSON, they did +1 increase the policies version numbers.

Retrieving info about policies worked fine using the API, just editing via API was the issue.

Any help would be greatly appreciated.