Kipp500 Contributor.
Contributor.
251 views

HTTP Client Get URI Query with quotation marks

Hello community I was hoping somebody might be able to help with the following issue.

I'm trying to execute a REST API call with a query and I'm having trouble.

The API documentation says that I should use the following format for my query:

https://<storage system>:8080/api/v1/volumes?query=”wwn EQ value1 OR wwn EQ value2 … OR wwn EQ valueN”

The issue I am having is that HP OO doesn't like the quotations and it wants to replace the spaces with URL encoding such as %20 or "+"  ...  since HP OO is built on java I read that it's a bit tricky to pass the query with quotations and spaces.

Can anybody offer any guidance on how to issue a GET request with a query as described above?

0 Likes
2 Replies
Bridges Respected Contributor.
Respected Contributor.

Re: HTTP Client Get URI Query with quotation marks

for v1 Get Client:

Try setting encodeURL to true.

encodeURL - Specifies whether to encode the URL. If you specify a non-boolean value, the default value is used.
Valid values: true, false
Default value: false

for v2 Get Client:

Try setting queryParamsAreURLEncoded to true.

queryParamsAreURLEncoded - Specifies whether to encode  (according to the url encoding standard) the queryParams. If you set "queryParamsAreURLEncoded"=true and you have invalid characters in 'queryParams' they will get encoded anyway. If you specify a non-boolean value, the default value is used.
Default value: false
Valid values: true, false

 

0 Likes
Kipp500 Contributor.
Contributor.

Re: HTTP Client Get URI Query with quotation marks

This is what I have set for queryParams:

query="wwn EQ ${wwn}"

When I set the queryParamsAreURLEncoded to true:

Result:

https://<server>:8080/api/v1/volumes?query=%22wwn+EQ+600002AC000000000000027900019A9A%22

I believe I need:

https://<server>:8080/api/v1/volumes?query="wwn EQ 600002AC000000000000027900019A9A"

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.