HPE 3PAR StoreServ Storage
1753868 Members
7347 Online
108809 Solutions
New Discussion

query added to eventlog does not work

 
SOLVED
Go to solution
veeyarvi
HPE Pro

Re: query added to eventlog does not work

Hi BradV

Yes, it is working in plain curl.  (Also the port number 443 is for https and those examples are from the Primera. 3par it is 8080 only (Basically you might not need to give the port number also).

And, it seems the issue is with the http/jason client. It needs the ASCII values instead of blank space, " etc. 

Could you try the same?

curl -s --insecure --header "X-HP3PAR-WSAPI-SessionKey: <key>" <Array>api/v1/eventlog/minutes:1000?query=%22severity%20EQ%206%22 | jq -r '.'

%22 is for "
%20 is for SPACE

Regards,

Veeyarvi


I am an HPE Employee.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
BradV
Esteemed Contributor

Re: query added to eventlog does not work

Well, that gives:

{
  "code": 148,
  "desc": "Invalid Query String"
}

I also tried changing the '%22' back to ", but that also gave back code 148.

veeyarvi
HPE Pro

Re: query added to eventlog does not work

Hi BradV,

Could you share the complete query and the output?

Regards,

Veeyarvi


I am an HPE Employee.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
BradV
Esteemed Contributor
Solution

Re: query added to eventlog does not work

Sure.

 

USERN=myid
PASSW='mypassword'
STORSRV='my-storserv.com'
sessionID=$(curl --insecure --header "content-type: application/json" \
  --header "accept: applicatoin/json" \
  --data '{"user":"'"${USERN}"'","password":"'"${PASSW}"'","sessionType":1}' \
  --request PSOT https://${STORSRV}:8080/api/v1/credentials | jq -r '.key')
echo ${sessionID}
curl --silent --insecure --header "X-HP3PAR-WSAPI-SessionKey: ${sessionID}" https://${STORSRV}:8080/api/v1/eventlog/minutes:1000?%22category%20EQ%201%22 | jq -r '.'

and get output:

{
  "code": 148,
  "desc": "Invalid Query String"
}

 

BradV
Esteemed Contributor

Re: query added to eventlog does not work

I missed a "query'" in that string.  Modifying to:

curl --silent --insecure --header "X-HP3PAR-WSAPI-SessionKey: ${sessionID}" https://${STORSRV}:8080/api/v1/eventlog/minutes:1000?query=%22category%20EQ%201%22 | jq -r '.'

gets me back the correct values.

Could you please make sure they update the documentation to reflect this required character substition?

veeyarvi
HPE Pro

Re: query added to eventlog does not work

Hi BradV,

Nice to see it worked.


As mentioned before, the syntax given in the guide are for plain curl and they work. And when we use the http/json client  need to enclode the url in ASCII format.

Regards,
Veeyarvi


I am an HPE Employee.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
veeyarvi
HPE Pro

Re: query added to eventlog does not work

Hi BradV,

Just to add, we can use the switch  '--data-urlencode' with the clients and thus avoid providing the ASCII values. 

e.g.

curl -G -k -H 'Content-Type: application/json' -H 'Content-Type: application/json' -H "X-HP3PAR-WSAPI-Sessionkey:${key}" -X GET  --data-urlencode 'query="severity EQ 6"'

 

 


I am an HPE Employee.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo