I am struggling to get /rest/objects working on ECS via Atmos API.
When I run the following code on Atmos via Atmos API it works fine, it lists all the objects; however, when I run the same query against ECS I get the following error:
<ns2:Error xmlns:ns2="http://www.emc.com/cos/"><Code>1002</Code><Message>One or more arguments in the request were invalid.</Message></ns2:Error>
The script I am using is modified version of the one here:
I can get all the other commands working fine like /rest/objects?listabletags etc... it is only /rest/objects that does not work.
Also I have tried a similar shell script and results are the same
use Digest::SHA qw(hmac_sha1);
my @Time=split(" ",scalar gmtime());
my ($Wkday,$Mon,$Day,$time,$year) = @Time;
my $UTCTime = $Wkday . ", " . $Day . " $Mon" . " $year " . $time . " GMT";
my $SharedSecret = 'xxxx';
my $combinestring = $HostName . $url_atmos_path;
my $HTTPRequestMethod = 'GET';
my $ContentType = "application/octet-stream";
my $Range = "";
my $Date= _MyUTCTime;
my $CanonicalizedResource = '/rest/objects';
my $CanonicalizedEMCHeaders = 'x-emc-date:'.$Date."\n".'x-emc-subtenant-id:'.$Subtenantid."\n".'x-emc-uid:'.$UserID;
my $HashString = $HTTPRequestMethod . "\n" . $ContentType . "\n" . $Range . "\n". "\n".$CanonicalizedResource . "\n" . $CanonicalizedEMCHeaders;
my $DecodedSharedSecret = decode_base64($SharedSecret);
my $EMCSignature= encode_base64($digest, "");
my $cmd = `curl -k -s -v -H "Content-Type:$ContentType" -H "x-emc-date:$Date" -H "x-emc-subtenant-id:$Subtenantid" -H "x-emc-uid:$UserID" -H "x-emc-signature:$EMCSignature" -X GET $combinestring`;
Just to clarify, on ECS I am using 9023 port so that will be the "only" difference. Also, I have tried with and without subtenant-id in the header and same 1002 error occurs in both cases.
In addition, I just tested /rest/namespace query on its own and on Atmos it works fine but on ECS it returns:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns2:Error xmlns:ns2="http://www.emc.com/cos/"><Code>1001</Code><Message>The server encountered an internal error. Please try again.</Message></ns2:E
Same caveats apply i.e. tried with x-emc-subtenant-id header and without... no change.
You're missing the header "x-emc-tags". This selects which listable tag you want to enumerate. See page 102 of the programmer's guide:
Thank you very much for getting back to me.
I was going to add that it works fine if I add x-emc-tags but I do not need to do it on Atmos for it to list all the objects. Therefore I assumed it is not working as intended. Even that API guide does not explicitly say you need to specify a tag... and again for Atmos it works fine.
Having said that, if this is the only way, is there a way to display all items by using a wildcard tag of sorts? If this is the only way ECS will actually display objects, there needs to be a way surely to list them without having to specify all the tags? Especially given the fact that both /namespace and /objects in Atmos list all items fine... Additionally, how would you list objects that are not tagged?
I managed to get /namespace to work... the 1001 error is returned when you just put /rest/namespace but if you put /rest/namespace/
Making yet another difference between Atmos and ECS as for Atmos both /rest/namespace and /rest/namespace/ return all the namesapces without an issue.
I'm curious how you discovered that it was possible to pass x-emc-subtenant-id header in the GET request to list all objects as I've never tried nor knew this call was available. It does in fact work on real Atmos for me too. However, the same call is failing on ECS via Atmos protocol. I've opened an internal JIRA for this inconsistency and will post back to this thread as I hear updates.
I took the "inspiration" from
https://community.emc.com/docs/DOC-27822 - Creating Subtenants on ECS
Then basically trial and error and I got it working on Atmos but I cannot get it working on ECS...
So originally, I was working with this Bash/Python script and made it work but I then I found the aforementioned PERL script and I can get Atmos to work with both and ECS with neither...