- Community Home
- >
- Software
- >
- HPE OneView
- >
- Set default login directory
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2019 03:06 AM
05-02-2019 03:06 AM
Trying to set the default login directory using the REST API. I ran:
# Follow instructions in: OneView-API_Get_Session_Credentials.txt curl --insecure \ --header "content-type: application/json" \ --header "X-API-Version: ${currentVersion}" \ --header "auth: ${sessionID}" \ --data "{ \"allowLocalLogin\"" true, \"defaultLoginDomain\"; { \"loginDomain\": \"2\", \"name\": \"${ADD}\", \"type\": \"LoginDomainConfigInfoDto\", \"uri\": \"/rest/logindomains/s\" }}" \ --request POST ${OneView}/rest/logindomains/global-settings/default-login-domain | jq -r '.'
which gives back:
{ "data": {}, "nestedErrors": [], "errorSource": null, "recommendedActions": [ "Correct the JSON as appropriate array or collection and try the request again." ], "details": "The JSON sent in the request is not a valid array or collection.", "message": "The JSON can not be mapped to array or collection.", "errorCode": "INVALID_JSON_ELEMENT" }
If I just echo the data segment to jq, I get:
echo "{ \"allowLocalLogin\"" true, \"defaultLoginDomain\"; { \"loginDomain\": \"2\", \"name\": \"${ADD}\", \"type\": \"LoginDomainConfigInfoDto\", \"uri\": \"/rest/logindomains/s\" }}" | jq -r '.' { "defaultLoginDomain": { "uri": "/rest/logindomains/2", "type": "LoginDomainConfigInfoDto", "name": "HQ", "loginDomain": "2" }, "allowLocalLgin": true }
which looks fine as far as I can tell. Anyone have an idea what I am doing wrong?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2019 09:47 AM
05-02-2019 09:47 AM
Re: Set default login directory
You are using the wrong URI to set the default directory. The correct URI would be:
POST https://{appl}/rest/logindomains/global-settings/default-login-domain Auth: abcdefghijklmnopqrstuvwxyz012345 X-Api-Version: 1000 Content-Type: application/json "myDirectoryName"
This is documented in our REST API reference document, under Login Domains Global Settings. You could have searched that same API documentation for default directory:
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2019 02:39 AM
07-26-2019 02:39 AM
SolutionSorry Chris, I just realized I never closed this out. I did get it working with:
#
# Set the default login directory
# First, get a listing of configured directories:
curl --insecure \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--request GET ${OneView}/rest/logindomains | jq -r '.'
# From the above, get the loginDomain number and the corresponding uri:
LGURI="/rest/logindomains/2"
LGDOMNUM="2"
# Note: If you have only one directory configured, can set LGURI directly with:
LGURI=$(curl --insecure \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--request GET ${OneView}/rest/logindomains | jq -r '.members[] | .directoryServers[] | .uri')
# And the LGDOMNUM with:
LGDOMNUM=$(curl --insecure \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--request GET ${OneView}/rest/logindomains | jq -r '.members[] | .loginDomain')
ADD="ADHQ"
DATA='{ "allowLocalLogin": true, "defaultLoginDomain": { "loginDomain": "'${LGDOMNUM}'", "name": "'${ADD}'", "type": "LoginDomainConfigInfoDto", "uri": "'${LGURI}'"
curl --insecure \
--header "content-type: application/json" \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--data "${DATA}" \
--request POST ${OneView}/rest/logindomains/global-settings/default-login-domain | jq -r '.'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2019 09:28 PM
07-31-2019 09:28 PM
Re: Set default login directory
Hi Brad,
Looks like you pasted the old request !
Did you have to change the URI to /rest/logindomains/global-settings or the request body to pass only the directory name as string as Chris suggested? Is it possible for you to confirm and update the request so that it can help anyone else facing a similar issue?
DATA='{ "allowLocalLogin": true, "defaultLoginDomain": { "loginDomain": "'${LGDOMNUM}'", "name": "'${ADD}'", "type": "LoginDomainConfigInfoDto", "uri": "'${LGURI}'"
curl --insecure \
--header "content-type: application/json" \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--data "${DATA}" \
--request POST ${OneView}/rest/logindomains/global-settings/default-login-domain | jq -r '.'
~Poongkodi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2019 03:10 AM - edited 08-01-2019 03:11 AM
08-01-2019 03:10 AM - edited 08-01-2019 03:11 AM
Re: Set default login directory
You are right that I don't have that correct. However, the documentation needs some work. For example, the REST API reference, the "Authorization" section states: "This API requires no authorization." However, the "Request" section shows an "Auth" line and the "Request Headers" section has an Auth entry with: "Session authorization token obtained from logging in. If this header is not included or if the session-token is invalid, the response code will be 401 Unauthorized." It definately could use a better example of what is required in the request body. I tried:
DATA="ADHQ"
curl --insecure \
--header "content-type: application/json" \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--data "${DATA}" \
--request POST ${OneView}/rest/logindomains/global-settings/default-login-domain | jq -r '.'
and get back malformed JSON. I tried:
DATA='{ "name": "ADHQ" }'
and get back invalid JSON. The REST API reference "Request Body" section talks about a very large number of items. I ran:
curl --insecure \
--header "content-type: application/json" \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--request GET ${OneView}/rest/logindomains/global-settings | jq -r '.'
and copied the entire section related to ADHQ into the DATA variable and tried again. I got back that the JSON sent in the request is not a valid array or collection. Like I said, the API reference is not clear. Could someone please provide a more clear example of what is the proper JSON to supply for setting the default login domain?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2019 02:30 AM - edited 08-02-2019 02:31 AM
08-02-2019 02:30 AM - edited 08-02-2019 02:31 AM
Re: Set default login directory
Well, from a previous conversation, Set default login domain back to local, implies just the directory name. So, I tried:
ADD="ADHQ"
curl --insecure \
--header "content-type: application/json" \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--data "${ADD}" \
--request POST ${OneView}/rest/logindomains/global-settings/default-login-domain | jq -r '.'
but that still gives me "malformed JSON cannot be parsed."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2019 11:52 PM
08-05-2019 11:52 PM
Re: Set default login directory
Hi Brad,
I see that you missed to surround the value with quotes like you mentioned in the other thread.
Try
ADD="ADHQ"
curl --insecure \
--header "content-type: application/json" \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--data '"${ADD}"' \
--request POST ${OneView}/rest/logindomains/global-settings/default-login-domain | jq -r '.'
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2019 03:27 AM
08-06-2019 03:27 AM
Re: Set default login directory
No, that was not it. I found in the REST API reference, that "MALFORMED_JSON" means that the data did not parse as JSON. Just having the name "ADHQ" is not a JSON. So, I attempted:
DATA='"name": "'${ADD}'"'
curl --insecure \
--header "content-type: application/json" \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--data "${DATA}" \
--request POST ${OneView}/rest/logindomains/global-settings/default-login-domain | jq -r '.'
and this time got back:
Invalid global settings. Property: name, Value: {1}\nThe specified enterprise directory name name does not exist.
AUTHN_GLOBALSETTINGS_VALIDATION_RESOURCE_ERROR
Not sure what that means? When I retrieve a listing of the logindomains, that field, name, has value ADHQ. So, what am I missing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2019 10:49 PM - edited 08-06-2019 10:51 PM
08-06-2019 10:49 PM - edited 08-06-2019 10:51 PM
Re: Set default login directory
hi @BradV
Sorry about the trouble this API has been causing you.
There is something odd about this specific API.
We have taken your input.
This specific API does not accept standard JSON as the POST body.
So in your attempt below, you have DATA: { "name" : "AHQ" } which is what you would expect a standard API to accept.
While most of our other APIs do accept a format such as this, this specific one instead takes just a string "ADHQ" enclosed in double quotes as the *only* input in the POST body.
So do not pass the DATA = '"name": "'${ADD}'"' as the argument to --data.
Instead you need to pass just --data "ADHQ" as the argument.
When doing this from curl on the command line, the below would work.
curl --insecure \
--header "content-type: application/json" \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--data '"ADHQ"' \ #(that is an opening single quote followed by ADHQ in double quotes followed by a closing single quote)
--request POST ${OneView}/rest/logindomains/global-settings/default-login-domain | jq -r '.'
Try after making that change. I have justed tested it and that works.
DATA='"name": "'${ADD}'"' curl --insecure \ --header "content-type: application/json" \ --header "X-API-Version: ${currentVersion}" \ --header "auth: ${sessionID}" \ --data "${DATA}" \ --request POST ${OneView}/rest/logindomains/global-settings/default-login-domain | jq -r '.'
And let us know.
Thank you for being patient with this.
Regards,
Bhaskar
I am an HPE employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2019 05:12 AM
08-07-2019 05:12 AM
Re: Set default login directory
Hi Bashkar,
When I just give the name, it responds with malformed json. When I remove the '--header "content-type: application/json",' the error message changes to: "Invalid global settings. Property: ADHQ=, Value: {1}\nThe specificed enterprise directory name ADHQ= does not exist."
So, this API is not correctly documented. This API reference also states no authorization is required.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2019 09:35 AM
08-07-2019 09:35 AM
Re: Set default login directory
hi @BradV
I wasnt expecting to see the "ADHQ=" in the error.
My request looks like this
curl -k -X POST \
--header "Content-Type:application/json" \
--header "X-API-Version:800" \
--header "Auth:xyz" \
--data '"ADHQ"' 'https://myappliance.hpe.com/rest/logindomains/global-settings/default-login-domain'
Can you check and compare against what you send to the server after all the substitutions?
ADHQ is the name of the directory that I want to be set as default.
Regards,
Bhaskar
I am an HPE employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2019 10:02 AM - edited 08-07-2019 10:03 AM
08-07-2019 10:02 AM - edited 08-07-2019 10:03 AM
Re: Set default login directory
Changing any setting within OneView via the API requires authorization. Your account needs to have Infrastructure administrator role.
As for setting the default auth directory for the appliance, you need to just encapsulate the directory name in double-quotes:
--data "ADHQ"
Otherwise, the API will be wanting to look for 'ADHQ', not just ADHQ.
Also, when providing code, either use the Insert Code button (which is the </> icon), or use another font type like Courier New.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2019 04:06 AM - edited 08-08-2019 04:08 AM
08-08-2019 04:06 AM - edited 08-08-2019 04:08 AM
Re: Set default login directory
Hi Chris,
I was just pointing out that the API Reference is invalid again.
It says:
Authorization
This API requires no authorization.
then in the Request Headers section:
Auth Session authorization token obtained from logging in. If this header is not included or if the session-token is invalid, the response code will be 401 Unauthorized.
So, inconsistent.
Bashkar/Chris,
I am just using --data "ADHQ." I believe the API reference example is also missleading. It shows including the header, Content-Type: application/json. The single name is not a valid json. So, if I include that header, I get malformed json as the error.
If I run:
curl --insecure \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--data "ADHQ" \
--request POST ${OneView}/rest/logindomains/global-settings/default-login-domain | jq -r '.'
I get the error with "errorSource": "ADHQ=" in the response. I don't see any difference between what I have and what you presented other than the json header?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2019 05:23 PM
08-08-2019 05:23 PM
Re: Set default login directory
Hi @BradV
In this specific case, you need an extra pair of single quotes enclosing the "ADHQ". It needs to be <single quote>"ADHQ"<single quote>. Substitute all the variables, form a command line that works, then go back and fix the script accordingly.
curl --insecure \
--header "X-API-Version: 800" \
--header "auth: XYZ" \
--data '"ADHQ"' \
--request POST ${OneView}/rest/logindomains/global-settings/default-login-domain | jq -r '.'
The below reliably works.
curl -k -X POST --header "Content-Type:application/json" --header "X-API-Version:800" --header "Auth:XYZ" --data '"ADHQ"' 'https://myappliance.hpe.com/rest/logindomains/global-settings/default-login-domain'
Try it out and let me know.
Regards,
Bhaskar
I am an HPE employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2019 02:06 AM
08-09-2019 02:06 AM
Re: Set default login directory
Hi Bashkar,
I finally got it worked out. The REST API documentation needs updated. First, correct the information about authorization. Next is the content type header. When I included content type header of application/json, I always got back malformed json since a single word is not a valid json. So, I just dropped that header, but kept getting back invalid global settings and the errorsource was ADHQ=. This worked:
DATA="ADHQ"
curl --insecure \
--header "content-type: text/plain" \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--data "${DATA}" \
--request POST ${OneView}/rest/logindomains/global-settings/default-login-domain | jq -r '.'
Thanks for the help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2019 08:32 AM
08-11-2019 08:32 AM
Re: Set default login directory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2019 02:08 AM
08-12-2019 02:08 AM
Re: Set default login directory
Hi Bashkar,
So, just to make sure, someone is entering a change request for the REST API documentation to fix the information on authorization, change the header information to show that header content-type: text/plain is required, and give a valid example?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2019 05:11 PM
08-12-2019 05:11 PM
Re: Set default login directory
hi @BradV
Yes, the error with the REST API documentation about authorization is being corrected.
On the content type, checking on the version of curl we use.
Regards
Bhaskar
I am an HPE employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2019 01:40 AM
08-13-2019 01:40 AM
Re: Set default login directory
Hi Bashkar,
If it helps, I am running on a RHEL 6.10 server with curl 7.19.7. I wouldn't think that the version of curl would matter? The content supplied was not a JSON. It was just plain text.
Regards,
Brad