Hitachi Content Platform​

 View Only

 No Response from cURL POST query

  • Object Storage
  • Hitachi Content Platform HCP
James Ash's profile image
James Ash posted 07-12-2019 21:02

We are trying to use a single POST query that will return details about all objects AND sub-directories directories within specified paths. When I try the cURL command it doesn't respond with anything, no errors or XML list. 

Can someone take a look at my XML values and cURL command at see what may be going wrong?

The "MultiQuery.XML file contains these values:

<queryRequest>

 

         <object>                <query>                   +namespace:visamr.demo2                   +objectPath:"Dir1"                </query>                <query>                   +namespace:visamr.demo2                   +objectPath:"Dir3"                  </query>             <facets>namespace</facets>             <verbose>true</verbose>          </object></queryRequest>

Our cURL command is:

curl -k -H "Authorization: HCP aHMz:a3b9c163f6c520407ff34cfdb83ca5c6" -H "Content-Type: application/xml" -H "Accept: application/xml" -d /temp/visa/multiquery.xml "https://demo2.hcp-demo.hcpdomain.com/query?prettyprint"

 

The result (or lack there of) looks like this:

pastedimage_3

 

 

 

Any ideas why I am not getting a response back?


#HitachiContentPlatformHCP
Yury Kats's profile image
Yury Kats

You should use -i option with curl, so that it shows you the error code. In

this case you are getting 400 BAD REQUEST. The problem with your xml is

that you have two query elements. You can only have one.

On July 12, 2019 5:02:49 PM Jim Ash <community-noreply@hitachivantara.com>

James Ash's profile image
James Ash

Thanks Yury. I did get past the no response problem and I am getting details back. I have one additional question. I am trying to get results from multiple paths (or directory names) in a single namespace. For instance, return all files information stored in a directories named "Dir1" and also directory named "Dir3". When I build the XML file it seems like the arguments are additive and therefore I don't get the results. See below:

<queryRequest>

 

            <object>                   <query>                         +namespace:VISAMR.Demo2                         +objectPath:"\Dir3\"                         +objectPath:"\Dir1\"                </query>                 <objectProperties>objectPath</objectProperties>             </object></queryRequest>

Is there a way to form the XML so it handles multiple objectPath values ("Dir1" & "Dir3")?

Yury Kats's profile image
Yury Kats

+(objectPath:"\Dir3\"  objectPath:"\Dir1\")

On July 12, 2019 7:29:52 PM Jim Ash <community-noreply@hitachivantara.com>

James Ash's profile image
James Ash

Thanks Yury.

I was able to get POST to successfully query the metadata with the following XML tags:

<queryRequest>

         <object>            <query>               +namespace:"VISAMR.Demo2"                +(objectPath:"/Dir3/" objectPath:"/Dir1/")            </query>            <objectProperties>objectPath</objectProperties>         </object></queryRequest>

My cURL command was this:

    1. curl -k -i -v -H "Authorization: HCP <username>:<password>" -H "Content-Type: application/xml" -H "Accept: application/xml" -d @multiquery.xml "https://visamr.demo2.hcp-demo.hcpdomain.com/query?prettyprint"

Here is the successful response from HCP with only the desired directories listed.

pastedimage_1