You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cloudstack.apache.org by to...@163.com on 2015/07/31 13:07:41 UTC

new timestamp format for API in ACS 4.5.1

Hi,

     was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"


/    I found it in 4.5.0 API doc, but it seems not enabled.

http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html

     >>> api.listEvents(startdate="2015-07-31 13:00:00")
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "call.py", line 48, in handlerFunction
     return self._make_request(name, kwargs)
   File "call.py", line 60, in _make_request
     data = self._http_get(self.value)
   File "call.py", line 53, in _http_get
     response = urllib.urlopen(url)
   File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
     return opener.open(url)
   File "/usr/lib64/python2.7/urllib.py", line 208, in open
     return getattr(self, name)(url)
   File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
     return self.http_error(url, fp, errcode, errmsg, headers)
   File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
     result = method(url, fp, errcode, errmsg, headers)
   File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
     errcode, errmsg, headers)
   File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
     raise IOError, ('http error', errcode, errmsg, headers)
IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
instance at 0x16dca70>)
 >>>


my ACS version:

[root@cs ~]# rpm -qa |grep cloud
cloudstack-management-4.5.1-shapeblue0.el6.x86_64
cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
cloudstack-common-4.5.1-shapeblue0.el6.x86_64


-- 
-----------
Cao Tong


Fwd: Re: new timestamp format for API in ACS 4.5.1

Posted by to...@163.com.
Copy thread from @users, as I am not sure where is the right place to 
find right people for helping.


-------- Forwarded Message --------
Subject: 	Re: new timestamp format for API in ACS 4.5.1
Date: 	Tue, 18 Aug 2015 18:04:56 +0800
From: 	tony_caotong@163.com
Reply-To: 	users@cloudstack.apache.org
To: 	users@cloudstack.apache.org



In ParamProcessWorker::setFieldValue() I found this lins:

            case DATE:
                 // This piece of code is for maintaining backward
compatibility
                 // and support both the date formats(Bug 9724)

Is it related to my problem?  Where can I found the descriptions about
BUG9724 ?

-----------
Cao Tong

On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>
> Hello,
>
> When I use timestamp format startdate="2015-07-31", it works find.
> When I use it like this startdate="2015-07-31 13:00:00".
> It return a error
> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
> instance at 0x16dca70>)
>
> Could anyone tell me why ?
>
> I have read the code "DefaultLoginAPIAuthenticatorCmd::authenticate()"
> , but I am still not understand what was happening,
> it seems authenticate failed, but why??
>
> -----------
> Cao Tong
>
> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>
>> Hi,
>>
>>     was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>>
>>
>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>
>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>
>>     >>> api.listEvents(startdate="2015-07-31 13:00:00")
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>>   File "call.py", line 48, in handlerFunction
>>     return self._make_request(name, kwargs)
>>   File "call.py", line 60, in _make_request
>>     data = self._http_get(self.value)
>>   File "call.py", line 53, in _http_get
>>     response = urllib.urlopen(url)
>>   File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>     return opener.open(url)
>>   File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>     return getattr(self, name)(url)
>>   File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>     return self.http_error(url, fp, errcode, errmsg, headers)
>>   File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>     result = method(url, fp, errcode, errmsg, headers)
>>   File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>     errcode, errmsg, headers)
>>   File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>     raise IOError, ('http error', errcode, errmsg, headers)
>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>> instance at 0x16dca70>)
>> >>>
>>
>>
>> my ACS version:
>>
>> [root@cs ~]# rpm -qa |grep cloud
>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>
>>
>
>





Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by to...@163.com.
Hi, sorry for replying late since weekend.

Snthosh, this patch works for me and thanks.

It modified like this:

29c29,32
<             self.params.append(key + '=' + urllib.quote_plus(args[key]))
---
 >             if key == "startdate" or key == "enddate":
 >                 self.params.append(key + '=' + 
str.lower(urllib.quote_plus(args[key])).replace("+", "%20"))
 >             else:
 >                 self.params.append(key + '=' + 
urllib.quote_plus(args[key]))

Following command works find.
api.listEvents(listall='true', startdate='2015-08-24 11:00:00', 
enddate='2015-08-24 13:00:00')


My cloudstack version :
cloudstack-management-4.4.4-shapeblue0.el6.x86_64
cloudstack-awsapi-4.4.4-shapeblue0.el6.x86_64
cloudstack-agent-4.4.4-shapeblue0.el6.x86_64
cloudstack-common-4.4.4-shapeblue0.el6.x86_64


Wish it's helpfull for more detection, as I knew V4.5.1 is the same.

-----------
Cao Tong

On 08/28/2015 07:31 PM, Abhinandan Prateek wrote:
> Good catch Santhosh !
> I had similar issue passing a space in ‘account name’.
>
>> On 28-Aug-2015, at 2:51 pm, Santhosh Edukulla <sa...@gmail.com> wrote:
>>
>> Hi Cao,
>>
>> Inside "_sort_request" function mentioned at the wiki,  change the below
>> line
>>
>> self.params.append(key + '=' + urllib.quote_plus(args[key]))
>>
>> to
>>
>> self.params.append( key + '=' + str.lower(urllib.quote_plus(args[key])).
>> *replace(**"+", "%20") *)
>>
>> The time stamp parameter "2015-08-28 16:20:00" , you are passing has a
>> space in it, which gets replaced with "+" through quote_plus logic, so
>> replace that "+" with "%20", this is getting passed in calculating
>> signature in later function.
>>
>> Similarly, change it for "_build_post_request" function.
>>
>> Let us know.
>>
>> Regards,
>> Santhosh
>>
>> On Fri, Aug 28, 2015 at 6:40 PM, <to...@163.com> wrote:
>>
>>>
>>> My scripts is just from cloudstack website
>>>
>>> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Simple+class+for+making+API+calls%2C+Python
>>>
>>> and I just do some testing like this:
>>>
>>> 1. >>> from SignedAPICall import api
>>> 2. >>> api.listEvents(listall='true', startdate='2015-08-28')
>>> 3. >>> api.listEvents(listall='true', startdate='2015-08-28 16:20:00')
>>>
>>> Line 2 works fine, line 3 failed with error " 'http error', 401,
>>> 'Unauthorized' ".
>>>
>>> I also do some other tests, they also works fine, like api.listHosts()
>>> api.listVirtualMachines().
>>>
>>> when line 3 failed,  management-server.log said this:
>>>
>>> 2015-08-28 16:37:53,619 DEBUG [c.c.a.ApiServlet]
>>> (catalina-exec-15:ctx-4e587804) ===START===  10.0.1.99 -- GET
>>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
>>> 2015-08-28 16:37:53,622 INFO  [c.c.a.ApiServer]
>>> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) User signature:
>>> r7wa861jYWP4QbNMeEjZZ2wNpIc= is not equaled to computed signature:
>>> 4c8Kmn+cbMZAmfSvSISPkWt9WCQ=
>>> 2015-08-28 16:37:53,622 DEBUG [c.c.a.ApiServlet]
>>> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) ===END===  10.0.1.99 -- GET
>>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
>>>
>>> following for line 2:
>>> 2015-08-28 16:37:15,900 DEBUG [c.c.a.ApiServlet]
>>> (catalina-exec-13:ctx-f8019189) ===START===  10.0.1.99 -- GET
>>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
>>> 2015-08-28 16:37:15,939 DEBUG [c.c.a.ApiServlet]
>>> (catalina-exec-13:ctx-f8019189 ctx-c42b8c5e ctx-1ebbe226) ===END===
>>> 10.0.1.99 -- GET
>>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
>>>
>>>
>>>
>>> -----------
>>> Cao Tong
>>>
>>>
>>> On 08/28/2015 02:09 PM, Abhinandan Prateek wrote:
>>>
>>>> apikey/signature should work and they have same privileges as the
>>>> respective user logged in.
>>>> Are all the api calls failing or just some ?
>>>> Can you share relevant portion of the scripts that you are trying to run ?
>>>>
>>>> On 28-Aug-2015, at 11:31 am, tony_caotong@163.com wrote:
>>>>>
>>>>> Thanks for all your people's replys.
>>>>>
>>>>> 1.  Abhinandan,  My ACS manager was not listening on port '8096',
>>>>>
>>>>> 2.  As Yipeng said, When I call this api from cloudmonkey, it works
>>>>> fine, like this
>>>>>     " cloudmonkey api listEvents listall=true startdate='2015-08-28
>>>>> 00:00:00' "
>>>>>
>>>>>     When I call it through my python scripts, I used the
>>>>> apikey/signature pair to work,  but it failed.
>>>>>     I found that how cloudmonkey works,
>>>>>     first it login with username/password, then call the function with
>>>>> this session id.
>>>>>
>>>>> it seems that the apikey/signature pair's privilege is not same with
>>>>> username/password pair's ?
>>>>>
>>>>>
>>>>> @Daan, yes I am a Chinese. I am afraid it's not a preblem about
>>>>> character encodings perhaps.
>>>>>
>>>>>
>>>>> -----------
>>>>> Cao Tong
>>>>>
>>>>> On 08/27/2015 08:54 PM, Abhinandan Prateek wrote:
>>>>>
>>>>>> Try using the “8096” port for testing/checking APIs.
>>>>>>
>>>>>> shapeblue.com> wrote:
>>>>>>
>>>>>>> Yes, as per
>>>>>>> https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>>>>>>
>>>>>>>
>>>>>>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>>>>>>> Hello Every.
>>>>>>>>
>>>>>>>> I know this is a very simple question to most of you. but it is
>>>>>>>> really hard for me to continue my work.
>>>>>>>>
>>>>>>>> So could Anyone spend your three minutes to give me some advice, it
>>>>>>>> will be very usefull to me.
>>>>>>>>
>>>>>>>> my question is:
>>>>>>>>
>>>>>>>>    How does the parameter startdate/enddate of api listEvents() use
>>>>>>>> new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>>>>>>>
>>>>>>>>
>>>>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>>>>>>>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>>>>>>>> Traceback (most recent call last):
>>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>>> File "SignedAPICall.py", line 67, in Event
>>>>>>>>    a = api.listEvents(request)
>>>>>>>> File "SignedAPICall.py", line 49, in handlerFunction
>>>>>>>>    return self._make_request(name, args[0])
>>>>>>>> File "SignedAPICall.py", line 61, in _make_request
>>>>>>>>    data = self._http_get(self.value)
>>>>>>>> File "SignedAPICall.py", line 54, in _http_get
>>>>>>>>    response = urllib.urlopen(url)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>>    return opener.open(url)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>>    return getattr(self, name)(url)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>>    errcode, errmsg, headers)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>> instance at 0x7f083da78998>)
>>>>>>>>
>>>>>>>> -----------
>>>>>>>> Cao Tong
>>>>>>>>
>>>>>>>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>>>>>>
>>>>>>>>> Hi All:
>>>>>>>>>
>>>>>>>>>    Does any one have any idea ? Thanks.
>>>>>>>>>
>>>>>>>>> -----------
>>>>>>>>> Cao Tong
>>>>>>>>>
>>>>>>>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>>>>>>
>>>>>>>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>>>>>>>
>>>>>>>>>>           case DATE:
>>>>>>>>>>                // This piece of code is for maintaining backward
>>>>>>>>>> compatibility
>>>>>>>>>>                // and support both the date formats(Bug 9724)
>>>>>>>>>>
>>>>>>>>>> Is it related to my problem?  Where can I found the descriptions
>>>>>>>>>> about BUG9724 ?
>>>>>>>>>>
>>>>>>>>>> -----------
>>>>>>>>>> Cao Tong
>>>>>>>>>>
>>>>>>>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>>>>>>
>>>>>>>>>>> Hello,
>>>>>>>>>>>
>>>>>>>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>>>>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>>>>>>>> It return a error
>>>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>>>
>>>>>>>>>>> Could anyone tell me why ?
>>>>>>>>>>>
>>>>>>>>>>> I have read the code
>>>>>>>>>>> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not
>>>>>>>>>>> understand what was happening,
>>>>>>>>>>> it seems authenticate failed, but why??
>>>>>>>>>>>
>>>>>>>>>>> -----------
>>>>>>>>>>> Cao Tong
>>>>>>>>>>>
>>>>>>>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd
>>>>>>>>>>>> HH:mm:ss"
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>>>>>>>
>>>>>>>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>>>>>>>
>>>>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>>>>>>>>>> Traceback (most recent call last):
>>>>>>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>>>>>>>    return self._make_request(name, kwargs)
>>>>>>>>>>>> File "call.py", line 60, in _make_request
>>>>>>>>>>>>    data = self._http_get(self.value)
>>>>>>>>>>>> File "call.py", line 53, in _http_get
>>>>>>>>>>>>    response = urllib.urlopen(url)
>>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>>>>>>    return opener.open(url)
>>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>>>>>>    return getattr(self, name)(url)
>>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>>>>>>    errcode, errmsg, headers)
>>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in
>>>>>>>>>>>> http_error_default
>>>>>>>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>>>>
>>>>>>>>>>>> my ACS version:
>>>>>>>>>>>>
>>>>>>>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>>>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>>>>> services
>>>>>>>
>>>>>>> IaaS Cloud Design & Build<
>>>>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>>>>> CSForge – rapid IaaS deployment framework<
>>>>>>> http://shapeblue.com/csforge/>
>>>>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>>>>> CloudStack Software Engineering<
>>>>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>>>>> CloudStack Infrastructure Support<
>>>>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>>>>> CloudStack Bootcamp Training Courses<
>>>>>>> http://shapeblue.com/cloudstack-training/>
>>>>>>>
>>>>>>> This email and any attachments to it may be confidential and are
>>>>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>>>>> views or opinions expressed are solely those of the author and do not
>>>>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>>>>> are not the intended recipient of this email, you must neither take any
>>>>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>>>>> contact the sender if you believe you have received this email in error.
>>>>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>>>>> Services India LLP is a company incorporated in India and is operated under
>>>>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>>>>> company incorporated in Brasil and is operated under license from Shape
>>>>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>>>>> a registered trademark.
>>>>>>>
>>>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>>>> services
>>>>>>
>>>>>> IaaS Cloud Design & Build<
>>>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/
>>>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>>>> CloudStack Software Engineering<
>>>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>>>> CloudStack Infrastructure Support<
>>>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>>>> CloudStack Bootcamp Training Courses<
>>>>>> http://shapeblue.com/cloudstack-training/>
>>>>>>
>>>>>> This email and any attachments to it may be confidential and are
>>>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>>>> views or opinions expressed are solely those of the author and do not
>>>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>>>> are not the intended recipient of this email, you must neither take any
>>>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>>>> contact the sender if you believe you have received this email in error.
>>>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>>>> Services India LLP is a company incorporated in India and is operated under
>>>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>>>> company incorporated in Brasil and is operated under license from Shape
>>>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>>>> a registered trademark.
>>>>>>
>>>>>
>>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>> services
>>>>
>>>> IaaS Cloud Design & Build<
>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>> CloudStack Software Engineering<
>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>> CloudStack Infrastructure Support<
>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>> CloudStack Bootcamp Training Courses<
>>>> http://shapeblue.com/cloudstack-training/>
>>>>
>>>> This email and any attachments to it may be confidential and are intended
>>>> solely for the use of the individual to whom it is addressed. Any views or
>>>> opinions expressed are solely those of the author and do not necessarily
>>>> represent those of Shape Blue Ltd or related companies. If you are not the
>>>> intended recipient of this email, you must neither take any action based
>>>> upon its contents, nor copy or show it to anyone. Please contact the sender
>>>> if you believe you have received this email in error. Shape Blue Ltd is a
>>>> company incorporated in England & Wales. ShapeBlue Services India LLP is a
>>>> company incorporated in India and is operated under license from Shape Blue
>>>> Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil
>>>> and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is
>>>> a company registered by The Republic of South Africa and is traded under
>>>> license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>>>>
>>>
>>>
>>>
> Find out more about ShapeBlue and our range of CloudStack related services
>
> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>
> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.




Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by to...@163.com.
Hi, sorry for replying late since weekend.

Snthosh, this patch works for me and thanks.

It modified like this:

29c29,32
<             self.params.append(key + '=' + urllib.quote_plus(args[key]))
---
 >             if key == "startdate" or key == "enddate":
 >                 self.params.append(key + '=' + 
str.lower(urllib.quote_plus(args[key])).replace("+", "%20"))
 >             else:
 >                 self.params.append(key + '=' + 
urllib.quote_plus(args[key]))

Following command works find.
api.listEvents(listall='true', startdate='2015-08-24 11:00:00', 
enddate='2015-08-24 13:00:00')


My cloudstack version :
cloudstack-management-4.4.4-shapeblue0.el6.x86_64
cloudstack-awsapi-4.4.4-shapeblue0.el6.x86_64
cloudstack-agent-4.4.4-shapeblue0.el6.x86_64
cloudstack-common-4.4.4-shapeblue0.el6.x86_64


Wish it's helpfull for more detection, as I knew V4.5.1 is the same.

-----------
Cao Tong

On 08/28/2015 07:31 PM, Abhinandan Prateek wrote:
> Good catch Santhosh !
> I had similar issue passing a space in ‘account name’.
>
>> On 28-Aug-2015, at 2:51 pm, Santhosh Edukulla <sa...@gmail.com> wrote:
>>
>> Hi Cao,
>>
>> Inside "_sort_request" function mentioned at the wiki,  change the below
>> line
>>
>> self.params.append(key + '=' + urllib.quote_plus(args[key]))
>>
>> to
>>
>> self.params.append( key + '=' + str.lower(urllib.quote_plus(args[key])).
>> *replace(**"+", "%20") *)
>>
>> The time stamp parameter "2015-08-28 16:20:00" , you are passing has a
>> space in it, which gets replaced with "+" through quote_plus logic, so
>> replace that "+" with "%20", this is getting passed in calculating
>> signature in later function.
>>
>> Similarly, change it for "_build_post_request" function.
>>
>> Let us know.
>>
>> Regards,
>> Santhosh
>>
>> On Fri, Aug 28, 2015 at 6:40 PM, <to...@163.com> wrote:
>>
>>>
>>> My scripts is just from cloudstack website
>>>
>>> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Simple+class+for+making+API+calls%2C+Python
>>>
>>> and I just do some testing like this:
>>>
>>> 1. >>> from SignedAPICall import api
>>> 2. >>> api.listEvents(listall='true', startdate='2015-08-28')
>>> 3. >>> api.listEvents(listall='true', startdate='2015-08-28 16:20:00')
>>>
>>> Line 2 works fine, line 3 failed with error " 'http error', 401,
>>> 'Unauthorized' ".
>>>
>>> I also do some other tests, they also works fine, like api.listHosts()
>>> api.listVirtualMachines().
>>>
>>> when line 3 failed,  management-server.log said this:
>>>
>>> 2015-08-28 16:37:53,619 DEBUG [c.c.a.ApiServlet]
>>> (catalina-exec-15:ctx-4e587804) ===START===  10.0.1.99 -- GET
>>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
>>> 2015-08-28 16:37:53,622 INFO  [c.c.a.ApiServer]
>>> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) User signature:
>>> r7wa861jYWP4QbNMeEjZZ2wNpIc= is not equaled to computed signature:
>>> 4c8Kmn+cbMZAmfSvSISPkWt9WCQ=
>>> 2015-08-28 16:37:53,622 DEBUG [c.c.a.ApiServlet]
>>> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) ===END===  10.0.1.99 -- GET
>>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
>>>
>>> following for line 2:
>>> 2015-08-28 16:37:15,900 DEBUG [c.c.a.ApiServlet]
>>> (catalina-exec-13:ctx-f8019189) ===START===  10.0.1.99 -- GET
>>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
>>> 2015-08-28 16:37:15,939 DEBUG [c.c.a.ApiServlet]
>>> (catalina-exec-13:ctx-f8019189 ctx-c42b8c5e ctx-1ebbe226) ===END===
>>> 10.0.1.99 -- GET
>>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
>>>
>>>
>>>
>>> -----------
>>> Cao Tong
>>>
>>>
>>> On 08/28/2015 02:09 PM, Abhinandan Prateek wrote:
>>>
>>>> apikey/signature should work and they have same privileges as the
>>>> respective user logged in.
>>>> Are all the api calls failing or just some ?
>>>> Can you share relevant portion of the scripts that you are trying to run ?
>>>>
>>>> On 28-Aug-2015, at 11:31 am, tony_caotong@163.com wrote:
>>>>>
>>>>> Thanks for all your people's replys.
>>>>>
>>>>> 1.  Abhinandan,  My ACS manager was not listening on port '8096',
>>>>>
>>>>> 2.  As Yipeng said, When I call this api from cloudmonkey, it works
>>>>> fine, like this
>>>>>     " cloudmonkey api listEvents listall=true startdate='2015-08-28
>>>>> 00:00:00' "
>>>>>
>>>>>     When I call it through my python scripts, I used the
>>>>> apikey/signature pair to work,  but it failed.
>>>>>     I found that how cloudmonkey works,
>>>>>     first it login with username/password, then call the function with
>>>>> this session id.
>>>>>
>>>>> it seems that the apikey/signature pair's privilege is not same with
>>>>> username/password pair's ?
>>>>>
>>>>>
>>>>> @Daan, yes I am a Chinese. I am afraid it's not a preblem about
>>>>> character encodings perhaps.
>>>>>
>>>>>
>>>>> -----------
>>>>> Cao Tong
>>>>>
>>>>> On 08/27/2015 08:54 PM, Abhinandan Prateek wrote:
>>>>>
>>>>>> Try using the “8096” port for testing/checking APIs.
>>>>>>
>>>>>> shapeblue.com> wrote:
>>>>>>
>>>>>>> Yes, as per
>>>>>>> https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>>>>>>
>>>>>>>
>>>>>>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>>>>>>> Hello Every.
>>>>>>>>
>>>>>>>> I know this is a very simple question to most of you. but it is
>>>>>>>> really hard for me to continue my work.
>>>>>>>>
>>>>>>>> So could Anyone spend your three minutes to give me some advice, it
>>>>>>>> will be very usefull to me.
>>>>>>>>
>>>>>>>> my question is:
>>>>>>>>
>>>>>>>>    How does the parameter startdate/enddate of api listEvents() use
>>>>>>>> new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>>>>>>>
>>>>>>>>
>>>>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>>>>>>>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>>>>>>>> Traceback (most recent call last):
>>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>>> File "SignedAPICall.py", line 67, in Event
>>>>>>>>    a = api.listEvents(request)
>>>>>>>> File "SignedAPICall.py", line 49, in handlerFunction
>>>>>>>>    return self._make_request(name, args[0])
>>>>>>>> File "SignedAPICall.py", line 61, in _make_request
>>>>>>>>    data = self._http_get(self.value)
>>>>>>>> File "SignedAPICall.py", line 54, in _http_get
>>>>>>>>    response = urllib.urlopen(url)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>>    return opener.open(url)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>>    return getattr(self, name)(url)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>>    errcode, errmsg, headers)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>> instance at 0x7f083da78998>)
>>>>>>>>
>>>>>>>> -----------
>>>>>>>> Cao Tong
>>>>>>>>
>>>>>>>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>>>>>>
>>>>>>>>> Hi All:
>>>>>>>>>
>>>>>>>>>    Does any one have any idea ? Thanks.
>>>>>>>>>
>>>>>>>>> -----------
>>>>>>>>> Cao Tong
>>>>>>>>>
>>>>>>>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>>>>>>
>>>>>>>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>>>>>>>
>>>>>>>>>>           case DATE:
>>>>>>>>>>                // This piece of code is for maintaining backward
>>>>>>>>>> compatibility
>>>>>>>>>>                // and support both the date formats(Bug 9724)
>>>>>>>>>>
>>>>>>>>>> Is it related to my problem?  Where can I found the descriptions
>>>>>>>>>> about BUG9724 ?
>>>>>>>>>>
>>>>>>>>>> -----------
>>>>>>>>>> Cao Tong
>>>>>>>>>>
>>>>>>>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>>>>>>
>>>>>>>>>>> Hello,
>>>>>>>>>>>
>>>>>>>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>>>>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>>>>>>>> It return a error
>>>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>>>
>>>>>>>>>>> Could anyone tell me why ?
>>>>>>>>>>>
>>>>>>>>>>> I have read the code
>>>>>>>>>>> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not
>>>>>>>>>>> understand what was happening,
>>>>>>>>>>> it seems authenticate failed, but why??
>>>>>>>>>>>
>>>>>>>>>>> -----------
>>>>>>>>>>> Cao Tong
>>>>>>>>>>>
>>>>>>>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd
>>>>>>>>>>>> HH:mm:ss"
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>>>>>>>
>>>>>>>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>>>>>>>
>>>>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>>>>>>>>>> Traceback (most recent call last):
>>>>>>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>>>>>>>    return self._make_request(name, kwargs)
>>>>>>>>>>>> File "call.py", line 60, in _make_request
>>>>>>>>>>>>    data = self._http_get(self.value)
>>>>>>>>>>>> File "call.py", line 53, in _http_get
>>>>>>>>>>>>    response = urllib.urlopen(url)
>>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>>>>>>    return opener.open(url)
>>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>>>>>>    return getattr(self, name)(url)
>>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>>>>>>    errcode, errmsg, headers)
>>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in
>>>>>>>>>>>> http_error_default
>>>>>>>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>>>>
>>>>>>>>>>>> my ACS version:
>>>>>>>>>>>>
>>>>>>>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>>>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>>>>> services
>>>>>>>
>>>>>>> IaaS Cloud Design & Build<
>>>>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>>>>> CSForge – rapid IaaS deployment framework<
>>>>>>> http://shapeblue.com/csforge/>
>>>>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>>>>> CloudStack Software Engineering<
>>>>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>>>>> CloudStack Infrastructure Support<
>>>>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>>>>> CloudStack Bootcamp Training Courses<
>>>>>>> http://shapeblue.com/cloudstack-training/>
>>>>>>>
>>>>>>> This email and any attachments to it may be confidential and are
>>>>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>>>>> views or opinions expressed are solely those of the author and do not
>>>>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>>>>> are not the intended recipient of this email, you must neither take any
>>>>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>>>>> contact the sender if you believe you have received this email in error.
>>>>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>>>>> Services India LLP is a company incorporated in India and is operated under
>>>>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>>>>> company incorporated in Brasil and is operated under license from Shape
>>>>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>>>>> a registered trademark.
>>>>>>>
>>>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>>>> services
>>>>>>
>>>>>> IaaS Cloud Design & Build<
>>>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/
>>>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>>>> CloudStack Software Engineering<
>>>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>>>> CloudStack Infrastructure Support<
>>>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>>>> CloudStack Bootcamp Training Courses<
>>>>>> http://shapeblue.com/cloudstack-training/>
>>>>>>
>>>>>> This email and any attachments to it may be confidential and are
>>>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>>>> views or opinions expressed are solely those of the author and do not
>>>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>>>> are not the intended recipient of this email, you must neither take any
>>>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>>>> contact the sender if you believe you have received this email in error.
>>>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>>>> Services India LLP is a company incorporated in India and is operated under
>>>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>>>> company incorporated in Brasil and is operated under license from Shape
>>>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>>>> a registered trademark.
>>>>>>
>>>>>
>>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>> services
>>>>
>>>> IaaS Cloud Design & Build<
>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>> CloudStack Software Engineering<
>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>> CloudStack Infrastructure Support<
>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>> CloudStack Bootcamp Training Courses<
>>>> http://shapeblue.com/cloudstack-training/>
>>>>
>>>> This email and any attachments to it may be confidential and are intended
>>>> solely for the use of the individual to whom it is addressed. Any views or
>>>> opinions expressed are solely those of the author and do not necessarily
>>>> represent those of Shape Blue Ltd or related companies. If you are not the
>>>> intended recipient of this email, you must neither take any action based
>>>> upon its contents, nor copy or show it to anyone. Please contact the sender
>>>> if you believe you have received this email in error. Shape Blue Ltd is a
>>>> company incorporated in England & Wales. ShapeBlue Services India LLP is a
>>>> company incorporated in India and is operated under license from Shape Blue
>>>> Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil
>>>> and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is
>>>> a company registered by The Republic of South Africa and is traded under
>>>> license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>>>>
>>>
>>>
>>>
> Find out more about ShapeBlue and our range of CloudStack related services
>
> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>
> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.




Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by to...@163.com.
Hi, sorry for replying late since weekend.

Snthosh, this patch works for me and thanks.

It modified like this:

29c29,32
<             self.params.append(key + '=' + urllib.quote_plus(args[key]))
---
 >             if key == "startdate" or key == "enddate":
 >                 self.params.append(key + '=' + 
str.lower(urllib.quote_plus(args[key])).replace("+", "%20"))
 >             else:
 >                 self.params.append(key + '=' + 
urllib.quote_plus(args[key]))

Following command works find.
api.listEvents(listall='true', startdate='2015-08-24 11:00:00', 
enddate='2015-08-24 13:00:00')


My cloudstack version :
cloudstack-management-4.4.4-shapeblue0.el6.x86_64
cloudstack-awsapi-4.4.4-shapeblue0.el6.x86_64
cloudstack-agent-4.4.4-shapeblue0.el6.x86_64
cloudstack-common-4.4.4-shapeblue0.el6.x86_64


Wish it's helpfull for more detection, as I knew V4.5.1 is the same.

-----------
Cao Tong

On 08/28/2015 07:31 PM, Abhinandan Prateek wrote:
> Good catch Santhosh !
> I had similar issue passing a space in ‘account name’.
>
>> On 28-Aug-2015, at 2:51 pm, Santhosh Edukulla <sa...@gmail.com> wrote:
>>
>> Hi Cao,
>>
>> Inside "_sort_request" function mentioned at the wiki,  change the below
>> line
>>
>> self.params.append(key + '=' + urllib.quote_plus(args[key]))
>>
>> to
>>
>> self.params.append( key + '=' + str.lower(urllib.quote_plus(args[key])).
>> *replace(**"+", "%20") *)
>>
>> The time stamp parameter "2015-08-28 16:20:00" , you are passing has a
>> space in it, which gets replaced with "+" through quote_plus logic, so
>> replace that "+" with "%20", this is getting passed in calculating
>> signature in later function.
>>
>> Similarly, change it for "_build_post_request" function.
>>
>> Let us know.
>>
>> Regards,
>> Santhosh
>>
>> On Fri, Aug 28, 2015 at 6:40 PM, <to...@163.com> wrote:
>>
>>>
>>> My scripts is just from cloudstack website
>>>
>>> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Simple+class+for+making+API+calls%2C+Python
>>>
>>> and I just do some testing like this:
>>>
>>> 1. >>> from SignedAPICall import api
>>> 2. >>> api.listEvents(listall='true', startdate='2015-08-28')
>>> 3. >>> api.listEvents(listall='true', startdate='2015-08-28 16:20:00')
>>>
>>> Line 2 works fine, line 3 failed with error " 'http error', 401,
>>> 'Unauthorized' ".
>>>
>>> I also do some other tests, they also works fine, like api.listHosts()
>>> api.listVirtualMachines().
>>>
>>> when line 3 failed,  management-server.log said this:
>>>
>>> 2015-08-28 16:37:53,619 DEBUG [c.c.a.ApiServlet]
>>> (catalina-exec-15:ctx-4e587804) ===START===  10.0.1.99 -- GET
>>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
>>> 2015-08-28 16:37:53,622 INFO  [c.c.a.ApiServer]
>>> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) User signature:
>>> r7wa861jYWP4QbNMeEjZZ2wNpIc= is not equaled to computed signature:
>>> 4c8Kmn+cbMZAmfSvSISPkWt9WCQ=
>>> 2015-08-28 16:37:53,622 DEBUG [c.c.a.ApiServlet]
>>> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) ===END===  10.0.1.99 -- GET
>>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
>>>
>>> following for line 2:
>>> 2015-08-28 16:37:15,900 DEBUG [c.c.a.ApiServlet]
>>> (catalina-exec-13:ctx-f8019189) ===START===  10.0.1.99 -- GET
>>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
>>> 2015-08-28 16:37:15,939 DEBUG [c.c.a.ApiServlet]
>>> (catalina-exec-13:ctx-f8019189 ctx-c42b8c5e ctx-1ebbe226) ===END===
>>> 10.0.1.99 -- GET
>>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
>>>
>>>
>>>
>>> -----------
>>> Cao Tong
>>>
>>>
>>> On 08/28/2015 02:09 PM, Abhinandan Prateek wrote:
>>>
>>>> apikey/signature should work and they have same privileges as the
>>>> respective user logged in.
>>>> Are all the api calls failing or just some ?
>>>> Can you share relevant portion of the scripts that you are trying to run ?
>>>>
>>>> On 28-Aug-2015, at 11:31 am, tony_caotong@163.com wrote:
>>>>>
>>>>> Thanks for all your people's replys.
>>>>>
>>>>> 1.  Abhinandan,  My ACS manager was not listening on port '8096',
>>>>>
>>>>> 2.  As Yipeng said, When I call this api from cloudmonkey, it works
>>>>> fine, like this
>>>>>     " cloudmonkey api listEvents listall=true startdate='2015-08-28
>>>>> 00:00:00' "
>>>>>
>>>>>     When I call it through my python scripts, I used the
>>>>> apikey/signature pair to work,  but it failed.
>>>>>     I found that how cloudmonkey works,
>>>>>     first it login with username/password, then call the function with
>>>>> this session id.
>>>>>
>>>>> it seems that the apikey/signature pair's privilege is not same with
>>>>> username/password pair's ?
>>>>>
>>>>>
>>>>> @Daan, yes I am a Chinese. I am afraid it's not a preblem about
>>>>> character encodings perhaps.
>>>>>
>>>>>
>>>>> -----------
>>>>> Cao Tong
>>>>>
>>>>> On 08/27/2015 08:54 PM, Abhinandan Prateek wrote:
>>>>>
>>>>>> Try using the “8096” port for testing/checking APIs.
>>>>>>
>>>>>> shapeblue.com> wrote:
>>>>>>
>>>>>>> Yes, as per
>>>>>>> https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>>>>>>
>>>>>>>
>>>>>>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>>>>>>> Hello Every.
>>>>>>>>
>>>>>>>> I know this is a very simple question to most of you. but it is
>>>>>>>> really hard for me to continue my work.
>>>>>>>>
>>>>>>>> So could Anyone spend your three minutes to give me some advice, it
>>>>>>>> will be very usefull to me.
>>>>>>>>
>>>>>>>> my question is:
>>>>>>>>
>>>>>>>>    How does the parameter startdate/enddate of api listEvents() use
>>>>>>>> new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>>>>>>>
>>>>>>>>
>>>>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>>>>>>>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>>>>>>>> Traceback (most recent call last):
>>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>>> File "SignedAPICall.py", line 67, in Event
>>>>>>>>    a = api.listEvents(request)
>>>>>>>> File "SignedAPICall.py", line 49, in handlerFunction
>>>>>>>>    return self._make_request(name, args[0])
>>>>>>>> File "SignedAPICall.py", line 61, in _make_request
>>>>>>>>    data = self._http_get(self.value)
>>>>>>>> File "SignedAPICall.py", line 54, in _http_get
>>>>>>>>    response = urllib.urlopen(url)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>>    return opener.open(url)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>>    return getattr(self, name)(url)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>>    errcode, errmsg, headers)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>> instance at 0x7f083da78998>)
>>>>>>>>
>>>>>>>> -----------
>>>>>>>> Cao Tong
>>>>>>>>
>>>>>>>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>>>>>>
>>>>>>>>> Hi All:
>>>>>>>>>
>>>>>>>>>    Does any one have any idea ? Thanks.
>>>>>>>>>
>>>>>>>>> -----------
>>>>>>>>> Cao Tong
>>>>>>>>>
>>>>>>>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>>>>>>
>>>>>>>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>>>>>>>
>>>>>>>>>>           case DATE:
>>>>>>>>>>                // This piece of code is for maintaining backward
>>>>>>>>>> compatibility
>>>>>>>>>>                // and support both the date formats(Bug 9724)
>>>>>>>>>>
>>>>>>>>>> Is it related to my problem?  Where can I found the descriptions
>>>>>>>>>> about BUG9724 ?
>>>>>>>>>>
>>>>>>>>>> -----------
>>>>>>>>>> Cao Tong
>>>>>>>>>>
>>>>>>>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>>>>>>
>>>>>>>>>>> Hello,
>>>>>>>>>>>
>>>>>>>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>>>>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>>>>>>>> It return a error
>>>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>>>
>>>>>>>>>>> Could anyone tell me why ?
>>>>>>>>>>>
>>>>>>>>>>> I have read the code
>>>>>>>>>>> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not
>>>>>>>>>>> understand what was happening,
>>>>>>>>>>> it seems authenticate failed, but why??
>>>>>>>>>>>
>>>>>>>>>>> -----------
>>>>>>>>>>> Cao Tong
>>>>>>>>>>>
>>>>>>>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd
>>>>>>>>>>>> HH:mm:ss"
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>>>>>>>
>>>>>>>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>>>>>>>
>>>>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>>>>>>>>>> Traceback (most recent call last):
>>>>>>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>>>>>>>    return self._make_request(name, kwargs)
>>>>>>>>>>>> File "call.py", line 60, in _make_request
>>>>>>>>>>>>    data = self._http_get(self.value)
>>>>>>>>>>>> File "call.py", line 53, in _http_get
>>>>>>>>>>>>    response = urllib.urlopen(url)
>>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>>>>>>    return opener.open(url)
>>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>>>>>>    return getattr(self, name)(url)
>>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>>>>>>    errcode, errmsg, headers)
>>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in
>>>>>>>>>>>> http_error_default
>>>>>>>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>>>>
>>>>>>>>>>>> my ACS version:
>>>>>>>>>>>>
>>>>>>>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>>>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>>>>> services
>>>>>>>
>>>>>>> IaaS Cloud Design & Build<
>>>>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>>>>> CSForge – rapid IaaS deployment framework<
>>>>>>> http://shapeblue.com/csforge/>
>>>>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>>>>> CloudStack Software Engineering<
>>>>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>>>>> CloudStack Infrastructure Support<
>>>>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>>>>> CloudStack Bootcamp Training Courses<
>>>>>>> http://shapeblue.com/cloudstack-training/>
>>>>>>>
>>>>>>> This email and any attachments to it may be confidential and are
>>>>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>>>>> views or opinions expressed are solely those of the author and do not
>>>>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>>>>> are not the intended recipient of this email, you must neither take any
>>>>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>>>>> contact the sender if you believe you have received this email in error.
>>>>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>>>>> Services India LLP is a company incorporated in India and is operated under
>>>>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>>>>> company incorporated in Brasil and is operated under license from Shape
>>>>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>>>>> a registered trademark.
>>>>>>>
>>>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>>>> services
>>>>>>
>>>>>> IaaS Cloud Design & Build<
>>>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/
>>>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>>>> CloudStack Software Engineering<
>>>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>>>> CloudStack Infrastructure Support<
>>>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>>>> CloudStack Bootcamp Training Courses<
>>>>>> http://shapeblue.com/cloudstack-training/>
>>>>>>
>>>>>> This email and any attachments to it may be confidential and are
>>>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>>>> views or opinions expressed are solely those of the author and do not
>>>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>>>> are not the intended recipient of this email, you must neither take any
>>>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>>>> contact the sender if you believe you have received this email in error.
>>>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>>>> Services India LLP is a company incorporated in India and is operated under
>>>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>>>> company incorporated in Brasil and is operated under license from Shape
>>>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>>>> a registered trademark.
>>>>>>
>>>>>
>>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>> services
>>>>
>>>> IaaS Cloud Design & Build<
>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>> CloudStack Software Engineering<
>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>> CloudStack Infrastructure Support<
>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>> CloudStack Bootcamp Training Courses<
>>>> http://shapeblue.com/cloudstack-training/>
>>>>
>>>> This email and any attachments to it may be confidential and are intended
>>>> solely for the use of the individual to whom it is addressed. Any views or
>>>> opinions expressed are solely those of the author and do not necessarily
>>>> represent those of Shape Blue Ltd or related companies. If you are not the
>>>> intended recipient of this email, you must neither take any action based
>>>> upon its contents, nor copy or show it to anyone. Please contact the sender
>>>> if you believe you have received this email in error. Shape Blue Ltd is a
>>>> company incorporated in England & Wales. ShapeBlue Services India LLP is a
>>>> company incorporated in India and is operated under license from Shape Blue
>>>> Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil
>>>> and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is
>>>> a company registered by The Republic of South Africa and is traded under
>>>> license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>>>>
>>>
>>>
>>>
> Find out more about ShapeBlue and our range of CloudStack related services
>
> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>
> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.




Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Abhinandan Prateek <ab...@shapeblue.com>.
Good catch Santhosh !
I had similar issue passing a space in ‘account name’.

> On 28-Aug-2015, at 2:51 pm, Santhosh Edukulla <sa...@gmail.com> wrote:
>
> Hi Cao,
>
> Inside "_sort_request" function mentioned at the wiki,  change the below
> line
>
> self.params.append(key + '=' + urllib.quote_plus(args[key]))
>
> to
>
> self.params.append( key + '=' + str.lower(urllib.quote_plus(args[key])).
> *replace(**"+", "%20") *)
>
> The time stamp parameter "2015-08-28 16:20:00" , you are passing has a
> space in it, which gets replaced with "+" through quote_plus logic, so
> replace that "+" with "%20", this is getting passed in calculating
> signature in later function.
>
> Similarly, change it for "_build_post_request" function.
>
> Let us know.
>
> Regards,
> Santhosh
>
> On Fri, Aug 28, 2015 at 6:40 PM, <to...@163.com> wrote:
>
>>
>>
>> My scripts is just from cloudstack website
>>
>> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Simple+class+for+making+API+calls%2C+Python
>>
>> and I just do some testing like this:
>>
>> 1. >>> from SignedAPICall import api
>> 2. >>> api.listEvents(listall='true', startdate='2015-08-28')
>> 3. >>> api.listEvents(listall='true', startdate='2015-08-28 16:20:00')
>>
>> Line 2 works fine, line 3 failed with error " 'http error', 401,
>> 'Unauthorized' ".
>>
>> I also do some other tests, they also works fine, like api.listHosts()
>> api.listVirtualMachines().
>>
>> when line 3 failed,  management-server.log said this:
>>
>> 2015-08-28 16:37:53,619 DEBUG [c.c.a.ApiServlet]
>> (catalina-exec-15:ctx-4e587804) ===START===  10.0.1.99 -- GET
>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
>> 2015-08-28 16:37:53,622 INFO  [c.c.a.ApiServer]
>> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) User signature:
>> r7wa861jYWP4QbNMeEjZZ2wNpIc= is not equaled to computed signature:
>> 4c8Kmn+cbMZAmfSvSISPkWt9WCQ=
>> 2015-08-28 16:37:53,622 DEBUG [c.c.a.ApiServlet]
>> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) ===END===  10.0.1.99 -- GET
>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
>>
>> following for line 2:
>> 2015-08-28 16:37:15,900 DEBUG [c.c.a.ApiServlet]
>> (catalina-exec-13:ctx-f8019189) ===START===  10.0.1.99 -- GET
>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
>> 2015-08-28 16:37:15,939 DEBUG [c.c.a.ApiServlet]
>> (catalina-exec-13:ctx-f8019189 ctx-c42b8c5e ctx-1ebbe226) ===END===
>> 10.0.1.99 -- GET
>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
>>
>>
>>
>> -----------
>> Cao Tong
>>
>>
>> On 08/28/2015 02:09 PM, Abhinandan Prateek wrote:
>>
>>> apikey/signature should work and they have same privileges as the
>>> respective user logged in.
>>> Are all the api calls failing or just some ?
>>> Can you share relevant portion of the scripts that you are trying to run ?
>>>
>>> On 28-Aug-2015, at 11:31 am, tony_caotong@163.com wrote:
>>>>
>>>>
>>>> Thanks for all your people's replys.
>>>>
>>>> 1.  Abhinandan,  My ACS manager was not listening on port '8096',
>>>>
>>>> 2.  As Yipeng said, When I call this api from cloudmonkey, it works
>>>> fine, like this
>>>>    " cloudmonkey api listEvents listall=true startdate='2015-08-28
>>>> 00:00:00' "
>>>>
>>>>    When I call it through my python scripts, I used the
>>>> apikey/signature pair to work,  but it failed.
>>>>    I found that how cloudmonkey works,
>>>>    first it login with username/password, then call the function with
>>>> this session id.
>>>>
>>>> it seems that the apikey/signature pair's privilege is not same with
>>>> username/password pair's ?
>>>>
>>>>
>>>> @Daan, yes I am a Chinese. I am afraid it's not a preblem about
>>>> character encodings perhaps.
>>>>
>>>>
>>>> -----------
>>>> Cao Tong
>>>>
>>>> On 08/27/2015 08:54 PM, Abhinandan Prateek wrote:
>>>>
>>>>> Try using the “8096” port for testing/checking APIs.
>>>>>
>>>>> shapeblue.com> wrote:
>>>>>
>>>>>> Yes, as per
>>>>>> https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>>>>>
>>>>>>
>>>>>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>>>>>>
>>>>>>> Hello Every.
>>>>>>>
>>>>>>> I know this is a very simple question to most of you. but it is
>>>>>>> really hard for me to continue my work.
>>>>>>>
>>>>>>> So could Anyone spend your three minutes to give me some advice, it
>>>>>>> will be very usefull to me.
>>>>>>>
>>>>>>> my question is:
>>>>>>>
>>>>>>>   How does the parameter startdate/enddate of api listEvents() use
>>>>>>> new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>>>>>>
>>>>>>>
>>>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>>>>>>>>>>
>>>>>>>>>
>>>>>>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>>>>>>> Traceback (most recent call last):
>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>> File "SignedAPICall.py", line 67, in Event
>>>>>>>   a = api.listEvents(request)
>>>>>>> File "SignedAPICall.py", line 49, in handlerFunction
>>>>>>>   return self._make_request(name, args[0])
>>>>>>> File "SignedAPICall.py", line 61, in _make_request
>>>>>>>   data = self._http_get(self.value)
>>>>>>> File "SignedAPICall.py", line 54, in _http_get
>>>>>>>   response = urllib.urlopen(url)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>   return opener.open(url)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>   return getattr(self, name)(url)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>   return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>   result = method(url, fp, errcode, errmsg, headers)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>   errcode, errmsg, headers)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>>   raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>> instance at 0x7f083da78998>)
>>>>>>>
>>>>>>> -----------
>>>>>>> Cao Tong
>>>>>>>
>>>>>>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>>>>>
>>>>>>>> Hi All:
>>>>>>>>
>>>>>>>>   Does any one have any idea ? Thanks.
>>>>>>>>
>>>>>>>> -----------
>>>>>>>> Cao Tong
>>>>>>>>
>>>>>>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>>>>>
>>>>>>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>>>>>>
>>>>>>>>>          case DATE:
>>>>>>>>>               // This piece of code is for maintaining backward
>>>>>>>>> compatibility
>>>>>>>>>               // and support both the date formats(Bug 9724)
>>>>>>>>>
>>>>>>>>> Is it related to my problem?  Where can I found the descriptions
>>>>>>>>> about BUG9724 ?
>>>>>>>>>
>>>>>>>>> -----------
>>>>>>>>> Cao Tong
>>>>>>>>>
>>>>>>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>>>>>
>>>>>>>>>> Hello,
>>>>>>>>>>
>>>>>>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>>>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>>>>>>> It return a error
>>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>>
>>>>>>>>>> Could anyone tell me why ?
>>>>>>>>>>
>>>>>>>>>> I have read the code
>>>>>>>>>> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not
>>>>>>>>>> understand what was happening,
>>>>>>>>>> it seems authenticate failed, but why??
>>>>>>>>>>
>>>>>>>>>> -----------
>>>>>>>>>> Cao Tong
>>>>>>>>>>
>>>>>>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>>   was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd
>>>>>>>>>>> HH:mm:ss"
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>>>>>>
>>>>>>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>>>>>>
>>>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>>>>>>>>>>
>>>>>>>>>>>>> Traceback (most recent call last):
>>>>>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>>>>>>   return self._make_request(name, kwargs)
>>>>>>>>>>> File "call.py", line 60, in _make_request
>>>>>>>>>>>   data = self._http_get(self.value)
>>>>>>>>>>> File "call.py", line 53, in _http_get
>>>>>>>>>>>   response = urllib.urlopen(url)
>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>>>>>   return opener.open(url)
>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>>>>>   return getattr(self, name)(url)
>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>>>>>   return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>>>>>   result = method(url, fp, errcode, errmsg, headers)
>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>>>>>   errcode, errmsg, headers)
>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in
>>>>>>>>>>> http_error_default
>>>>>>>>>>>   raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>>>
>>>>>>>>>>> my ACS version:
>>>>>>>>>>>
>>>>>>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>>>> services
>>>>>>
>>>>>> IaaS Cloud Design & Build<
>>>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>>>> CSForge – rapid IaaS deployment framework<
>>>>>> http://shapeblue.com/csforge/>
>>>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>>>> CloudStack Software Engineering<
>>>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>>>> CloudStack Infrastructure Support<
>>>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>>>> CloudStack Bootcamp Training Courses<
>>>>>> http://shapeblue.com/cloudstack-training/>
>>>>>>
>>>>>> This email and any attachments to it may be confidential and are
>>>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>>>> views or opinions expressed are solely those of the author and do not
>>>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>>>> are not the intended recipient of this email, you must neither take any
>>>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>>>> contact the sender if you believe you have received this email in error.
>>>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>>>> Services India LLP is a company incorporated in India and is operated under
>>>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>>>> company incorporated in Brasil and is operated under license from Shape
>>>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>>>> a registered trademark.
>>>>>>
>>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>>> services
>>>>>
>>>>> IaaS Cloud Design & Build<
>>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/
>>>>>>
>>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>>> CloudStack Software Engineering<
>>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>>> CloudStack Infrastructure Support<
>>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>>> CloudStack Bootcamp Training Courses<
>>>>> http://shapeblue.com/cloudstack-training/>
>>>>>
>>>>> This email and any attachments to it may be confidential and are
>>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>>> views or opinions expressed are solely those of the author and do not
>>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>>> are not the intended recipient of this email, you must neither take any
>>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>>> contact the sender if you believe you have received this email in error.
>>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>>> Services India LLP is a company incorporated in India and is operated under
>>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>>> company incorporated in Brasil and is operated under license from Shape
>>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>>> a registered trademark.
>>>>>
>>>>
>>>>
>>>> Find out more about ShapeBlue and our range of CloudStack related
>>> services
>>>
>>> IaaS Cloud Design & Build<
>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>> CloudStack Software Engineering<
>>> http://shapeblue.com/cloudstack-software-engineering/>
>>> CloudStack Infrastructure Support<
>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>> CloudStack Bootcamp Training Courses<
>>> http://shapeblue.com/cloudstack-training/>
>>>
>>> This email and any attachments to it may be confidential and are intended
>>> solely for the use of the individual to whom it is addressed. Any views or
>>> opinions expressed are solely those of the author and do not necessarily
>>> represent those of Shape Blue Ltd or related companies. If you are not the
>>> intended recipient of this email, you must neither take any action based
>>> upon its contents, nor copy or show it to anyone. Please contact the sender
>>> if you believe you have received this email in error. Shape Blue Ltd is a
>>> company incorporated in England & Wales. ShapeBlue Services India LLP is a
>>> company incorporated in India and is operated under license from Shape Blue
>>> Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil
>>> and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is
>>> a company registered by The Republic of South Africa and is traded under
>>> license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>>>
>>
>>
>>
>>

Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Abhinandan Prateek <ab...@shapeblue.com>.
Good catch Santhosh !
I had similar issue passing a space in ‘account name’.

> On 28-Aug-2015, at 2:51 pm, Santhosh Edukulla <sa...@gmail.com> wrote:
>
> Hi Cao,
>
> Inside "_sort_request" function mentioned at the wiki,  change the below
> line
>
> self.params.append(key + '=' + urllib.quote_plus(args[key]))
>
> to
>
> self.params.append( key + '=' + str.lower(urllib.quote_plus(args[key])).
> *replace(**"+", "%20") *)
>
> The time stamp parameter "2015-08-28 16:20:00" , you are passing has a
> space in it, which gets replaced with "+" through quote_plus logic, so
> replace that "+" with "%20", this is getting passed in calculating
> signature in later function.
>
> Similarly, change it for "_build_post_request" function.
>
> Let us know.
>
> Regards,
> Santhosh
>
> On Fri, Aug 28, 2015 at 6:40 PM, <to...@163.com> wrote:
>
>>
>>
>> My scripts is just from cloudstack website
>>
>> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Simple+class+for+making+API+calls%2C+Python
>>
>> and I just do some testing like this:
>>
>> 1. >>> from SignedAPICall import api
>> 2. >>> api.listEvents(listall='true', startdate='2015-08-28')
>> 3. >>> api.listEvents(listall='true', startdate='2015-08-28 16:20:00')
>>
>> Line 2 works fine, line 3 failed with error " 'http error', 401,
>> 'Unauthorized' ".
>>
>> I also do some other tests, they also works fine, like api.listHosts()
>> api.listVirtualMachines().
>>
>> when line 3 failed,  management-server.log said this:
>>
>> 2015-08-28 16:37:53,619 DEBUG [c.c.a.ApiServlet]
>> (catalina-exec-15:ctx-4e587804) ===START===  10.0.1.99 -- GET
>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
>> 2015-08-28 16:37:53,622 INFO  [c.c.a.ApiServer]
>> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) User signature:
>> r7wa861jYWP4QbNMeEjZZ2wNpIc= is not equaled to computed signature:
>> 4c8Kmn+cbMZAmfSvSISPkWt9WCQ=
>> 2015-08-28 16:37:53,622 DEBUG [c.c.a.ApiServlet]
>> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) ===END===  10.0.1.99 -- GET
>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
>>
>> following for line 2:
>> 2015-08-28 16:37:15,900 DEBUG [c.c.a.ApiServlet]
>> (catalina-exec-13:ctx-f8019189) ===START===  10.0.1.99 -- GET
>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
>> 2015-08-28 16:37:15,939 DEBUG [c.c.a.ApiServlet]
>> (catalina-exec-13:ctx-f8019189 ctx-c42b8c5e ctx-1ebbe226) ===END===
>> 10.0.1.99 -- GET
>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
>>
>>
>>
>> -----------
>> Cao Tong
>>
>>
>> On 08/28/2015 02:09 PM, Abhinandan Prateek wrote:
>>
>>> apikey/signature should work and they have same privileges as the
>>> respective user logged in.
>>> Are all the api calls failing or just some ?
>>> Can you share relevant portion of the scripts that you are trying to run ?
>>>
>>> On 28-Aug-2015, at 11:31 am, tony_caotong@163.com wrote:
>>>>
>>>>
>>>> Thanks for all your people's replys.
>>>>
>>>> 1.  Abhinandan,  My ACS manager was not listening on port '8096',
>>>>
>>>> 2.  As Yipeng said, When I call this api from cloudmonkey, it works
>>>> fine, like this
>>>>    " cloudmonkey api listEvents listall=true startdate='2015-08-28
>>>> 00:00:00' "
>>>>
>>>>    When I call it through my python scripts, I used the
>>>> apikey/signature pair to work,  but it failed.
>>>>    I found that how cloudmonkey works,
>>>>    first it login with username/password, then call the function with
>>>> this session id.
>>>>
>>>> it seems that the apikey/signature pair's privilege is not same with
>>>> username/password pair's ?
>>>>
>>>>
>>>> @Daan, yes I am a Chinese. I am afraid it's not a preblem about
>>>> character encodings perhaps.
>>>>
>>>>
>>>> -----------
>>>> Cao Tong
>>>>
>>>> On 08/27/2015 08:54 PM, Abhinandan Prateek wrote:
>>>>
>>>>> Try using the “8096” port for testing/checking APIs.
>>>>>
>>>>> shapeblue.com> wrote:
>>>>>
>>>>>> Yes, as per
>>>>>> https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>>>>>
>>>>>>
>>>>>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>>>>>>
>>>>>>> Hello Every.
>>>>>>>
>>>>>>> I know this is a very simple question to most of you. but it is
>>>>>>> really hard for me to continue my work.
>>>>>>>
>>>>>>> So could Anyone spend your three minutes to give me some advice, it
>>>>>>> will be very usefull to me.
>>>>>>>
>>>>>>> my question is:
>>>>>>>
>>>>>>>   How does the parameter startdate/enddate of api listEvents() use
>>>>>>> new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>>>>>>
>>>>>>>
>>>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>>>>>>>>>>
>>>>>>>>>
>>>>>>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>>>>>>> Traceback (most recent call last):
>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>> File "SignedAPICall.py", line 67, in Event
>>>>>>>   a = api.listEvents(request)
>>>>>>> File "SignedAPICall.py", line 49, in handlerFunction
>>>>>>>   return self._make_request(name, args[0])
>>>>>>> File "SignedAPICall.py", line 61, in _make_request
>>>>>>>   data = self._http_get(self.value)
>>>>>>> File "SignedAPICall.py", line 54, in _http_get
>>>>>>>   response = urllib.urlopen(url)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>   return opener.open(url)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>   return getattr(self, name)(url)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>   return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>   result = method(url, fp, errcode, errmsg, headers)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>   errcode, errmsg, headers)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>>   raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>> instance at 0x7f083da78998>)
>>>>>>>
>>>>>>> -----------
>>>>>>> Cao Tong
>>>>>>>
>>>>>>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>>>>>
>>>>>>>> Hi All:
>>>>>>>>
>>>>>>>>   Does any one have any idea ? Thanks.
>>>>>>>>
>>>>>>>> -----------
>>>>>>>> Cao Tong
>>>>>>>>
>>>>>>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>>>>>
>>>>>>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>>>>>>
>>>>>>>>>          case DATE:
>>>>>>>>>               // This piece of code is for maintaining backward
>>>>>>>>> compatibility
>>>>>>>>>               // and support both the date formats(Bug 9724)
>>>>>>>>>
>>>>>>>>> Is it related to my problem?  Where can I found the descriptions
>>>>>>>>> about BUG9724 ?
>>>>>>>>>
>>>>>>>>> -----------
>>>>>>>>> Cao Tong
>>>>>>>>>
>>>>>>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>>>>>
>>>>>>>>>> Hello,
>>>>>>>>>>
>>>>>>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>>>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>>>>>>> It return a error
>>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>>
>>>>>>>>>> Could anyone tell me why ?
>>>>>>>>>>
>>>>>>>>>> I have read the code
>>>>>>>>>> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not
>>>>>>>>>> understand what was happening,
>>>>>>>>>> it seems authenticate failed, but why??
>>>>>>>>>>
>>>>>>>>>> -----------
>>>>>>>>>> Cao Tong
>>>>>>>>>>
>>>>>>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>>   was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd
>>>>>>>>>>> HH:mm:ss"
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>>>>>>
>>>>>>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>>>>>>
>>>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>>>>>>>>>>
>>>>>>>>>>>>> Traceback (most recent call last):
>>>>>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>>>>>>   return self._make_request(name, kwargs)
>>>>>>>>>>> File "call.py", line 60, in _make_request
>>>>>>>>>>>   data = self._http_get(self.value)
>>>>>>>>>>> File "call.py", line 53, in _http_get
>>>>>>>>>>>   response = urllib.urlopen(url)
>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>>>>>   return opener.open(url)
>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>>>>>   return getattr(self, name)(url)
>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>>>>>   return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>>>>>   result = method(url, fp, errcode, errmsg, headers)
>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>>>>>   errcode, errmsg, headers)
>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in
>>>>>>>>>>> http_error_default
>>>>>>>>>>>   raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>>>
>>>>>>>>>>> my ACS version:
>>>>>>>>>>>
>>>>>>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>>>> services
>>>>>>
>>>>>> IaaS Cloud Design & Build<
>>>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>>>> CSForge – rapid IaaS deployment framework<
>>>>>> http://shapeblue.com/csforge/>
>>>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>>>> CloudStack Software Engineering<
>>>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>>>> CloudStack Infrastructure Support<
>>>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>>>> CloudStack Bootcamp Training Courses<
>>>>>> http://shapeblue.com/cloudstack-training/>
>>>>>>
>>>>>> This email and any attachments to it may be confidential and are
>>>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>>>> views or opinions expressed are solely those of the author and do not
>>>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>>>> are not the intended recipient of this email, you must neither take any
>>>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>>>> contact the sender if you believe you have received this email in error.
>>>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>>>> Services India LLP is a company incorporated in India and is operated under
>>>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>>>> company incorporated in Brasil and is operated under license from Shape
>>>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>>>> a registered trademark.
>>>>>>
>>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>>> services
>>>>>
>>>>> IaaS Cloud Design & Build<
>>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/
>>>>>>
>>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>>> CloudStack Software Engineering<
>>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>>> CloudStack Infrastructure Support<
>>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>>> CloudStack Bootcamp Training Courses<
>>>>> http://shapeblue.com/cloudstack-training/>
>>>>>
>>>>> This email and any attachments to it may be confidential and are
>>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>>> views or opinions expressed are solely those of the author and do not
>>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>>> are not the intended recipient of this email, you must neither take any
>>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>>> contact the sender if you believe you have received this email in error.
>>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>>> Services India LLP is a company incorporated in India and is operated under
>>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>>> company incorporated in Brasil and is operated under license from Shape
>>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>>> a registered trademark.
>>>>>
>>>>
>>>>
>>>> Find out more about ShapeBlue and our range of CloudStack related
>>> services
>>>
>>> IaaS Cloud Design & Build<
>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>> CloudStack Software Engineering<
>>> http://shapeblue.com/cloudstack-software-engineering/>
>>> CloudStack Infrastructure Support<
>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>> CloudStack Bootcamp Training Courses<
>>> http://shapeblue.com/cloudstack-training/>
>>>
>>> This email and any attachments to it may be confidential and are intended
>>> solely for the use of the individual to whom it is addressed. Any views or
>>> opinions expressed are solely those of the author and do not necessarily
>>> represent those of Shape Blue Ltd or related companies. If you are not the
>>> intended recipient of this email, you must neither take any action based
>>> upon its contents, nor copy or show it to anyone. Please contact the sender
>>> if you believe you have received this email in error. Shape Blue Ltd is a
>>> company incorporated in England & Wales. ShapeBlue Services India LLP is a
>>> company incorporated in India and is operated under license from Shape Blue
>>> Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil
>>> and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is
>>> a company registered by The Republic of South Africa and is traded under
>>> license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>>>
>>
>>
>>
>>

Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Abhinandan Prateek <ab...@shapeblue.com>.
Good catch Santhosh !
I had similar issue passing a space in ‘account name’.

> On 28-Aug-2015, at 2:51 pm, Santhosh Edukulla <sa...@gmail.com> wrote:
>
> Hi Cao,
>
> Inside "_sort_request" function mentioned at the wiki,  change the below
> line
>
> self.params.append(key + '=' + urllib.quote_plus(args[key]))
>
> to
>
> self.params.append( key + '=' + str.lower(urllib.quote_plus(args[key])).
> *replace(**"+", "%20") *)
>
> The time stamp parameter "2015-08-28 16:20:00" , you are passing has a
> space in it, which gets replaced with "+" through quote_plus logic, so
> replace that "+" with "%20", this is getting passed in calculating
> signature in later function.
>
> Similarly, change it for "_build_post_request" function.
>
> Let us know.
>
> Regards,
> Santhosh
>
> On Fri, Aug 28, 2015 at 6:40 PM, <to...@163.com> wrote:
>
>>
>>
>> My scripts is just from cloudstack website
>>
>> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Simple+class+for+making+API+calls%2C+Python
>>
>> and I just do some testing like this:
>>
>> 1. >>> from SignedAPICall import api
>> 2. >>> api.listEvents(listall='true', startdate='2015-08-28')
>> 3. >>> api.listEvents(listall='true', startdate='2015-08-28 16:20:00')
>>
>> Line 2 works fine, line 3 failed with error " 'http error', 401,
>> 'Unauthorized' ".
>>
>> I also do some other tests, they also works fine, like api.listHosts()
>> api.listVirtualMachines().
>>
>> when line 3 failed,  management-server.log said this:
>>
>> 2015-08-28 16:37:53,619 DEBUG [c.c.a.ApiServlet]
>> (catalina-exec-15:ctx-4e587804) ===START===  10.0.1.99 -- GET
>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
>> 2015-08-28 16:37:53,622 INFO  [c.c.a.ApiServer]
>> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) User signature:
>> r7wa861jYWP4QbNMeEjZZ2wNpIc= is not equaled to computed signature:
>> 4c8Kmn+cbMZAmfSvSISPkWt9WCQ=
>> 2015-08-28 16:37:53,622 DEBUG [c.c.a.ApiServlet]
>> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) ===END===  10.0.1.99 -- GET
>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
>>
>> following for line 2:
>> 2015-08-28 16:37:15,900 DEBUG [c.c.a.ApiServlet]
>> (catalina-exec-13:ctx-f8019189) ===START===  10.0.1.99 -- GET
>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
>> 2015-08-28 16:37:15,939 DEBUG [c.c.a.ApiServlet]
>> (catalina-exec-13:ctx-f8019189 ctx-c42b8c5e ctx-1ebbe226) ===END===
>> 10.0.1.99 -- GET
>> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
>>
>>
>>
>> -----------
>> Cao Tong
>>
>>
>> On 08/28/2015 02:09 PM, Abhinandan Prateek wrote:
>>
>>> apikey/signature should work and they have same privileges as the
>>> respective user logged in.
>>> Are all the api calls failing or just some ?
>>> Can you share relevant portion of the scripts that you are trying to run ?
>>>
>>> On 28-Aug-2015, at 11:31 am, tony_caotong@163.com wrote:
>>>>
>>>>
>>>> Thanks for all your people's replys.
>>>>
>>>> 1.  Abhinandan,  My ACS manager was not listening on port '8096',
>>>>
>>>> 2.  As Yipeng said, When I call this api from cloudmonkey, it works
>>>> fine, like this
>>>>    " cloudmonkey api listEvents listall=true startdate='2015-08-28
>>>> 00:00:00' "
>>>>
>>>>    When I call it through my python scripts, I used the
>>>> apikey/signature pair to work,  but it failed.
>>>>    I found that how cloudmonkey works,
>>>>    first it login with username/password, then call the function with
>>>> this session id.
>>>>
>>>> it seems that the apikey/signature pair's privilege is not same with
>>>> username/password pair's ?
>>>>
>>>>
>>>> @Daan, yes I am a Chinese. I am afraid it's not a preblem about
>>>> character encodings perhaps.
>>>>
>>>>
>>>> -----------
>>>> Cao Tong
>>>>
>>>> On 08/27/2015 08:54 PM, Abhinandan Prateek wrote:
>>>>
>>>>> Try using the “8096” port for testing/checking APIs.
>>>>>
>>>>> shapeblue.com> wrote:
>>>>>
>>>>>> Yes, as per
>>>>>> https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>>>>>
>>>>>>
>>>>>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>>>>>>
>>>>>>> Hello Every.
>>>>>>>
>>>>>>> I know this is a very simple question to most of you. but it is
>>>>>>> really hard for me to continue my work.
>>>>>>>
>>>>>>> So could Anyone spend your three minutes to give me some advice, it
>>>>>>> will be very usefull to me.
>>>>>>>
>>>>>>> my question is:
>>>>>>>
>>>>>>>   How does the parameter startdate/enddate of api listEvents() use
>>>>>>> new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>>>>>>
>>>>>>>
>>>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>>>>>>>>>>
>>>>>>>>>
>>>>>>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>>>>>>> Traceback (most recent call last):
>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>> File "SignedAPICall.py", line 67, in Event
>>>>>>>   a = api.listEvents(request)
>>>>>>> File "SignedAPICall.py", line 49, in handlerFunction
>>>>>>>   return self._make_request(name, args[0])
>>>>>>> File "SignedAPICall.py", line 61, in _make_request
>>>>>>>   data = self._http_get(self.value)
>>>>>>> File "SignedAPICall.py", line 54, in _http_get
>>>>>>>   response = urllib.urlopen(url)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>   return opener.open(url)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>   return getattr(self, name)(url)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>   return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>   result = method(url, fp, errcode, errmsg, headers)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>   errcode, errmsg, headers)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>>   raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>> instance at 0x7f083da78998>)
>>>>>>>
>>>>>>> -----------
>>>>>>> Cao Tong
>>>>>>>
>>>>>>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>>>>>
>>>>>>>> Hi All:
>>>>>>>>
>>>>>>>>   Does any one have any idea ? Thanks.
>>>>>>>>
>>>>>>>> -----------
>>>>>>>> Cao Tong
>>>>>>>>
>>>>>>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>>>>>
>>>>>>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>>>>>>
>>>>>>>>>          case DATE:
>>>>>>>>>               // This piece of code is for maintaining backward
>>>>>>>>> compatibility
>>>>>>>>>               // and support both the date formats(Bug 9724)
>>>>>>>>>
>>>>>>>>> Is it related to my problem?  Where can I found the descriptions
>>>>>>>>> about BUG9724 ?
>>>>>>>>>
>>>>>>>>> -----------
>>>>>>>>> Cao Tong
>>>>>>>>>
>>>>>>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>>>>>
>>>>>>>>>> Hello,
>>>>>>>>>>
>>>>>>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>>>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>>>>>>> It return a error
>>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>>
>>>>>>>>>> Could anyone tell me why ?
>>>>>>>>>>
>>>>>>>>>> I have read the code
>>>>>>>>>> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not
>>>>>>>>>> understand what was happening,
>>>>>>>>>> it seems authenticate failed, but why??
>>>>>>>>>>
>>>>>>>>>> -----------
>>>>>>>>>> Cao Tong
>>>>>>>>>>
>>>>>>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>>   was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd
>>>>>>>>>>> HH:mm:ss"
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>>>>>>
>>>>>>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>>>>>>
>>>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>>>>>>>>>>
>>>>>>>>>>>>> Traceback (most recent call last):
>>>>>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>>>>>>   return self._make_request(name, kwargs)
>>>>>>>>>>> File "call.py", line 60, in _make_request
>>>>>>>>>>>   data = self._http_get(self.value)
>>>>>>>>>>> File "call.py", line 53, in _http_get
>>>>>>>>>>>   response = urllib.urlopen(url)
>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>>>>>   return opener.open(url)
>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>>>>>   return getattr(self, name)(url)
>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>>>>>   return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>>>>>   result = method(url, fp, errcode, errmsg, headers)
>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>>>>>   errcode, errmsg, headers)
>>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in
>>>>>>>>>>> http_error_default
>>>>>>>>>>>   raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>>>
>>>>>>>>>>> my ACS version:
>>>>>>>>>>>
>>>>>>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>>>> services
>>>>>>
>>>>>> IaaS Cloud Design & Build<
>>>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>>>> CSForge – rapid IaaS deployment framework<
>>>>>> http://shapeblue.com/csforge/>
>>>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>>>> CloudStack Software Engineering<
>>>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>>>> CloudStack Infrastructure Support<
>>>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>>>> CloudStack Bootcamp Training Courses<
>>>>>> http://shapeblue.com/cloudstack-training/>
>>>>>>
>>>>>> This email and any attachments to it may be confidential and are
>>>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>>>> views or opinions expressed are solely those of the author and do not
>>>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>>>> are not the intended recipient of this email, you must neither take any
>>>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>>>> contact the sender if you believe you have received this email in error.
>>>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>>>> Services India LLP is a company incorporated in India and is operated under
>>>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>>>> company incorporated in Brasil and is operated under license from Shape
>>>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>>>> a registered trademark.
>>>>>>
>>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>>> services
>>>>>
>>>>> IaaS Cloud Design & Build<
>>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/
>>>>>>
>>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>>> CloudStack Software Engineering<
>>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>>> CloudStack Infrastructure Support<
>>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>>> CloudStack Bootcamp Training Courses<
>>>>> http://shapeblue.com/cloudstack-training/>
>>>>>
>>>>> This email and any attachments to it may be confidential and are
>>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>>> views or opinions expressed are solely those of the author and do not
>>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>>> are not the intended recipient of this email, you must neither take any
>>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>>> contact the sender if you believe you have received this email in error.
>>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>>> Services India LLP is a company incorporated in India and is operated under
>>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>>> company incorporated in Brasil and is operated under license from Shape
>>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>>> a registered trademark.
>>>>>
>>>>
>>>>
>>>> Find out more about ShapeBlue and our range of CloudStack related
>>> services
>>>
>>> IaaS Cloud Design & Build<
>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>> CloudStack Software Engineering<
>>> http://shapeblue.com/cloudstack-software-engineering/>
>>> CloudStack Infrastructure Support<
>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>> CloudStack Bootcamp Training Courses<
>>> http://shapeblue.com/cloudstack-training/>
>>>
>>> This email and any attachments to it may be confidential and are intended
>>> solely for the use of the individual to whom it is addressed. Any views or
>>> opinions expressed are solely those of the author and do not necessarily
>>> represent those of Shape Blue Ltd or related companies. If you are not the
>>> intended recipient of this email, you must neither take any action based
>>> upon its contents, nor copy or show it to anyone. Please contact the sender
>>> if you believe you have received this email in error. Shape Blue Ltd is a
>>> company incorporated in England & Wales. ShapeBlue Services India LLP is a
>>> company incorporated in India and is operated under license from Shape Blue
>>> Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil
>>> and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is
>>> a company registered by The Republic of South Africa and is traded under
>>> license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>>>
>>
>>
>>
>>

Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Santhosh Edukulla <sa...@gmail.com>.
Hi Cao,

Inside "_sort_request" function mentioned at the wiki,  change the below
line

self.params.append(key + '=' + urllib.quote_plus(args[key]))

to

self.params.append( key + '=' + str.lower(urllib.quote_plus(args[key])).
*replace(**"+", "%20") *)

The time stamp parameter "2015-08-28 16:20:00" , you are passing has a
space in it, which gets replaced with "+" through quote_plus logic, so
replace that "+" with "%20", this is getting passed in calculating
 signature in later function.

Similarly, change it for "_build_post_request" function.

Let us know.

Regards,
Santhosh

On Fri, Aug 28, 2015 at 6:40 PM, <to...@163.com> wrote:

>
>
> My scripts is just from cloudstack website
>
> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Simple+class+for+making+API+calls%2C+Python
>
> and I just do some testing like this:
>
> 1. >>> from SignedAPICall import api
> 2. >>> api.listEvents(listall='true', startdate='2015-08-28')
> 3. >>> api.listEvents(listall='true', startdate='2015-08-28 16:20:00')
>
> Line 2 works fine, line 3 failed with error " 'http error', 401,
> 'Unauthorized' ".
>
> I also do some other tests, they also works fine, like api.listHosts()
> api.listVirtualMachines().
>
> when line 3 failed,  management-server.log said this:
>
> 2015-08-28 16:37:53,619 DEBUG [c.c.a.ApiServlet]
> (catalina-exec-15:ctx-4e587804) ===START===  10.0.1.99 -- GET
> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
> 2015-08-28 16:37:53,622 INFO  [c.c.a.ApiServer]
> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) User signature:
> r7wa861jYWP4QbNMeEjZZ2wNpIc= is not equaled to computed signature:
> 4c8Kmn+cbMZAmfSvSISPkWt9WCQ=
> 2015-08-28 16:37:53,622 DEBUG [c.c.a.ApiServlet]
> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) ===END===  10.0.1.99 -- GET
> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
>
> following for line 2:
> 2015-08-28 16:37:15,900 DEBUG [c.c.a.ApiServlet]
> (catalina-exec-13:ctx-f8019189) ===START===  10.0.1.99 -- GET
> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
> 2015-08-28 16:37:15,939 DEBUG [c.c.a.ApiServlet]
> (catalina-exec-13:ctx-f8019189 ctx-c42b8c5e ctx-1ebbe226) ===END===
> 10.0.1.99 -- GET
> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
>
>
>
> -----------
> Cao Tong
>
>
> On 08/28/2015 02:09 PM, Abhinandan Prateek wrote:
>
>> apikey/signature should work and they have same privileges as the
>> respective user logged in.
>> Are all the api calls failing or just some ?
>> Can you share relevant portion of the scripts that you are trying to run ?
>>
>> On 28-Aug-2015, at 11:31 am, tony_caotong@163.com wrote:
>>>
>>>
>>> Thanks for all your people's replys.
>>>
>>> 1.  Abhinandan,  My ACS manager was not listening on port '8096',
>>>
>>> 2.  As Yipeng said, When I call this api from cloudmonkey, it works
>>> fine, like this
>>>     " cloudmonkey api listEvents listall=true startdate='2015-08-28
>>> 00:00:00' "
>>>
>>>     When I call it through my python scripts, I used the
>>> apikey/signature pair to work,  but it failed.
>>>     I found that how cloudmonkey works,
>>>     first it login with username/password, then call the function with
>>> this session id.
>>>
>>> it seems that the apikey/signature pair's privilege is not same with
>>> username/password pair's ?
>>>
>>>
>>> @Daan, yes I am a Chinese. I am afraid it's not a preblem about
>>> character encodings perhaps.
>>>
>>>
>>> -----------
>>> Cao Tong
>>>
>>> On 08/27/2015 08:54 PM, Abhinandan Prateek wrote:
>>>
>>>> Try using the “8096” port for testing/checking APIs.
>>>>
>>>> shapeblue.com> wrote:
>>>>
>>>>> Yes, as per
>>>>> https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>>>>
>>>>>
>>>>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>>>>>
>>>>>> Hello Every.
>>>>>>
>>>>>> I know this is a very simple question to most of you. but it is
>>>>>> really hard for me to continue my work.
>>>>>>
>>>>>> So could Anyone spend your three minutes to give me some advice, it
>>>>>> will be very usefull to me.
>>>>>>
>>>>>> my question is:
>>>>>>
>>>>>>    How does the parameter startdate/enddate of api listEvents() use
>>>>>> new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>>>>>
>>>>>>
>>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>>>>>>>>>
>>>>>>>>
>>>>>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>>>>>> Traceback (most recent call last):
>>>>>> File "<stdin>", line 1, in <module>
>>>>>> File "SignedAPICall.py", line 67, in Event
>>>>>>    a = api.listEvents(request)
>>>>>> File "SignedAPICall.py", line 49, in handlerFunction
>>>>>>    return self._make_request(name, args[0])
>>>>>> File "SignedAPICall.py", line 61, in _make_request
>>>>>>    data = self._http_get(self.value)
>>>>>> File "SignedAPICall.py", line 54, in _http_get
>>>>>>    response = urllib.urlopen(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>    return opener.open(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>    return getattr(self, name)(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>    errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>> instance at 0x7f083da78998>)
>>>>>>
>>>>>> -----------
>>>>>> Cao Tong
>>>>>>
>>>>>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>>>>
>>>>>>> Hi All:
>>>>>>>
>>>>>>>    Does any one have any idea ? Thanks.
>>>>>>>
>>>>>>> -----------
>>>>>>> Cao Tong
>>>>>>>
>>>>>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>>>>
>>>>>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>>>>>
>>>>>>>>           case DATE:
>>>>>>>>                // This piece of code is for maintaining backward
>>>>>>>> compatibility
>>>>>>>>                // and support both the date formats(Bug 9724)
>>>>>>>>
>>>>>>>> Is it related to my problem?  Where can I found the descriptions
>>>>>>>> about BUG9724 ?
>>>>>>>>
>>>>>>>> -----------
>>>>>>>> Cao Tong
>>>>>>>>
>>>>>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>>>>
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>>>>>> It return a error
>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>
>>>>>>>>> Could anyone tell me why ?
>>>>>>>>>
>>>>>>>>> I have read the code
>>>>>>>>> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not
>>>>>>>>> understand what was happening,
>>>>>>>>> it seems authenticate failed, but why??
>>>>>>>>>
>>>>>>>>> -----------
>>>>>>>>> Cao Tong
>>>>>>>>>
>>>>>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd
>>>>>>>>>> HH:mm:ss"
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>>>>>
>>>>>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>>>>>
>>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>>>>>>>>>
>>>>>>>>>>>> Traceback (most recent call last):
>>>>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>>>>>    return self._make_request(name, kwargs)
>>>>>>>>>> File "call.py", line 60, in _make_request
>>>>>>>>>>    data = self._http_get(self.value)
>>>>>>>>>> File "call.py", line 53, in _http_get
>>>>>>>>>>    response = urllib.urlopen(url)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>>>>    return opener.open(url)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>>>>    return getattr(self, name)(url)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>>>>    errcode, errmsg, headers)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in
>>>>>>>>>> http_error_default
>>>>>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>>
>>>>>>>>>> my ACS version:
>>>>>>>>>>
>>>>>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>>> services
>>>>>
>>>>> IaaS Cloud Design & Build<
>>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>>> CSForge – rapid IaaS deployment framework<
>>>>> http://shapeblue.com/csforge/>
>>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>>> CloudStack Software Engineering<
>>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>>> CloudStack Infrastructure Support<
>>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>>> CloudStack Bootcamp Training Courses<
>>>>> http://shapeblue.com/cloudstack-training/>
>>>>>
>>>>> This email and any attachments to it may be confidential and are
>>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>>> views or opinions expressed are solely those of the author and do not
>>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>>> are not the intended recipient of this email, you must neither take any
>>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>>> contact the sender if you believe you have received this email in error.
>>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>>> Services India LLP is a company incorporated in India and is operated under
>>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>>> company incorporated in Brasil and is operated under license from Shape
>>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>>> a registered trademark.
>>>>>
>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>> services
>>>>
>>>> IaaS Cloud Design & Build<
>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/
>>>> >
>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>> CloudStack Software Engineering<
>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>> CloudStack Infrastructure Support<
>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>> CloudStack Bootcamp Training Courses<
>>>> http://shapeblue.com/cloudstack-training/>
>>>>
>>>> This email and any attachments to it may be confidential and are
>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>> views or opinions expressed are solely those of the author and do not
>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>> are not the intended recipient of this email, you must neither take any
>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>> contact the sender if you believe you have received this email in error.
>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>> Services India LLP is a company incorporated in India and is operated under
>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>> company incorporated in Brasil and is operated under license from Shape
>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>> a registered trademark.
>>>>
>>>
>>>
>>> Find out more about ShapeBlue and our range of CloudStack related
>> services
>>
>> IaaS Cloud Design & Build<
>> http://shapeblue.com/iaas-cloud-design-and-build//>
>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>> CloudStack Software Engineering<
>> http://shapeblue.com/cloudstack-software-engineering/>
>> CloudStack Infrastructure Support<
>> http://shapeblue.com/cloudstack-infrastructure-support/>
>> CloudStack Bootcamp Training Courses<
>> http://shapeblue.com/cloudstack-training/>
>>
>> This email and any attachments to it may be confidential and are intended
>> solely for the use of the individual to whom it is addressed. Any views or
>> opinions expressed are solely those of the author and do not necessarily
>> represent those of Shape Blue Ltd or related companies. If you are not the
>> intended recipient of this email, you must neither take any action based
>> upon its contents, nor copy or show it to anyone. Please contact the sender
>> if you believe you have received this email in error. Shape Blue Ltd is a
>> company incorporated in England & Wales. ShapeBlue Services India LLP is a
>> company incorporated in India and is operated under license from Shape Blue
>> Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil
>> and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is
>> a company registered by The Republic of South Africa and is traded under
>> license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>>
>
>
>
>

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Daan Hoogland <da...@gmail.com>.
On Fri, Aug 28, 2015 at 10:40 AM, <to...@163.com> wrote:

> 2015-08-28+16%3A20%3A00


​very convincing , Coa Tong. Something is wrong in the calculation of the
signature on this string. It seems to work for other people so can you
provide environmental data:
os version
cloustack version
language setting (both on server and client side)
client library version.
​​
​The problem might be in one of those. If there is any other setting you
can think of please provide it as well.​



-- 
Daan

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Santhosh Edukulla <sa...@gmail.com>.
Hi Cao,

Inside "_sort_request" function mentioned at the wiki,  change the below
line

self.params.append(key + '=' + urllib.quote_plus(args[key]))

to

self.params.append( key + '=' + str.lower(urllib.quote_plus(args[key])).
*replace(**"+", "%20") *)

The time stamp parameter "2015-08-28 16:20:00" , you are passing has a
space in it, which gets replaced with "+" through quote_plus logic, so
replace that "+" with "%20", this is getting passed in calculating
 signature in later function.

Similarly, change it for "_build_post_request" function.

Let us know.

Regards,
Santhosh

On Fri, Aug 28, 2015 at 6:40 PM, <to...@163.com> wrote:

>
>
> My scripts is just from cloudstack website
>
> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Simple+class+for+making+API+calls%2C+Python
>
> and I just do some testing like this:
>
> 1. >>> from SignedAPICall import api
> 2. >>> api.listEvents(listall='true', startdate='2015-08-28')
> 3. >>> api.listEvents(listall='true', startdate='2015-08-28 16:20:00')
>
> Line 2 works fine, line 3 failed with error " 'http error', 401,
> 'Unauthorized' ".
>
> I also do some other tests, they also works fine, like api.listHosts()
> api.listVirtualMachines().
>
> when line 3 failed,  management-server.log said this:
>
> 2015-08-28 16:37:53,619 DEBUG [c.c.a.ApiServlet]
> (catalina-exec-15:ctx-4e587804) ===START===  10.0.1.99 -- GET
> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
> 2015-08-28 16:37:53,622 INFO  [c.c.a.ApiServer]
> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) User signature:
> r7wa861jYWP4QbNMeEjZZ2wNpIc= is not equaled to computed signature:
> 4c8Kmn+cbMZAmfSvSISPkWt9WCQ=
> 2015-08-28 16:37:53,622 DEBUG [c.c.a.ApiServlet]
> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) ===END===  10.0.1.99 -- GET
> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
>
> following for line 2:
> 2015-08-28 16:37:15,900 DEBUG [c.c.a.ApiServlet]
> (catalina-exec-13:ctx-f8019189) ===START===  10.0.1.99 -- GET
> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
> 2015-08-28 16:37:15,939 DEBUG [c.c.a.ApiServlet]
> (catalina-exec-13:ctx-f8019189 ctx-c42b8c5e ctx-1ebbe226) ===END===
> 10.0.1.99 -- GET
> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
>
>
>
> -----------
> Cao Tong
>
>
> On 08/28/2015 02:09 PM, Abhinandan Prateek wrote:
>
>> apikey/signature should work and they have same privileges as the
>> respective user logged in.
>> Are all the api calls failing or just some ?
>> Can you share relevant portion of the scripts that you are trying to run ?
>>
>> On 28-Aug-2015, at 11:31 am, tony_caotong@163.com wrote:
>>>
>>>
>>> Thanks for all your people's replys.
>>>
>>> 1.  Abhinandan,  My ACS manager was not listening on port '8096',
>>>
>>> 2.  As Yipeng said, When I call this api from cloudmonkey, it works
>>> fine, like this
>>>     " cloudmonkey api listEvents listall=true startdate='2015-08-28
>>> 00:00:00' "
>>>
>>>     When I call it through my python scripts, I used the
>>> apikey/signature pair to work,  but it failed.
>>>     I found that how cloudmonkey works,
>>>     first it login with username/password, then call the function with
>>> this session id.
>>>
>>> it seems that the apikey/signature pair's privilege is not same with
>>> username/password pair's ?
>>>
>>>
>>> @Daan, yes I am a Chinese. I am afraid it's not a preblem about
>>> character encodings perhaps.
>>>
>>>
>>> -----------
>>> Cao Tong
>>>
>>> On 08/27/2015 08:54 PM, Abhinandan Prateek wrote:
>>>
>>>> Try using the “8096” port for testing/checking APIs.
>>>>
>>>> shapeblue.com> wrote:
>>>>
>>>>> Yes, as per
>>>>> https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>>>>
>>>>>
>>>>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>>>>>
>>>>>> Hello Every.
>>>>>>
>>>>>> I know this is a very simple question to most of you. but it is
>>>>>> really hard for me to continue my work.
>>>>>>
>>>>>> So could Anyone spend your three minutes to give me some advice, it
>>>>>> will be very usefull to me.
>>>>>>
>>>>>> my question is:
>>>>>>
>>>>>>    How does the parameter startdate/enddate of api listEvents() use
>>>>>> new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>>>>>
>>>>>>
>>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>>>>>>>>>
>>>>>>>>
>>>>>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>>>>>> Traceback (most recent call last):
>>>>>> File "<stdin>", line 1, in <module>
>>>>>> File "SignedAPICall.py", line 67, in Event
>>>>>>    a = api.listEvents(request)
>>>>>> File "SignedAPICall.py", line 49, in handlerFunction
>>>>>>    return self._make_request(name, args[0])
>>>>>> File "SignedAPICall.py", line 61, in _make_request
>>>>>>    data = self._http_get(self.value)
>>>>>> File "SignedAPICall.py", line 54, in _http_get
>>>>>>    response = urllib.urlopen(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>    return opener.open(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>    return getattr(self, name)(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>    errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>> instance at 0x7f083da78998>)
>>>>>>
>>>>>> -----------
>>>>>> Cao Tong
>>>>>>
>>>>>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>>>>
>>>>>>> Hi All:
>>>>>>>
>>>>>>>    Does any one have any idea ? Thanks.
>>>>>>>
>>>>>>> -----------
>>>>>>> Cao Tong
>>>>>>>
>>>>>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>>>>
>>>>>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>>>>>
>>>>>>>>           case DATE:
>>>>>>>>                // This piece of code is for maintaining backward
>>>>>>>> compatibility
>>>>>>>>                // and support both the date formats(Bug 9724)
>>>>>>>>
>>>>>>>> Is it related to my problem?  Where can I found the descriptions
>>>>>>>> about BUG9724 ?
>>>>>>>>
>>>>>>>> -----------
>>>>>>>> Cao Tong
>>>>>>>>
>>>>>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>>>>
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>>>>>> It return a error
>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>
>>>>>>>>> Could anyone tell me why ?
>>>>>>>>>
>>>>>>>>> I have read the code
>>>>>>>>> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not
>>>>>>>>> understand what was happening,
>>>>>>>>> it seems authenticate failed, but why??
>>>>>>>>>
>>>>>>>>> -----------
>>>>>>>>> Cao Tong
>>>>>>>>>
>>>>>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd
>>>>>>>>>> HH:mm:ss"
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>>>>>
>>>>>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>>>>>
>>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>>>>>>>>>
>>>>>>>>>>>> Traceback (most recent call last):
>>>>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>>>>>    return self._make_request(name, kwargs)
>>>>>>>>>> File "call.py", line 60, in _make_request
>>>>>>>>>>    data = self._http_get(self.value)
>>>>>>>>>> File "call.py", line 53, in _http_get
>>>>>>>>>>    response = urllib.urlopen(url)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>>>>    return opener.open(url)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>>>>    return getattr(self, name)(url)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>>>>    errcode, errmsg, headers)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in
>>>>>>>>>> http_error_default
>>>>>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>>
>>>>>>>>>> my ACS version:
>>>>>>>>>>
>>>>>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>>> services
>>>>>
>>>>> IaaS Cloud Design & Build<
>>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>>> CSForge – rapid IaaS deployment framework<
>>>>> http://shapeblue.com/csforge/>
>>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>>> CloudStack Software Engineering<
>>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>>> CloudStack Infrastructure Support<
>>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>>> CloudStack Bootcamp Training Courses<
>>>>> http://shapeblue.com/cloudstack-training/>
>>>>>
>>>>> This email and any attachments to it may be confidential and are
>>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>>> views or opinions expressed are solely those of the author and do not
>>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>>> are not the intended recipient of this email, you must neither take any
>>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>>> contact the sender if you believe you have received this email in error.
>>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>>> Services India LLP is a company incorporated in India and is operated under
>>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>>> company incorporated in Brasil and is operated under license from Shape
>>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>>> a registered trademark.
>>>>>
>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>> services
>>>>
>>>> IaaS Cloud Design & Build<
>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/
>>>> >
>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>> CloudStack Software Engineering<
>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>> CloudStack Infrastructure Support<
>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>> CloudStack Bootcamp Training Courses<
>>>> http://shapeblue.com/cloudstack-training/>
>>>>
>>>> This email and any attachments to it may be confidential and are
>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>> views or opinions expressed are solely those of the author and do not
>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>> are not the intended recipient of this email, you must neither take any
>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>> contact the sender if you believe you have received this email in error.
>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>> Services India LLP is a company incorporated in India and is operated under
>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>> company incorporated in Brasil and is operated under license from Shape
>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>> a registered trademark.
>>>>
>>>
>>>
>>> Find out more about ShapeBlue and our range of CloudStack related
>> services
>>
>> IaaS Cloud Design & Build<
>> http://shapeblue.com/iaas-cloud-design-and-build//>
>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>> CloudStack Software Engineering<
>> http://shapeblue.com/cloudstack-software-engineering/>
>> CloudStack Infrastructure Support<
>> http://shapeblue.com/cloudstack-infrastructure-support/>
>> CloudStack Bootcamp Training Courses<
>> http://shapeblue.com/cloudstack-training/>
>>
>> This email and any attachments to it may be confidential and are intended
>> solely for the use of the individual to whom it is addressed. Any views or
>> opinions expressed are solely those of the author and do not necessarily
>> represent those of Shape Blue Ltd or related companies. If you are not the
>> intended recipient of this email, you must neither take any action based
>> upon its contents, nor copy or show it to anyone. Please contact the sender
>> if you believe you have received this email in error. Shape Blue Ltd is a
>> company incorporated in England & Wales. ShapeBlue Services India LLP is a
>> company incorporated in India and is operated under license from Shape Blue
>> Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil
>> and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is
>> a company registered by The Republic of South Africa and is traded under
>> license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>>
>
>
>
>

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Santhosh Edukulla <sa...@gmail.com>.
Hi Cao,

Inside "_sort_request" function mentioned at the wiki,  change the below
line

self.params.append(key + '=' + urllib.quote_plus(args[key]))

to

self.params.append( key + '=' + str.lower(urllib.quote_plus(args[key])).
*replace(**"+", "%20") *)

The time stamp parameter "2015-08-28 16:20:00" , you are passing has a
space in it, which gets replaced with "+" through quote_plus logic, so
replace that "+" with "%20", this is getting passed in calculating
 signature in later function.

Similarly, change it for "_build_post_request" function.

Let us know.

Regards,
Santhosh

On Fri, Aug 28, 2015 at 6:40 PM, <to...@163.com> wrote:

>
>
> My scripts is just from cloudstack website
>
> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Simple+class+for+making+API+calls%2C+Python
>
> and I just do some testing like this:
>
> 1. >>> from SignedAPICall import api
> 2. >>> api.listEvents(listall='true', startdate='2015-08-28')
> 3. >>> api.listEvents(listall='true', startdate='2015-08-28 16:20:00')
>
> Line 2 works fine, line 3 failed with error " 'http error', 401,
> 'Unauthorized' ".
>
> I also do some other tests, they also works fine, like api.listHosts()
> api.listVirtualMachines().
>
> when line 3 failed,  management-server.log said this:
>
> 2015-08-28 16:37:53,619 DEBUG [c.c.a.ApiServlet]
> (catalina-exec-15:ctx-4e587804) ===START===  10.0.1.99 -- GET
> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
> 2015-08-28 16:37:53,622 INFO  [c.c.a.ApiServer]
> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) User signature:
> r7wa861jYWP4QbNMeEjZZ2wNpIc= is not equaled to computed signature:
> 4c8Kmn+cbMZAmfSvSISPkWt9WCQ=
> 2015-08-28 16:37:53,622 DEBUG [c.c.a.ApiServlet]
> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) ===END===  10.0.1.99 -- GET
> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
>
> following for line 2:
> 2015-08-28 16:37:15,900 DEBUG [c.c.a.ApiServlet]
> (catalina-exec-13:ctx-f8019189) ===START===  10.0.1.99 -- GET
> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
> 2015-08-28 16:37:15,939 DEBUG [c.c.a.ApiServlet]
> (catalina-exec-13:ctx-f8019189 ctx-c42b8c5e ctx-1ebbe226) ===END===
> 10.0.1.99 -- GET
> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
>
>
>
> -----------
> Cao Tong
>
>
> On 08/28/2015 02:09 PM, Abhinandan Prateek wrote:
>
>> apikey/signature should work and they have same privileges as the
>> respective user logged in.
>> Are all the api calls failing or just some ?
>> Can you share relevant portion of the scripts that you are trying to run ?
>>
>> On 28-Aug-2015, at 11:31 am, tony_caotong@163.com wrote:
>>>
>>>
>>> Thanks for all your people's replys.
>>>
>>> 1.  Abhinandan,  My ACS manager was not listening on port '8096',
>>>
>>> 2.  As Yipeng said, When I call this api from cloudmonkey, it works
>>> fine, like this
>>>     " cloudmonkey api listEvents listall=true startdate='2015-08-28
>>> 00:00:00' "
>>>
>>>     When I call it through my python scripts, I used the
>>> apikey/signature pair to work,  but it failed.
>>>     I found that how cloudmonkey works,
>>>     first it login with username/password, then call the function with
>>> this session id.
>>>
>>> it seems that the apikey/signature pair's privilege is not same with
>>> username/password pair's ?
>>>
>>>
>>> @Daan, yes I am a Chinese. I am afraid it's not a preblem about
>>> character encodings perhaps.
>>>
>>>
>>> -----------
>>> Cao Tong
>>>
>>> On 08/27/2015 08:54 PM, Abhinandan Prateek wrote:
>>>
>>>> Try using the “8096” port for testing/checking APIs.
>>>>
>>>> shapeblue.com> wrote:
>>>>
>>>>> Yes, as per
>>>>> https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>>>>
>>>>>
>>>>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>>>>>
>>>>>> Hello Every.
>>>>>>
>>>>>> I know this is a very simple question to most of you. but it is
>>>>>> really hard for me to continue my work.
>>>>>>
>>>>>> So could Anyone spend your three minutes to give me some advice, it
>>>>>> will be very usefull to me.
>>>>>>
>>>>>> my question is:
>>>>>>
>>>>>>    How does the parameter startdate/enddate of api listEvents() use
>>>>>> new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>>>>>
>>>>>>
>>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>>>>>>>>>
>>>>>>>>
>>>>>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>>>>>> Traceback (most recent call last):
>>>>>> File "<stdin>", line 1, in <module>
>>>>>> File "SignedAPICall.py", line 67, in Event
>>>>>>    a = api.listEvents(request)
>>>>>> File "SignedAPICall.py", line 49, in handlerFunction
>>>>>>    return self._make_request(name, args[0])
>>>>>> File "SignedAPICall.py", line 61, in _make_request
>>>>>>    data = self._http_get(self.value)
>>>>>> File "SignedAPICall.py", line 54, in _http_get
>>>>>>    response = urllib.urlopen(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>    return opener.open(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>    return getattr(self, name)(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>    errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>> instance at 0x7f083da78998>)
>>>>>>
>>>>>> -----------
>>>>>> Cao Tong
>>>>>>
>>>>>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>>>>
>>>>>>> Hi All:
>>>>>>>
>>>>>>>    Does any one have any idea ? Thanks.
>>>>>>>
>>>>>>> -----------
>>>>>>> Cao Tong
>>>>>>>
>>>>>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>>>>
>>>>>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>>>>>
>>>>>>>>           case DATE:
>>>>>>>>                // This piece of code is for maintaining backward
>>>>>>>> compatibility
>>>>>>>>                // and support both the date formats(Bug 9724)
>>>>>>>>
>>>>>>>> Is it related to my problem?  Where can I found the descriptions
>>>>>>>> about BUG9724 ?
>>>>>>>>
>>>>>>>> -----------
>>>>>>>> Cao Tong
>>>>>>>>
>>>>>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>>>>
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>>>>>> It return a error
>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>
>>>>>>>>> Could anyone tell me why ?
>>>>>>>>>
>>>>>>>>> I have read the code
>>>>>>>>> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not
>>>>>>>>> understand what was happening,
>>>>>>>>> it seems authenticate failed, but why??
>>>>>>>>>
>>>>>>>>> -----------
>>>>>>>>> Cao Tong
>>>>>>>>>
>>>>>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd
>>>>>>>>>> HH:mm:ss"
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>>>>>
>>>>>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>>>>>
>>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>>>>>>>>>
>>>>>>>>>>>> Traceback (most recent call last):
>>>>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>>>>>    return self._make_request(name, kwargs)
>>>>>>>>>> File "call.py", line 60, in _make_request
>>>>>>>>>>    data = self._http_get(self.value)
>>>>>>>>>> File "call.py", line 53, in _http_get
>>>>>>>>>>    response = urllib.urlopen(url)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>>>>    return opener.open(url)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>>>>    return getattr(self, name)(url)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>>>>    errcode, errmsg, headers)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in
>>>>>>>>>> http_error_default
>>>>>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>>
>>>>>>>>>> my ACS version:
>>>>>>>>>>
>>>>>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>>> services
>>>>>
>>>>> IaaS Cloud Design & Build<
>>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>>> CSForge – rapid IaaS deployment framework<
>>>>> http://shapeblue.com/csforge/>
>>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>>> CloudStack Software Engineering<
>>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>>> CloudStack Infrastructure Support<
>>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>>> CloudStack Bootcamp Training Courses<
>>>>> http://shapeblue.com/cloudstack-training/>
>>>>>
>>>>> This email and any attachments to it may be confidential and are
>>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>>> views or opinions expressed are solely those of the author and do not
>>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>>> are not the intended recipient of this email, you must neither take any
>>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>>> contact the sender if you believe you have received this email in error.
>>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>>> Services India LLP is a company incorporated in India and is operated under
>>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>>> company incorporated in Brasil and is operated under license from Shape
>>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>>> a registered trademark.
>>>>>
>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>> services
>>>>
>>>> IaaS Cloud Design & Build<
>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/
>>>> >
>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>> CloudStack Software Engineering<
>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>> CloudStack Infrastructure Support<
>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>> CloudStack Bootcamp Training Courses<
>>>> http://shapeblue.com/cloudstack-training/>
>>>>
>>>> This email and any attachments to it may be confidential and are
>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>> views or opinions expressed are solely those of the author and do not
>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>> are not the intended recipient of this email, you must neither take any
>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>> contact the sender if you believe you have received this email in error.
>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>> Services India LLP is a company incorporated in India and is operated under
>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>> company incorporated in Brasil and is operated under license from Shape
>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>> a registered trademark.
>>>>
>>>
>>>
>>> Find out more about ShapeBlue and our range of CloudStack related
>> services
>>
>> IaaS Cloud Design & Build<
>> http://shapeblue.com/iaas-cloud-design-and-build//>
>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>> CloudStack Software Engineering<
>> http://shapeblue.com/cloudstack-software-engineering/>
>> CloudStack Infrastructure Support<
>> http://shapeblue.com/cloudstack-infrastructure-support/>
>> CloudStack Bootcamp Training Courses<
>> http://shapeblue.com/cloudstack-training/>
>>
>> This email and any attachments to it may be confidential and are intended
>> solely for the use of the individual to whom it is addressed. Any views or
>> opinions expressed are solely those of the author and do not necessarily
>> represent those of Shape Blue Ltd or related companies. If you are not the
>> intended recipient of this email, you must neither take any action based
>> upon its contents, nor copy or show it to anyone. Please contact the sender
>> if you believe you have received this email in error. Shape Blue Ltd is a
>> company incorporated in England & Wales. ShapeBlue Services India LLP is a
>> company incorporated in India and is operated under license from Shape Blue
>> Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil
>> and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is
>> a company registered by The Republic of South Africa and is traded under
>> license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>>
>
>
>
>

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Daan Hoogland <da...@gmail.com>.
On Fri, Aug 28, 2015 at 10:40 AM, <to...@163.com> wrote:

> 2015-08-28+16%3A20%3A00


​very convincing , Coa Tong. Something is wrong in the calculation of the
signature on this string. It seems to work for other people so can you
provide environmental data:
os version
cloustack version
language setting (both on server and client side)
client library version.
​​
​The problem might be in one of those. If there is any other setting you
can think of please provide it as well.​



-- 
Daan

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Wei ZHOU <us...@gmail.com>.
Can you try this script?
https://gist.github.com/swill/1468908/7874b32f421ea5dd7a9d876b270c78bc3a7dd878#file-cs_api_keys-py



2015-08-28 10:40 GMT+02:00 <to...@163.com>:

>
>
> My scripts is just from cloudstack website
>
> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Simple+class+for+making+API+calls%2C+Python
>
> and I just do some testing like this:
>
> 1. >>> from SignedAPICall import api
> 2. >>> api.listEvents(listall='true', startdate='2015-08-28')
> 3. >>> api.listEvents(listall='true', startdate='2015-08-28 16:20:00')
>
> Line 2 works fine, line 3 failed with error " 'http error', 401,
> 'Unauthorized' ".
>
> I also do some other tests, they also works fine, like api.listHosts()
> api.listVirtualMachines().
>
> when line 3 failed,  management-server.log said this:
>
> 2015-08-28 16:37:53,619 DEBUG [c.c.a.ApiServlet]
> (catalina-exec-15:ctx-4e587804) ===START===  10.0.1.99 -- GET
> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
> 2015-08-28 16:37:53,622 INFO  [c.c.a.ApiServer]
> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) User signature:
> r7wa861jYWP4QbNMeEjZZ2wNpIc= is not equaled to computed signature:
> 4c8Kmn+cbMZAmfSvSISPkWt9WCQ=
> 2015-08-28 16:37:53,622 DEBUG [c.c.a.ApiServlet]
> (catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) ===END===  10.0.1.99 -- GET
> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
>
> following for line 2:
> 2015-08-28 16:37:15,900 DEBUG [c.c.a.ApiServlet]
> (catalina-exec-13:ctx-f8019189) ===START===  10.0.1.99 -- GET
> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
> 2015-08-28 16:37:15,939 DEBUG [c.c.a.ApiServlet]
> (catalina-exec-13:ctx-f8019189 ctx-c42b8c5e ctx-1ebbe226) ===END===
> 10.0.1.99 -- GET
> apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
>
>
>
> -----------
> Cao Tong
>
>
> On 08/28/2015 02:09 PM, Abhinandan Prateek wrote:
>
>> apikey/signature should work and they have same privileges as the
>> respective user logged in.
>> Are all the api calls failing or just some ?
>> Can you share relevant portion of the scripts that you are trying to run ?
>>
>> On 28-Aug-2015, at 11:31 am, tony_caotong@163.com wrote:
>>>
>>>
>>> Thanks for all your people's replys.
>>>
>>> 1.  Abhinandan,  My ACS manager was not listening on port '8096',
>>>
>>> 2.  As Yipeng said, When I call this api from cloudmonkey, it works
>>> fine, like this
>>>     " cloudmonkey api listEvents listall=true startdate='2015-08-28
>>> 00:00:00' "
>>>
>>>     When I call it through my python scripts, I used the
>>> apikey/signature pair to work,  but it failed.
>>>     I found that how cloudmonkey works,
>>>     first it login with username/password, then call the function with
>>> this session id.
>>>
>>> it seems that the apikey/signature pair's privilege is not same with
>>> username/password pair's ?
>>>
>>>
>>> @Daan, yes I am a Chinese. I am afraid it's not a preblem about
>>> character encodings perhaps.
>>>
>>>
>>> -----------
>>> Cao Tong
>>>
>>> On 08/27/2015 08:54 PM, Abhinandan Prateek wrote:
>>>
>>>> Try using the “8096” port for testing/checking APIs.
>>>>
>>>> shapeblue.com> wrote:
>>>>
>>>>> Yes, as per
>>>>> https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>>>>
>>>>>
>>>>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>>>>>
>>>>>> Hello Every.
>>>>>>
>>>>>> I know this is a very simple question to most of you. but it is
>>>>>> really hard for me to continue my work.
>>>>>>
>>>>>> So could Anyone spend your three minutes to give me some advice, it
>>>>>> will be very usefull to me.
>>>>>>
>>>>>> my question is:
>>>>>>
>>>>>>    How does the parameter startdate/enddate of api listEvents() use
>>>>>> new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>>>>>
>>>>>>
>>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>>>>>>>>>
>>>>>>>>
>>>>>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>>>>>> Traceback (most recent call last):
>>>>>> File "<stdin>", line 1, in <module>
>>>>>> File "SignedAPICall.py", line 67, in Event
>>>>>>    a = api.listEvents(request)
>>>>>> File "SignedAPICall.py", line 49, in handlerFunction
>>>>>>    return self._make_request(name, args[0])
>>>>>> File "SignedAPICall.py", line 61, in _make_request
>>>>>>    data = self._http_get(self.value)
>>>>>> File "SignedAPICall.py", line 54, in _http_get
>>>>>>    response = urllib.urlopen(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>    return opener.open(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>    return getattr(self, name)(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>    errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>> instance at 0x7f083da78998>)
>>>>>>
>>>>>> -----------
>>>>>> Cao Tong
>>>>>>
>>>>>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>>>>
>>>>>>> Hi All:
>>>>>>>
>>>>>>>    Does any one have any idea ? Thanks.
>>>>>>>
>>>>>>> -----------
>>>>>>> Cao Tong
>>>>>>>
>>>>>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>>>>
>>>>>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>>>>>
>>>>>>>>           case DATE:
>>>>>>>>                // This piece of code is for maintaining backward
>>>>>>>> compatibility
>>>>>>>>                // and support both the date formats(Bug 9724)
>>>>>>>>
>>>>>>>> Is it related to my problem?  Where can I found the descriptions
>>>>>>>> about BUG9724 ?
>>>>>>>>
>>>>>>>> -----------
>>>>>>>> Cao Tong
>>>>>>>>
>>>>>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>>>>
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>>>>>> It return a error
>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>
>>>>>>>>> Could anyone tell me why ?
>>>>>>>>>
>>>>>>>>> I have read the code
>>>>>>>>> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not
>>>>>>>>> understand what was happening,
>>>>>>>>> it seems authenticate failed, but why??
>>>>>>>>>
>>>>>>>>> -----------
>>>>>>>>> Cao Tong
>>>>>>>>>
>>>>>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd
>>>>>>>>>> HH:mm:ss"
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>>>>>
>>>>>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>>>>>
>>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>>>>>>>>>
>>>>>>>>>>>> Traceback (most recent call last):
>>>>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>>>>>    return self._make_request(name, kwargs)
>>>>>>>>>> File "call.py", line 60, in _make_request
>>>>>>>>>>    data = self._http_get(self.value)
>>>>>>>>>> File "call.py", line 53, in _http_get
>>>>>>>>>>    response = urllib.urlopen(url)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>>>>    return opener.open(url)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>>>>    return getattr(self, name)(url)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>>>>    errcode, errmsg, headers)
>>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in
>>>>>>>>>> http_error_default
>>>>>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>>>>>>>>>> instance at 0x16dca70>)
>>>>>>>>>>
>>>>>>>>>> my ACS version:
>>>>>>>>>>
>>>>>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>>> services
>>>>>
>>>>> IaaS Cloud Design & Build<
>>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>>> CSForge – rapid IaaS deployment framework<
>>>>> http://shapeblue.com/csforge/>
>>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>>> CloudStack Software Engineering<
>>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>>> CloudStack Infrastructure Support<
>>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>>> CloudStack Bootcamp Training Courses<
>>>>> http://shapeblue.com/cloudstack-training/>
>>>>>
>>>>> This email and any attachments to it may be confidential and are
>>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>>> views or opinions expressed are solely those of the author and do not
>>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>>> are not the intended recipient of this email, you must neither take any
>>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>>> contact the sender if you believe you have received this email in error.
>>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>>> Services India LLP is a company incorporated in India and is operated under
>>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>>> company incorporated in Brasil and is operated under license from Shape
>>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>>> a registered trademark.
>>>>>
>>>> Find out more about ShapeBlue and our range of CloudStack related
>>>> services
>>>>
>>>> IaaS Cloud Design & Build<
>>>> http://shapeblue.com/iaas-cloud-design-and-build//>
>>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/
>>>> >
>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>> CloudStack Software Engineering<
>>>> http://shapeblue.com/cloudstack-software-engineering/>
>>>> CloudStack Infrastructure Support<
>>>> http://shapeblue.com/cloudstack-infrastructure-support/>
>>>> CloudStack Bootcamp Training Courses<
>>>> http://shapeblue.com/cloudstack-training/>
>>>>
>>>> This email and any attachments to it may be confidential and are
>>>> intended solely for the use of the individual to whom it is addressed. Any
>>>> views or opinions expressed are solely those of the author and do not
>>>> necessarily represent those of Shape Blue Ltd or related companies. If you
>>>> are not the intended recipient of this email, you must neither take any
>>>> action based upon its contents, nor copy or show it to anyone. Please
>>>> contact the sender if you believe you have received this email in error.
>>>> Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue
>>>> Services India LLP is a company incorporated in India and is operated under
>>>> license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a
>>>> company incorporated in Brasil and is operated under license from Shape
>>>> Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of
>>>> South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is
>>>> a registered trademark.
>>>>
>>>
>>>
>>> Find out more about ShapeBlue and our range of CloudStack related
>> services
>>
>> IaaS Cloud Design & Build<
>> http://shapeblue.com/iaas-cloud-design-and-build//>
>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>> CloudStack Software Engineering<
>> http://shapeblue.com/cloudstack-software-engineering/>
>> CloudStack Infrastructure Support<
>> http://shapeblue.com/cloudstack-infrastructure-support/>
>> CloudStack Bootcamp Training Courses<
>> http://shapeblue.com/cloudstack-training/>
>>
>> This email and any attachments to it may be confidential and are intended
>> solely for the use of the individual to whom it is addressed. Any views or
>> opinions expressed are solely those of the author and do not necessarily
>> represent those of Shape Blue Ltd or related companies. If you are not the
>> intended recipient of this email, you must neither take any action based
>> upon its contents, nor copy or show it to anyone. Please contact the sender
>> if you believe you have received this email in error. Shape Blue Ltd is a
>> company incorporated in England & Wales. ShapeBlue Services India LLP is a
>> company incorporated in India and is operated under license from Shape Blue
>> Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil
>> and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is
>> a company registered by The Republic of South Africa and is traded under
>> license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>>
>
>
>
>

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Daan Hoogland <da...@gmail.com>.
On Fri, Aug 28, 2015 at 10:40 AM, <to...@163.com> wrote:

> 2015-08-28+16%3A20%3A00


​very convincing , Coa Tong. Something is wrong in the calculation of the
signature on this string. It seems to work for other people so can you
provide environmental data:
os version
cloustack version
language setting (both on server and client side)
client library version.
​​
​The problem might be in one of those. If there is any other setting you
can think of please provide it as well.​



-- 
Daan

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by to...@163.com.

My scripts is just from cloudstack website
https://cwiki.apache.org/confluence/display/CLOUDSTACK/Simple+class+for+making+API+calls%2C+Python

and I just do some testing like this:

1. >>> from SignedAPICall import api
2. >>> api.listEvents(listall='true', startdate='2015-08-28')
3. >>> api.listEvents(listall='true', startdate='2015-08-28 16:20:00')

Line 2 works fine, line 3 failed with error " 'http error', 401, 
'Unauthorized' ".

I also do some other tests, they also works fine, like api.listHosts()  
api.listVirtualMachines().

when line 3 failed,  management-server.log said this:

2015-08-28 16:37:53,619 DEBUG [c.c.a.ApiServlet] 
(catalina-exec-15:ctx-4e587804) ===START===  10.0.1.99 -- GET 
apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
2015-08-28 16:37:53,622 INFO  [c.c.a.ApiServer] 
(catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) User signature: 
r7wa861jYWP4QbNMeEjZZ2wNpIc= is not equaled to computed signature: 
4c8Kmn+cbMZAmfSvSISPkWt9WCQ=
2015-08-28 16:37:53,622 DEBUG [c.c.a.ApiServlet] 
(catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) ===END===  10.0.1.99 -- GET 
apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D

following for line 2:
2015-08-28 16:37:15,900 DEBUG [c.c.a.ApiServlet] 
(catalina-exec-13:ctx-f8019189) ===START===  10.0.1.99 -- GET 
apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
2015-08-28 16:37:15,939 DEBUG [c.c.a.ApiServlet] 
(catalina-exec-13:ctx-f8019189 ctx-c42b8c5e ctx-1ebbe226) ===END=== 
10.0.1.99 -- GET 
apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D



-----------
Cao Tong

On 08/28/2015 02:09 PM, Abhinandan Prateek wrote:
> apikey/signature should work and they have same privileges as the respective user logged in.
> Are all the api calls failing or just some ?
> Can you share relevant portion of the scripts that you are trying to run ?
>
>> On 28-Aug-2015, at 11:31 am, tony_caotong@163.com wrote:
>>
>>
>> Thanks for all your people's replys.
>>
>> 1.  Abhinandan,  My ACS manager was not listening on port '8096',
>>
>> 2.  As Yipeng said, When I call this api from cloudmonkey, it works fine, like this
>>     " cloudmonkey api listEvents listall=true startdate='2015-08-28 00:00:00' "
>>
>>     When I call it through my python scripts, I used the apikey/signature pair to work,  but it failed.
>>     I found that how cloudmonkey works,
>>     first it login with username/password, then call the function with this session id.
>>
>> it seems that the apikey/signature pair's privilege is not same with username/password pair's ?
>>
>>
>> @Daan, yes I am a Chinese. I am afraid it's not a preblem about character encodings perhaps.
>>
>>
>> -----------
>> Cao Tong
>>
>> On 08/27/2015 08:54 PM, Abhinandan Prateek wrote:
>>> Try using the “8096” port for testing/checking APIs.
>>>
>>> shapeblue.com> wrote:
>>>> Yes, as per  https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>>>
>>>>
>>>>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>>>>
>>>>> Hello Every.
>>>>>
>>>>> I know this is a very simple question to most of you. but it is really hard for me to continue my work.
>>>>>
>>>>> So could Anyone spend your three minutes to give me some advice, it will be very usefull to me.
>>>>>
>>>>> my question is:
>>>>>
>>>>>    How does the parameter startdate/enddate of api listEvents() use new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>>>>
>>>>>
>>>>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>>>>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>>>>> Traceback (most recent call last):
>>>>> File "<stdin>", line 1, in <module>
>>>>> File "SignedAPICall.py", line 67, in Event
>>>>>    a = api.listEvents(request)
>>>>> File "SignedAPICall.py", line 49, in handlerFunction
>>>>>    return self._make_request(name, args[0])
>>>>> File "SignedAPICall.py", line 61, in _make_request
>>>>>    data = self._http_get(self.value)
>>>>> File "SignedAPICall.py", line 54, in _http_get
>>>>>    response = urllib.urlopen(url)
>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>    return opener.open(url)
>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>    return getattr(self, name)(url)
>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>    errcode, errmsg, headers)
>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x7f083da78998>)
>>>>>
>>>>> -----------
>>>>> Cao Tong
>>>>>
>>>>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>>>> Hi All:
>>>>>>
>>>>>>    Does any one have any idea ? Thanks.
>>>>>>
>>>>>> -----------
>>>>>> Cao Tong
>>>>>>
>>>>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>>>>
>>>>>>>           case DATE:
>>>>>>>                // This piece of code is for maintaining backward compatibility
>>>>>>>                // and support both the date formats(Bug 9724)
>>>>>>>
>>>>>>> Is it related to my problem?  Where can I found the descriptions about BUG9724 ?
>>>>>>>
>>>>>>> -----------
>>>>>>> Cao Tong
>>>>>>>
>>>>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>>>>> It return a error
>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>>>
>>>>>>>> Could anyone tell me why ?
>>>>>>>>
>>>>>>>> I have read the code "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not understand what was happening,
>>>>>>>> it seems authenticate failed, but why??
>>>>>>>>
>>>>>>>> -----------
>>>>>>>> Cao Tong
>>>>>>>>
>>>>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>>>>
>>>>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>>>>
>>>>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>>>>> Traceback (most recent call last):
>>>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>>>>    return self._make_request(name, kwargs)
>>>>>>>>> File "call.py", line 60, in _make_request
>>>>>>>>>    data = self._http_get(self.value)
>>>>>>>>> File "call.py", line 53, in _http_get
>>>>>>>>>    response = urllib.urlopen(url)
>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>>>    return opener.open(url)
>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>>>    return getattr(self, name)(url)
>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>>>    errcode, errmsg, headers)
>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>>>>
>>>>>>>>> my ACS version:
>>>>>>>>>
>>>>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>
>>>>>>>>>
>>>> Find out more about ShapeBlue and our range of CloudStack related services
>>>>
>>>> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
>>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
>>>> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
>>>> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>>>>
>>>> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>>> Find out more about ShapeBlue and our range of CloudStack related services
>>>
>>> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
>>> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
>>> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>>>
>>> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>>
>>
> Find out more about ShapeBlue and our range of CloudStack related services
>
> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>
> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.




Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by to...@163.com.

My scripts is just from cloudstack website
https://cwiki.apache.org/confluence/display/CLOUDSTACK/Simple+class+for+making+API+calls%2C+Python

and I just do some testing like this:

1. >>> from SignedAPICall import api
2. >>> api.listEvents(listall='true', startdate='2015-08-28')
3. >>> api.listEvents(listall='true', startdate='2015-08-28 16:20:00')

Line 2 works fine, line 3 failed with error " 'http error', 401, 
'Unauthorized' ".

I also do some other tests, they also works fine, like api.listHosts()  
api.listVirtualMachines().

when line 3 failed,  management-server.log said this:

2015-08-28 16:37:53,619 DEBUG [c.c.a.ApiServlet] 
(catalina-exec-15:ctx-4e587804) ===START===  10.0.1.99 -- GET 
apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
2015-08-28 16:37:53,622 INFO  [c.c.a.ApiServer] 
(catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) User signature: 
r7wa861jYWP4QbNMeEjZZ2wNpIc= is not equaled to computed signature: 
4c8Kmn+cbMZAmfSvSISPkWt9WCQ=
2015-08-28 16:37:53,622 DEBUG [c.c.a.ApiServlet] 
(catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) ===END===  10.0.1.99 -- GET 
apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D

following for line 2:
2015-08-28 16:37:15,900 DEBUG [c.c.a.ApiServlet] 
(catalina-exec-13:ctx-f8019189) ===START===  10.0.1.99 -- GET 
apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
2015-08-28 16:37:15,939 DEBUG [c.c.a.ApiServlet] 
(catalina-exec-13:ctx-f8019189 ctx-c42b8c5e ctx-1ebbe226) ===END=== 
10.0.1.99 -- GET 
apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D



-----------
Cao Tong

On 08/28/2015 02:09 PM, Abhinandan Prateek wrote:
> apikey/signature should work and they have same privileges as the respective user logged in.
> Are all the api calls failing or just some ?
> Can you share relevant portion of the scripts that you are trying to run ?
>
>> On 28-Aug-2015, at 11:31 am, tony_caotong@163.com wrote:
>>
>>
>> Thanks for all your people's replys.
>>
>> 1.  Abhinandan,  My ACS manager was not listening on port '8096',
>>
>> 2.  As Yipeng said, When I call this api from cloudmonkey, it works fine, like this
>>     " cloudmonkey api listEvents listall=true startdate='2015-08-28 00:00:00' "
>>
>>     When I call it through my python scripts, I used the apikey/signature pair to work,  but it failed.
>>     I found that how cloudmonkey works,
>>     first it login with username/password, then call the function with this session id.
>>
>> it seems that the apikey/signature pair's privilege is not same with username/password pair's ?
>>
>>
>> @Daan, yes I am a Chinese. I am afraid it's not a preblem about character encodings perhaps.
>>
>>
>> -----------
>> Cao Tong
>>
>> On 08/27/2015 08:54 PM, Abhinandan Prateek wrote:
>>> Try using the “8096” port for testing/checking APIs.
>>>
>>> shapeblue.com> wrote:
>>>> Yes, as per  https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>>>
>>>>
>>>>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>>>>
>>>>> Hello Every.
>>>>>
>>>>> I know this is a very simple question to most of you. but it is really hard for me to continue my work.
>>>>>
>>>>> So could Anyone spend your three minutes to give me some advice, it will be very usefull to me.
>>>>>
>>>>> my question is:
>>>>>
>>>>>    How does the parameter startdate/enddate of api listEvents() use new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>>>>
>>>>>
>>>>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>>>>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>>>>> Traceback (most recent call last):
>>>>> File "<stdin>", line 1, in <module>
>>>>> File "SignedAPICall.py", line 67, in Event
>>>>>    a = api.listEvents(request)
>>>>> File "SignedAPICall.py", line 49, in handlerFunction
>>>>>    return self._make_request(name, args[0])
>>>>> File "SignedAPICall.py", line 61, in _make_request
>>>>>    data = self._http_get(self.value)
>>>>> File "SignedAPICall.py", line 54, in _http_get
>>>>>    response = urllib.urlopen(url)
>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>    return opener.open(url)
>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>    return getattr(self, name)(url)
>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>    errcode, errmsg, headers)
>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x7f083da78998>)
>>>>>
>>>>> -----------
>>>>> Cao Tong
>>>>>
>>>>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>>>> Hi All:
>>>>>>
>>>>>>    Does any one have any idea ? Thanks.
>>>>>>
>>>>>> -----------
>>>>>> Cao Tong
>>>>>>
>>>>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>>>>
>>>>>>>           case DATE:
>>>>>>>                // This piece of code is for maintaining backward compatibility
>>>>>>>                // and support both the date formats(Bug 9724)
>>>>>>>
>>>>>>> Is it related to my problem?  Where can I found the descriptions about BUG9724 ?
>>>>>>>
>>>>>>> -----------
>>>>>>> Cao Tong
>>>>>>>
>>>>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>>>>> It return a error
>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>>>
>>>>>>>> Could anyone tell me why ?
>>>>>>>>
>>>>>>>> I have read the code "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not understand what was happening,
>>>>>>>> it seems authenticate failed, but why??
>>>>>>>>
>>>>>>>> -----------
>>>>>>>> Cao Tong
>>>>>>>>
>>>>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>>>>
>>>>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>>>>
>>>>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>>>>> Traceback (most recent call last):
>>>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>>>>    return self._make_request(name, kwargs)
>>>>>>>>> File "call.py", line 60, in _make_request
>>>>>>>>>    data = self._http_get(self.value)
>>>>>>>>> File "call.py", line 53, in _http_get
>>>>>>>>>    response = urllib.urlopen(url)
>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>>>    return opener.open(url)
>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>>>    return getattr(self, name)(url)
>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>>>    errcode, errmsg, headers)
>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>>>>
>>>>>>>>> my ACS version:
>>>>>>>>>
>>>>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>
>>>>>>>>>
>>>> Find out more about ShapeBlue and our range of CloudStack related services
>>>>
>>>> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
>>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
>>>> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
>>>> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>>>>
>>>> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>>> Find out more about ShapeBlue and our range of CloudStack related services
>>>
>>> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
>>> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
>>> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>>>
>>> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>>
>>
> Find out more about ShapeBlue and our range of CloudStack related services
>
> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>
> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.




Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by to...@163.com.

My scripts is just from cloudstack website
https://cwiki.apache.org/confluence/display/CLOUDSTACK/Simple+class+for+making+API+calls%2C+Python

and I just do some testing like this:

1. >>> from SignedAPICall import api
2. >>> api.listEvents(listall='true', startdate='2015-08-28')
3. >>> api.listEvents(listall='true', startdate='2015-08-28 16:20:00')

Line 2 works fine, line 3 failed with error " 'http error', 401, 
'Unauthorized' ".

I also do some other tests, they also works fine, like api.listHosts()  
api.listVirtualMachines().

when line 3 failed,  management-server.log said this:

2015-08-28 16:37:53,619 DEBUG [c.c.a.ApiServlet] 
(catalina-exec-15:ctx-4e587804) ===START===  10.0.1.99 -- GET 
apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D
2015-08-28 16:37:53,622 INFO  [c.c.a.ApiServer] 
(catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) User signature: 
r7wa861jYWP4QbNMeEjZZ2wNpIc= is not equaled to computed signature: 
4c8Kmn+cbMZAmfSvSISPkWt9WCQ=
2015-08-28 16:37:53,622 DEBUG [c.c.a.ApiServlet] 
(catalina-exec-15:ctx-4e587804 ctx-1f6fddbe) ===END===  10.0.1.99 -- GET 
apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28+16%3A20%3A00&signature=r7wa861jYWP4QbNMeEjZZ2wNpIc%3D

following for line 2:
2015-08-28 16:37:15,900 DEBUG [c.c.a.ApiServlet] 
(catalina-exec-13:ctx-f8019189) ===START===  10.0.1.99 -- GET 
apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D
2015-08-28 16:37:15,939 DEBUG [c.c.a.ApiServlet] 
(catalina-exec-13:ctx-f8019189 ctx-c42b8c5e ctx-1ebbe226) ===END=== 
10.0.1.99 -- GET 
apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=true&response=json&startdate=2015-08-28&signature=KZZIAOaRduzCJlo0byaN9j4uvro%3D



-----------
Cao Tong

On 08/28/2015 02:09 PM, Abhinandan Prateek wrote:
> apikey/signature should work and they have same privileges as the respective user logged in.
> Are all the api calls failing or just some ?
> Can you share relevant portion of the scripts that you are trying to run ?
>
>> On 28-Aug-2015, at 11:31 am, tony_caotong@163.com wrote:
>>
>>
>> Thanks for all your people's replys.
>>
>> 1.  Abhinandan,  My ACS manager was not listening on port '8096',
>>
>> 2.  As Yipeng said, When I call this api from cloudmonkey, it works fine, like this
>>     " cloudmonkey api listEvents listall=true startdate='2015-08-28 00:00:00' "
>>
>>     When I call it through my python scripts, I used the apikey/signature pair to work,  but it failed.
>>     I found that how cloudmonkey works,
>>     first it login with username/password, then call the function with this session id.
>>
>> it seems that the apikey/signature pair's privilege is not same with username/password pair's ?
>>
>>
>> @Daan, yes I am a Chinese. I am afraid it's not a preblem about character encodings perhaps.
>>
>>
>> -----------
>> Cao Tong
>>
>> On 08/27/2015 08:54 PM, Abhinandan Prateek wrote:
>>> Try using the “8096” port for testing/checking APIs.
>>>
>>> shapeblue.com> wrote:
>>>> Yes, as per  https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>>>
>>>>
>>>>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>>>>
>>>>> Hello Every.
>>>>>
>>>>> I know this is a very simple question to most of you. but it is really hard for me to continue my work.
>>>>>
>>>>> So could Anyone spend your three minutes to give me some advice, it will be very usefull to me.
>>>>>
>>>>> my question is:
>>>>>
>>>>>    How does the parameter startdate/enddate of api listEvents() use new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>>>>
>>>>>
>>>>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>>>>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>>>>> Traceback (most recent call last):
>>>>> File "<stdin>", line 1, in <module>
>>>>> File "SignedAPICall.py", line 67, in Event
>>>>>    a = api.listEvents(request)
>>>>> File "SignedAPICall.py", line 49, in handlerFunction
>>>>>    return self._make_request(name, args[0])
>>>>> File "SignedAPICall.py", line 61, in _make_request
>>>>>    data = self._http_get(self.value)
>>>>> File "SignedAPICall.py", line 54, in _http_get
>>>>>    response = urllib.urlopen(url)
>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>    return opener.open(url)
>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>    return getattr(self, name)(url)
>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>    errcode, errmsg, headers)
>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x7f083da78998>)
>>>>>
>>>>> -----------
>>>>> Cao Tong
>>>>>
>>>>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>>>> Hi All:
>>>>>>
>>>>>>    Does any one have any idea ? Thanks.
>>>>>>
>>>>>> -----------
>>>>>> Cao Tong
>>>>>>
>>>>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>>>>
>>>>>>>           case DATE:
>>>>>>>                // This piece of code is for maintaining backward compatibility
>>>>>>>                // and support both the date formats(Bug 9724)
>>>>>>>
>>>>>>> Is it related to my problem?  Where can I found the descriptions about BUG9724 ?
>>>>>>>
>>>>>>> -----------
>>>>>>> Cao Tong
>>>>>>>
>>>>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>>>>> It return a error
>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>>>
>>>>>>>> Could anyone tell me why ?
>>>>>>>>
>>>>>>>> I have read the code "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not understand what was happening,
>>>>>>>> it seems authenticate failed, but why??
>>>>>>>>
>>>>>>>> -----------
>>>>>>>> Cao Tong
>>>>>>>>
>>>>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>>>>
>>>>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>>>>
>>>>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>>>>> Traceback (most recent call last):
>>>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>>>>    return self._make_request(name, kwargs)
>>>>>>>>> File "call.py", line 60, in _make_request
>>>>>>>>>    data = self._http_get(self.value)
>>>>>>>>> File "call.py", line 53, in _http_get
>>>>>>>>>    response = urllib.urlopen(url)
>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>>>    return opener.open(url)
>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>>>    return getattr(self, name)(url)
>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>>>    errcode, errmsg, headers)
>>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>>>>
>>>>>>>>> my ACS version:
>>>>>>>>>
>>>>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>>
>>>>>>>>>
>>>> Find out more about ShapeBlue and our range of CloudStack related services
>>>>
>>>> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
>>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>>> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
>>>> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
>>>> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>>>>
>>>> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>>> Find out more about ShapeBlue and our range of CloudStack related services
>>>
>>> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
>>> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
>>> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>>>
>>> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>>
>>
> Find out more about ShapeBlue and our range of CloudStack related services
>
> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>
> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.




Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Abhinandan Prateek <ab...@shapeblue.com>.
apikey/signature should work and they have same privileges as the respective user logged in.
Are all the api calls failing or just some ?
Can you share relevant portion of the scripts that you are trying to run ?

> On 28-Aug-2015, at 11:31 am, tony_caotong@163.com wrote:
>
>
> Thanks for all your people's replys.
>
> 1.  Abhinandan,  My ACS manager was not listening on port '8096',
>
> 2.  As Yipeng said, When I call this api from cloudmonkey, it works fine, like this
>    " cloudmonkey api listEvents listall=true startdate='2015-08-28 00:00:00' "
>
>    When I call it through my python scripts, I used the apikey/signature pair to work,  but it failed.
>    I found that how cloudmonkey works,
>    first it login with username/password, then call the function with this session id.
>
> it seems that the apikey/signature pair's privilege is not same with username/password pair's ?
>
>
> @Daan, yes I am a Chinese. I am afraid it's not a preblem about character encodings perhaps.
>
>
> -----------
> Cao Tong
>
> On 08/27/2015 08:54 PM, Abhinandan Prateek wrote:
>> Try using the “8096” port for testing/checking APIs.
>>
>> shapeblue.com> wrote:
>>> Yes, as per  https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>>
>>>
>>>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>>>
>>>> Hello Every.
>>>>
>>>> I know this is a very simple question to most of you. but it is really hard for me to continue my work.
>>>>
>>>> So could Anyone spend your three minutes to give me some advice, it will be very usefull to me.
>>>>
>>>> my question is:
>>>>
>>>>   How does the parameter startdate/enddate of api listEvents() use new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>>>
>>>>
>>>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>>>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>>>> Traceback (most recent call last):
>>>> File "<stdin>", line 1, in <module>
>>>> File "SignedAPICall.py", line 67, in Event
>>>>   a = api.listEvents(request)
>>>> File "SignedAPICall.py", line 49, in handlerFunction
>>>>   return self._make_request(name, args[0])
>>>> File "SignedAPICall.py", line 61, in _make_request
>>>>   data = self._http_get(self.value)
>>>> File "SignedAPICall.py", line 54, in _http_get
>>>>   response = urllib.urlopen(url)
>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>   return opener.open(url)
>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>   return getattr(self, name)(url)
>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>   return self.http_error(url, fp, errcode, errmsg, headers)
>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>   result = method(url, fp, errcode, errmsg, headers)
>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>   errcode, errmsg, headers)
>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>   raise IOError, ('http error', errcode, errmsg, headers)
>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x7f083da78998>)
>>>>
>>>> -----------
>>>> Cao Tong
>>>>
>>>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>>> Hi All:
>>>>>
>>>>>   Does any one have any idea ? Thanks.
>>>>>
>>>>> -----------
>>>>> Cao Tong
>>>>>
>>>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>>>
>>>>>>          case DATE:
>>>>>>               // This piece of code is for maintaining backward compatibility
>>>>>>               // and support both the date formats(Bug 9724)
>>>>>>
>>>>>> Is it related to my problem?  Where can I found the descriptions about BUG9724 ?
>>>>>>
>>>>>> -----------
>>>>>> Cao Tong
>>>>>>
>>>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>>> Hello,
>>>>>>>
>>>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>>>> It return a error
>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>>
>>>>>>> Could anyone tell me why ?
>>>>>>>
>>>>>>> I have read the code "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not understand what was happening,
>>>>>>> it seems authenticate failed, but why??
>>>>>>>
>>>>>>> -----------
>>>>>>> Cao Tong
>>>>>>>
>>>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>>   was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>>>>>>>>
>>>>>>>>
>>>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>>>
>>>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>>>
>>>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>>>> Traceback (most recent call last):
>>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>>>   return self._make_request(name, kwargs)
>>>>>>>> File "call.py", line 60, in _make_request
>>>>>>>>   data = self._http_get(self.value)
>>>>>>>> File "call.py", line 53, in _http_get
>>>>>>>>   response = urllib.urlopen(url)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>>   return opener.open(url)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>>   return getattr(self, name)(url)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>>   return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>>   result = method(url, fp, errcode, errmsg, headers)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>>   errcode, errmsg, headers)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>>>   raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>>>
>>>>>>>> my ACS version:
>>>>>>>>
>>>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>> Find out more about ShapeBlue and our range of CloudStack related services
>>>
>>> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
>>> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
>>> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>>>
>>> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>> Find out more about ShapeBlue and our range of CloudStack related services
>>
>> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
>> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
>> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>>
>> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>
>
>

Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Abhinandan Prateek <ab...@shapeblue.com>.
apikey/signature should work and they have same privileges as the respective user logged in.
Are all the api calls failing or just some ?
Can you share relevant portion of the scripts that you are trying to run ?

> On 28-Aug-2015, at 11:31 am, tony_caotong@163.com wrote:
>
>
> Thanks for all your people's replys.
>
> 1.  Abhinandan,  My ACS manager was not listening on port '8096',
>
> 2.  As Yipeng said, When I call this api from cloudmonkey, it works fine, like this
>    " cloudmonkey api listEvents listall=true startdate='2015-08-28 00:00:00' "
>
>    When I call it through my python scripts, I used the apikey/signature pair to work,  but it failed.
>    I found that how cloudmonkey works,
>    first it login with username/password, then call the function with this session id.
>
> it seems that the apikey/signature pair's privilege is not same with username/password pair's ?
>
>
> @Daan, yes I am a Chinese. I am afraid it's not a preblem about character encodings perhaps.
>
>
> -----------
> Cao Tong
>
> On 08/27/2015 08:54 PM, Abhinandan Prateek wrote:
>> Try using the “8096” port for testing/checking APIs.
>>
>> shapeblue.com> wrote:
>>> Yes, as per  https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>>
>>>
>>>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>>>
>>>> Hello Every.
>>>>
>>>> I know this is a very simple question to most of you. but it is really hard for me to continue my work.
>>>>
>>>> So could Anyone spend your three minutes to give me some advice, it will be very usefull to me.
>>>>
>>>> my question is:
>>>>
>>>>   How does the parameter startdate/enddate of api listEvents() use new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>>>
>>>>
>>>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>>>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>>>> Traceback (most recent call last):
>>>> File "<stdin>", line 1, in <module>
>>>> File "SignedAPICall.py", line 67, in Event
>>>>   a = api.listEvents(request)
>>>> File "SignedAPICall.py", line 49, in handlerFunction
>>>>   return self._make_request(name, args[0])
>>>> File "SignedAPICall.py", line 61, in _make_request
>>>>   data = self._http_get(self.value)
>>>> File "SignedAPICall.py", line 54, in _http_get
>>>>   response = urllib.urlopen(url)
>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>   return opener.open(url)
>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>   return getattr(self, name)(url)
>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>   return self.http_error(url, fp, errcode, errmsg, headers)
>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>   result = method(url, fp, errcode, errmsg, headers)
>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>   errcode, errmsg, headers)
>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>   raise IOError, ('http error', errcode, errmsg, headers)
>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x7f083da78998>)
>>>>
>>>> -----------
>>>> Cao Tong
>>>>
>>>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>>> Hi All:
>>>>>
>>>>>   Does any one have any idea ? Thanks.
>>>>>
>>>>> -----------
>>>>> Cao Tong
>>>>>
>>>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>>>
>>>>>>          case DATE:
>>>>>>               // This piece of code is for maintaining backward compatibility
>>>>>>               // and support both the date formats(Bug 9724)
>>>>>>
>>>>>> Is it related to my problem?  Where can I found the descriptions about BUG9724 ?
>>>>>>
>>>>>> -----------
>>>>>> Cao Tong
>>>>>>
>>>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>>> Hello,
>>>>>>>
>>>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>>>> It return a error
>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>>
>>>>>>> Could anyone tell me why ?
>>>>>>>
>>>>>>> I have read the code "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not understand what was happening,
>>>>>>> it seems authenticate failed, but why??
>>>>>>>
>>>>>>> -----------
>>>>>>> Cao Tong
>>>>>>>
>>>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>>   was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>>>>>>>>
>>>>>>>>
>>>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>>>
>>>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>>>
>>>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>>>> Traceback (most recent call last):
>>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>>>   return self._make_request(name, kwargs)
>>>>>>>> File "call.py", line 60, in _make_request
>>>>>>>>   data = self._http_get(self.value)
>>>>>>>> File "call.py", line 53, in _http_get
>>>>>>>>   response = urllib.urlopen(url)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>>   return opener.open(url)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>>   return getattr(self, name)(url)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>>   return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>>   result = method(url, fp, errcode, errmsg, headers)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>>   errcode, errmsg, headers)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>>>   raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>>>
>>>>>>>> my ACS version:
>>>>>>>>
>>>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>> Find out more about ShapeBlue and our range of CloudStack related services
>>>
>>> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
>>> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
>>> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>>>
>>> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>> Find out more about ShapeBlue and our range of CloudStack related services
>>
>> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
>> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
>> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>>
>> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>
>
>

Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Abhinandan Prateek <ab...@shapeblue.com>.
apikey/signature should work and they have same privileges as the respective user logged in.
Are all the api calls failing or just some ?
Can you share relevant portion of the scripts that you are trying to run ?

> On 28-Aug-2015, at 11:31 am, tony_caotong@163.com wrote:
>
>
> Thanks for all your people's replys.
>
> 1.  Abhinandan,  My ACS manager was not listening on port '8096',
>
> 2.  As Yipeng said, When I call this api from cloudmonkey, it works fine, like this
>    " cloudmonkey api listEvents listall=true startdate='2015-08-28 00:00:00' "
>
>    When I call it through my python scripts, I used the apikey/signature pair to work,  but it failed.
>    I found that how cloudmonkey works,
>    first it login with username/password, then call the function with this session id.
>
> it seems that the apikey/signature pair's privilege is not same with username/password pair's ?
>
>
> @Daan, yes I am a Chinese. I am afraid it's not a preblem about character encodings perhaps.
>
>
> -----------
> Cao Tong
>
> On 08/27/2015 08:54 PM, Abhinandan Prateek wrote:
>> Try using the “8096” port for testing/checking APIs.
>>
>> shapeblue.com> wrote:
>>> Yes, as per  https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>>
>>>
>>>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>>>
>>>> Hello Every.
>>>>
>>>> I know this is a very simple question to most of you. but it is really hard for me to continue my work.
>>>>
>>>> So could Anyone spend your three minutes to give me some advice, it will be very usefull to me.
>>>>
>>>> my question is:
>>>>
>>>>   How does the parameter startdate/enddate of api listEvents() use new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>>>
>>>>
>>>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>>>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>>>> Traceback (most recent call last):
>>>> File "<stdin>", line 1, in <module>
>>>> File "SignedAPICall.py", line 67, in Event
>>>>   a = api.listEvents(request)
>>>> File "SignedAPICall.py", line 49, in handlerFunction
>>>>   return self._make_request(name, args[0])
>>>> File "SignedAPICall.py", line 61, in _make_request
>>>>   data = self._http_get(self.value)
>>>> File "SignedAPICall.py", line 54, in _http_get
>>>>   response = urllib.urlopen(url)
>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>   return opener.open(url)
>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>   return getattr(self, name)(url)
>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>   return self.http_error(url, fp, errcode, errmsg, headers)
>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>   result = method(url, fp, errcode, errmsg, headers)
>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>   errcode, errmsg, headers)
>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>   raise IOError, ('http error', errcode, errmsg, headers)
>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x7f083da78998>)
>>>>
>>>> -----------
>>>> Cao Tong
>>>>
>>>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>>> Hi All:
>>>>>
>>>>>   Does any one have any idea ? Thanks.
>>>>>
>>>>> -----------
>>>>> Cao Tong
>>>>>
>>>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>>>
>>>>>>          case DATE:
>>>>>>               // This piece of code is for maintaining backward compatibility
>>>>>>               // and support both the date formats(Bug 9724)
>>>>>>
>>>>>> Is it related to my problem?  Where can I found the descriptions about BUG9724 ?
>>>>>>
>>>>>> -----------
>>>>>> Cao Tong
>>>>>>
>>>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>>> Hello,
>>>>>>>
>>>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>>>> It return a error
>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>>
>>>>>>> Could anyone tell me why ?
>>>>>>>
>>>>>>> I have read the code "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not understand what was happening,
>>>>>>> it seems authenticate failed, but why??
>>>>>>>
>>>>>>> -----------
>>>>>>> Cao Tong
>>>>>>>
>>>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>>   was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>>>>>>>>
>>>>>>>>
>>>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>>>
>>>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>>>
>>>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>>>> Traceback (most recent call last):
>>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>>>   return self._make_request(name, kwargs)
>>>>>>>> File "call.py", line 60, in _make_request
>>>>>>>>   data = self._http_get(self.value)
>>>>>>>> File "call.py", line 53, in _http_get
>>>>>>>>   response = urllib.urlopen(url)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>>   return opener.open(url)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>>   return getattr(self, name)(url)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>>   return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>>   result = method(url, fp, errcode, errmsg, headers)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>>   errcode, errmsg, headers)
>>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>>>   raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>>>
>>>>>>>> my ACS version:
>>>>>>>>
>>>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>> Find out more about ShapeBlue and our range of CloudStack related services
>>>
>>> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
>>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>>> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
>>> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
>>> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>>>
>>> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>> Find out more about ShapeBlue and our range of CloudStack related services
>>
>> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
>> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
>> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>>
>> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>
>
>

Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by to...@163.com.
Thanks for all your people's replys.

1.  Abhinandan,  My ACS manager was not listening on port '8096',

2.  As Yipeng said, When I call this api from cloudmonkey, it works 
fine, like this
     " cloudmonkey api listEvents listall=true startdate='2015-08-28 
00:00:00' "

     When I call it through my python scripts, I used the 
apikey/signature pair to work,  but it failed.
     I found that how cloudmonkey works,
     first it login with username/password, then call the function with 
this session id.

it seems that the apikey/signature pair's privilege is not same with 
username/password pair's ?


@Daan, yes I am a Chinese. I am afraid it's not a preblem about 
character encodings perhaps.


-----------
Cao Tong

On 08/27/2015 08:54 PM, Abhinandan Prateek wrote:
> Try using the “8096” port for testing/checking APIs.
>
> shapeblue.com> wrote:
>> Yes, as per  https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>
>>
>>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>>
>>> Hello Every.
>>>
>>> I know this is a very simple question to most of you. but it is really hard for me to continue my work.
>>>
>>> So could Anyone spend your three minutes to give me some advice, it will be very usefull to me.
>>>
>>> my question is:
>>>
>>>    How does the parameter startdate/enddate of api listEvents() use new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>>
>>>
>>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in <module>
>>> File "SignedAPICall.py", line 67, in Event
>>>    a = api.listEvents(request)
>>> File "SignedAPICall.py", line 49, in handlerFunction
>>>    return self._make_request(name, args[0])
>>> File "SignedAPICall.py", line 61, in _make_request
>>>    data = self._http_get(self.value)
>>> File "SignedAPICall.py", line 54, in _http_get
>>>    response = urllib.urlopen(url)
>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>    return opener.open(url)
>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>    return getattr(self, name)(url)
>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>    result = method(url, fp, errcode, errmsg, headers)
>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>    errcode, errmsg, headers)
>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x7f083da78998>)
>>>
>>> -----------
>>> Cao Tong
>>>
>>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>> Hi All:
>>>>
>>>>    Does any one have any idea ? Thanks.
>>>>
>>>> -----------
>>>> Cao Tong
>>>>
>>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>>
>>>>>           case DATE:
>>>>>                // This piece of code is for maintaining backward compatibility
>>>>>                // and support both the date formats(Bug 9724)
>>>>>
>>>>> Is it related to my problem?  Where can I found the descriptions about BUG9724 ?
>>>>>
>>>>> -----------
>>>>> Cao Tong
>>>>>
>>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>> Hello,
>>>>>>
>>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>>> It return a error
>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>
>>>>>> Could anyone tell me why ?
>>>>>>
>>>>>> I have read the code "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not understand what was happening,
>>>>>> it seems authenticate failed, but why??
>>>>>>
>>>>>> -----------
>>>>>> Cao Tong
>>>>>>
>>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>>>>>>>
>>>>>>>
>>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>>
>>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>>
>>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>>> Traceback (most recent call last):
>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>>    return self._make_request(name, kwargs)
>>>>>>> File "call.py", line 60, in _make_request
>>>>>>>    data = self._http_get(self.value)
>>>>>>> File "call.py", line 53, in _http_get
>>>>>>>    response = urllib.urlopen(url)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>    return opener.open(url)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>    return getattr(self, name)(url)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>    errcode, errmsg, headers)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>>
>>>>>>> my ACS version:
>>>>>>>
>>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>> Find out more about ShapeBlue and our range of CloudStack related services
>>
>> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
>> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
>> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>>
>> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.
> Find out more about ShapeBlue and our range of CloudStack related services
>
> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>
> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.




Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by to...@163.com.
Thanks for all your people's replys.

1.  Abhinandan,  My ACS manager was not listening on port '8096',

2.  As Yipeng said, When I call this api from cloudmonkey, it works 
fine, like this
     " cloudmonkey api listEvents listall=true startdate='2015-08-28 
00:00:00' "

     When I call it through my python scripts, I used the 
apikey/signature pair to work,  but it failed.
     I found that how cloudmonkey works,
     first it login with username/password, then call the function with 
this session id.

it seems that the apikey/signature pair's privilege is not same with 
username/password pair's ?


@Daan, yes I am a Chinese. I am afraid it's not a preblem about 
character encodings perhaps.


-----------
Cao Tong

On 08/27/2015 08:54 PM, Abhinandan Prateek wrote:
> Try using the “8096” port for testing/checking APIs.
>
> shapeblue.com> wrote:
>> Yes, as per  https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>
>>
>>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>>
>>> Hello Every.
>>>
>>> I know this is a very simple question to most of you. but it is really hard for me to continue my work.
>>>
>>> So could Anyone spend your three minutes to give me some advice, it will be very usefull to me.
>>>
>>> my question is:
>>>
>>>    How does the parameter startdate/enddate of api listEvents() use new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>>
>>>
>>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in <module>
>>> File "SignedAPICall.py", line 67, in Event
>>>    a = api.listEvents(request)
>>> File "SignedAPICall.py", line 49, in handlerFunction
>>>    return self._make_request(name, args[0])
>>> File "SignedAPICall.py", line 61, in _make_request
>>>    data = self._http_get(self.value)
>>> File "SignedAPICall.py", line 54, in _http_get
>>>    response = urllib.urlopen(url)
>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>    return opener.open(url)
>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>    return getattr(self, name)(url)
>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>    result = method(url, fp, errcode, errmsg, headers)
>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>    errcode, errmsg, headers)
>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x7f083da78998>)
>>>
>>> -----------
>>> Cao Tong
>>>
>>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>> Hi All:
>>>>
>>>>    Does any one have any idea ? Thanks.
>>>>
>>>> -----------
>>>> Cao Tong
>>>>
>>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>>
>>>>>           case DATE:
>>>>>                // This piece of code is for maintaining backward compatibility
>>>>>                // and support both the date formats(Bug 9724)
>>>>>
>>>>> Is it related to my problem?  Where can I found the descriptions about BUG9724 ?
>>>>>
>>>>> -----------
>>>>> Cao Tong
>>>>>
>>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>> Hello,
>>>>>>
>>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>>> It return a error
>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>
>>>>>> Could anyone tell me why ?
>>>>>>
>>>>>> I have read the code "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not understand what was happening,
>>>>>> it seems authenticate failed, but why??
>>>>>>
>>>>>> -----------
>>>>>> Cao Tong
>>>>>>
>>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>>>>>>>
>>>>>>>
>>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>>
>>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>>
>>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>>> Traceback (most recent call last):
>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>>    return self._make_request(name, kwargs)
>>>>>>> File "call.py", line 60, in _make_request
>>>>>>>    data = self._http_get(self.value)
>>>>>>> File "call.py", line 53, in _http_get
>>>>>>>    response = urllib.urlopen(url)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>    return opener.open(url)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>    return getattr(self, name)(url)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>    errcode, errmsg, headers)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>>
>>>>>>> my ACS version:
>>>>>>>
>>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>> Find out more about ShapeBlue and our range of CloudStack related services
>>
>> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
>> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
>> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>>
>> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.
> Find out more about ShapeBlue and our range of CloudStack related services
>
> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>
> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.




Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by to...@163.com.
Thanks for all your people's replys.

1.  Abhinandan,  My ACS manager was not listening on port '8096',

2.  As Yipeng said, When I call this api from cloudmonkey, it works 
fine, like this
     " cloudmonkey api listEvents listall=true startdate='2015-08-28 
00:00:00' "

     When I call it through my python scripts, I used the 
apikey/signature pair to work,  but it failed.
     I found that how cloudmonkey works,
     first it login with username/password, then call the function with 
this session id.

it seems that the apikey/signature pair's privilege is not same with 
username/password pair's ?


@Daan, yes I am a Chinese. I am afraid it's not a preblem about 
character encodings perhaps.


-----------
Cao Tong

On 08/27/2015 08:54 PM, Abhinandan Prateek wrote:
> Try using the “8096” port for testing/checking APIs.
>
> shapeblue.com> wrote:
>> Yes, as per  https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>
>>
>>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>>
>>> Hello Every.
>>>
>>> I know this is a very simple question to most of you. but it is really hard for me to continue my work.
>>>
>>> So could Anyone spend your three minutes to give me some advice, it will be very usefull to me.
>>>
>>> my question is:
>>>
>>>    How does the parameter startdate/enddate of api listEvents() use new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>>
>>>
>>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in <module>
>>> File "SignedAPICall.py", line 67, in Event
>>>    a = api.listEvents(request)
>>> File "SignedAPICall.py", line 49, in handlerFunction
>>>    return self._make_request(name, args[0])
>>> File "SignedAPICall.py", line 61, in _make_request
>>>    data = self._http_get(self.value)
>>> File "SignedAPICall.py", line 54, in _http_get
>>>    response = urllib.urlopen(url)
>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>    return opener.open(url)
>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>    return getattr(self, name)(url)
>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>    result = method(url, fp, errcode, errmsg, headers)
>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>    errcode, errmsg, headers)
>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x7f083da78998>)
>>>
>>> -----------
>>> Cao Tong
>>>
>>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>> Hi All:
>>>>
>>>>    Does any one have any idea ? Thanks.
>>>>
>>>> -----------
>>>> Cao Tong
>>>>
>>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>>
>>>>>           case DATE:
>>>>>                // This piece of code is for maintaining backward compatibility
>>>>>                // and support both the date formats(Bug 9724)
>>>>>
>>>>> Is it related to my problem?  Where can I found the descriptions about BUG9724 ?
>>>>>
>>>>> -----------
>>>>> Cao Tong
>>>>>
>>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>> Hello,
>>>>>>
>>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>>> It return a error
>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>
>>>>>> Could anyone tell me why ?
>>>>>>
>>>>>> I have read the code "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not understand what was happening,
>>>>>> it seems authenticate failed, but why??
>>>>>>
>>>>>> -----------
>>>>>> Cao Tong
>>>>>>
>>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>>>>>>>
>>>>>>>
>>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>>
>>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>>
>>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>>> Traceback (most recent call last):
>>>>>>> File "<stdin>", line 1, in <module>
>>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>>    return self._make_request(name, kwargs)
>>>>>>> File "call.py", line 60, in _make_request
>>>>>>>    data = self._http_get(self.value)
>>>>>>> File "call.py", line 53, in _http_get
>>>>>>>    response = urllib.urlopen(url)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>>    return opener.open(url)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>>    return getattr(self, name)(url)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>>    errcode, errmsg, headers)
>>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>>
>>>>>>> my ACS version:
>>>>>>>
>>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>> Find out more about ShapeBlue and our range of CloudStack related services
>>
>> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
>> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
>> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>>
>> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.
> Find out more about ShapeBlue and our range of CloudStack related services
>
> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>
> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.




Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Abhinandan Prateek <ab...@shapeblue.com>.
Try using the “8096” port for testing/checking APIs.

shapeblue.com> wrote:
>
> Yes, as per  https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>
>
>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>
>> Hello Every.
>>
>> I know this is a very simple question to most of you. but it is really hard for me to continue my work.
>>
>> So could Anyone spend your three minutes to give me some advice, it will be very usefull to me.
>>
>> my question is:
>>
>>   How does the parameter startdate/enddate of api listEvents() use new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>
>>
>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> File "SignedAPICall.py", line 67, in Event
>>   a = api.listEvents(request)
>> File "SignedAPICall.py", line 49, in handlerFunction
>>   return self._make_request(name, args[0])
>> File "SignedAPICall.py", line 61, in _make_request
>>   data = self._http_get(self.value)
>> File "SignedAPICall.py", line 54, in _http_get
>>   response = urllib.urlopen(url)
>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>   return opener.open(url)
>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>   return getattr(self, name)(url)
>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>   return self.http_error(url, fp, errcode, errmsg, headers)
>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>   result = method(url, fp, errcode, errmsg, headers)
>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>   errcode, errmsg, headers)
>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>   raise IOError, ('http error', errcode, errmsg, headers)
>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x7f083da78998>)
>>
>> -----------
>> Cao Tong
>>
>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>
>>> Hi All:
>>>
>>>   Does any one have any idea ? Thanks.
>>>
>>> -----------
>>> Cao Tong
>>>
>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>
>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>
>>>>          case DATE:
>>>>               // This piece of code is for maintaining backward compatibility
>>>>               // and support both the date formats(Bug 9724)
>>>>
>>>> Is it related to my problem?  Where can I found the descriptions about BUG9724 ?
>>>>
>>>> -----------
>>>> Cao Tong
>>>>
>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>> It return a error
>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>
>>>>> Could anyone tell me why ?
>>>>>
>>>>> I have read the code "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not understand what was happening,
>>>>> it seems authenticate failed, but why??
>>>>>
>>>>> -----------
>>>>> Cao Tong
>>>>>
>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>>   was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>>>>>>
>>>>>>
>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>
>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>
>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>> Traceback (most recent call last):
>>>>>> File "<stdin>", line 1, in <module>
>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>   return self._make_request(name, kwargs)
>>>>>> File "call.py", line 60, in _make_request
>>>>>>   data = self._http_get(self.value)
>>>>>> File "call.py", line 53, in _http_get
>>>>>>   response = urllib.urlopen(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>   return opener.open(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>   return getattr(self, name)(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>   return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>   result = method(url, fp, errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>   errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>   raise IOError, ('http error', errcode, errmsg, headers)
>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>>>>
>>>>>>
>>>>>>
>>>>>> my ACS version:
>>>>>>
>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
> Find out more about ShapeBlue and our range of CloudStack related services
>
> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>
> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Yiping Zhang <yz...@marketo.com>.
Tony:

Your date format seems to be OK. I just tried on my cs 4.5.1 with cloudmonkey 5.3.1:

(local) 🐵 > list events startdate='2015-08-25 15:20:00'
count = 1
event:
id = 983c0369-80f2-4431-801c-273bffd925e5
account = admin
created = 2015-08-25T15:29:54-0500
description = user has logged in from IP Address 10.0.248.86
domain = ROOT
domainid = 994ff03e-bb8f-11e4-b7d5-36d1d14da5e9
level = INFO
state = Completed
type = USER.LOGIN
username = admin
(local) 🐵 > 


So your problem is somewhere else.  Can you access other API’s with that apikey/secretkey pair ? What client are you using to make api calls ?  You gave stack trace from client side, what’s the error message in CloudStack logs say ?

Good luck

Yiping


On 8/25/15, 3:22 AM, "Daan Hoogland" <da...@gmail.com> wrote:

>Tony/Cao Tong,
>
>
>just as a guess and as I see you are chinese; the chacter between the date
>and the time is a 32 (uri encoded %20)? Not sure if that is your problem
>but it might be.
>
>Looking at the stack trace you might as well want to look at the version of
>your client library as it seems to refuse the format client side.
>
>
>regards,
>Daan
>
>On Tue, Aug 25, 2015 at 12:16 PM, Abhinandan Prateek <
>abhinandan.prateek@shapeblue.com> wrote:
>
>> Yes, as per
>> https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>>
>>
>> > On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>> >
>> > Hello Every.
>> >
>> > I know this is a very simple question to most of you. but it is really
>> hard for me to continue my work.
>> >
>> > So could Anyone spend your three minutes to give me some advice, it will
>> be very usefull to me.
>> >
>> > my question is:
>> >
>> >    How does the parameter startdate/enddate of api listEvents() use new
>> time format  like 'yyyy-MM-dd HH:mm:ss' ?
>> >
>> >
>> > >>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>> >
>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>> > Traceback (most recent call last):
>> >  File "<stdin>", line 1, in <module>
>> >  File "SignedAPICall.py", line 67, in Event
>> >    a = api.listEvents(request)
>> >  File "SignedAPICall.py", line 49, in handlerFunction
>> >    return self._make_request(name, args[0])
>> >  File "SignedAPICall.py", line 61, in _make_request
>> >    data = self._http_get(self.value)
>> >  File "SignedAPICall.py", line 54, in _http_get
>> >    response = urllib.urlopen(url)
>> >  File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>> >    return opener.open(url)
>> >  File "/usr/lib64/python2.7/urllib.py", line 208, in open
>> >    return getattr(self, name)(url)
>> >  File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>> >    return self.http_error(url, fp, errcode, errmsg, headers)
>> >  File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>> >    result = method(url, fp, errcode, errmsg, headers)
>> >  File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>> >    errcode, errmsg, headers)
>> >  File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>> >    raise IOError, ('http error', errcode, errmsg, headers)
>> > IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>> instance at 0x7f083da78998>)
>> >
>> > -----------
>> > Cao Tong
>> >
>> > On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>> >>
>> >> Hi All:
>> >>
>> >>    Does any one have any idea ? Thanks.
>> >>
>> >> -----------
>> >> Cao Tong
>> >>
>> >> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>> >>>
>> >>> In ParamProcessWorker::setFieldValue() I found this lins:
>> >>>
>> >>>           case DATE:
>> >>>                // This piece of code is for maintaining backward
>> compatibility
>> >>>                // and support both the date formats(Bug 9724)
>> >>>
>> >>> Is it related to my problem?  Where can I found the descriptions about
>> BUG9724 ?
>> >>>
>> >>> -----------
>> >>> Cao Tong
>> >>>
>> >>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>> >>>>
>> >>>> Hello,
>> >>>>
>> >>>> When I use timestamp format startdate="2015-07-31", it works find.
>> >>>> When I use it like this startdate="2015-07-31 13:00:00".
>> >>>> It return a error
>> >>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>> instance at 0x16dca70>)
>> >>>>
>> >>>> Could anyone tell me why ?
>> >>>>
>> >>>> I have read the code
>> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not
>> understand what was happening,
>> >>>> it seems authenticate failed, but why??
>> >>>>
>> >>>> -----------
>> >>>> Cao Tong
>> >>>>
>> >>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>> >>>>>
>> >>>>> Hi,
>> >>>>>
>> >>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd
>> HH:mm:ss"
>> >>>>>
>> >>>>>
>> >>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>> >>>>>
>> >>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>> >>>>>
>> >>>>>    >>> api.listEvents(startdate="2015-07-31 13:00:00")
>> >>>>> Traceback (most recent call last):
>> >>>>>  File "<stdin>", line 1, in <module>
>> >>>>>  File "call.py", line 48, in handlerFunction
>> >>>>>    return self._make_request(name, kwargs)
>> >>>>>  File "call.py", line 60, in _make_request
>> >>>>>    data = self._http_get(self.value)
>> >>>>>  File "call.py", line 53, in _http_get
>> >>>>>    response = urllib.urlopen(url)
>> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>> >>>>>    return opener.open(url)
>> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 208, in open
>> >>>>>    return getattr(self, name)(url)
>> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>> >>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>> >>>>>    result = method(url, fp, errcode, errmsg, headers)
>> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>> >>>>>    errcode, errmsg, headers)
>> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 381, in
>> http_error_default
>> >>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>> >>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
>> instance at 0x16dca70>)
>> >>>>> >>>
>> >>>>>
>> >>>>>
>> >>>>> my ACS version:
>> >>>>>
>> >>>>> [root@cs ~]# rpm -qa |grep cloud
>> >>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>> >>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>> >>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>> >>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>> >>>>>
>> >>>>>
>> >>>>
>> >>>>
>> >>>
>> >>>
>> >>
>> >>
>> >
>> >
>>
>> Find out more about ShapeBlue and our range of CloudStack related services
>>
>> IaaS Cloud Design & Build<
>> http://shapeblue.com/iaas-cloud-design-and-build//>
>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>> CloudStack Software Engineering<
>> http://shapeblue.com/cloudstack-software-engineering/>
>> CloudStack Infrastructure Support<
>> http://shapeblue.com/cloudstack-infrastructure-support/>
>> CloudStack Bootcamp Training Courses<
>> http://shapeblue.com/cloudstack-training/>
>>
>> This email and any attachments to it may be confidential and are intended
>> solely for the use of the individual to whom it is addressed. Any views or
>> opinions expressed are solely those of the author and do not necessarily
>> represent those of Shape Blue Ltd or related companies. If you are not the
>> intended recipient of this email, you must neither take any action based
>> upon its contents, nor copy or show it to anyone. Please contact the sender
>> if you believe you have received this email in error. Shape Blue Ltd is a
>> company incorporated in England & Wales. ShapeBlue Services India LLP is a
>> company incorporated in India and is operated under license from Shape Blue
>> Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil
>> and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is
>> a company registered by The Republic of South Africa and is traded under
>> license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>>
>
>
>
>-- 
>Daan

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Daan Hoogland <da...@gmail.com>.
Tony/Cao Tong,


just as a guess and as I see you are chinese; the chacter between the date
and the time is a 32 (uri encoded %20)? Not sure if that is your problem
but it might be.

Looking at the stack trace you might as well want to look at the version of
your client library as it seems to refuse the format client side.


regards,
Daan

On Tue, Aug 25, 2015 at 12:16 PM, Abhinandan Prateek <
abhinandan.prateek@shapeblue.com> wrote:

> Yes, as per
> https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>
>
> > On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
> >
> > Hello Every.
> >
> > I know this is a very simple question to most of you. but it is really
> hard for me to continue my work.
> >
> > So could Anyone spend your three minutes to give me some advice, it will
> be very usefull to me.
> >
> > my question is:
> >
> >    How does the parameter startdate/enddate of api listEvents() use new
> time format  like 'yyyy-MM-dd HH:mm:ss' ?
> >
> >
> > >>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
> >
> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
> > Traceback (most recent call last):
> >  File "<stdin>", line 1, in <module>
> >  File "SignedAPICall.py", line 67, in Event
> >    a = api.listEvents(request)
> >  File "SignedAPICall.py", line 49, in handlerFunction
> >    return self._make_request(name, args[0])
> >  File "SignedAPICall.py", line 61, in _make_request
> >    data = self._http_get(self.value)
> >  File "SignedAPICall.py", line 54, in _http_get
> >    response = urllib.urlopen(url)
> >  File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
> >    return opener.open(url)
> >  File "/usr/lib64/python2.7/urllib.py", line 208, in open
> >    return getattr(self, name)(url)
> >  File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
> >    return self.http_error(url, fp, errcode, errmsg, headers)
> >  File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
> >    result = method(url, fp, errcode, errmsg, headers)
> >  File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
> >    errcode, errmsg, headers)
> >  File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
> >    raise IOError, ('http error', errcode, errmsg, headers)
> > IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
> instance at 0x7f083da78998>)
> >
> > -----------
> > Cao Tong
> >
> > On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
> >>
> >> Hi All:
> >>
> >>    Does any one have any idea ? Thanks.
> >>
> >> -----------
> >> Cao Tong
> >>
> >> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
> >>>
> >>> In ParamProcessWorker::setFieldValue() I found this lins:
> >>>
> >>>           case DATE:
> >>>                // This piece of code is for maintaining backward
> compatibility
> >>>                // and support both the date formats(Bug 9724)
> >>>
> >>> Is it related to my problem?  Where can I found the descriptions about
> BUG9724 ?
> >>>
> >>> -----------
> >>> Cao Tong
> >>>
> >>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
> >>>>
> >>>> Hello,
> >>>>
> >>>> When I use timestamp format startdate="2015-07-31", it works find.
> >>>> When I use it like this startdate="2015-07-31 13:00:00".
> >>>> It return a error
> >>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
> instance at 0x16dca70>)
> >>>>
> >>>> Could anyone tell me why ?
> >>>>
> >>>> I have read the code
> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not
> understand what was happening,
> >>>> it seems authenticate failed, but why??
> >>>>
> >>>> -----------
> >>>> Cao Tong
> >>>>
> >>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
> >>>>>
> >>>>> Hi,
> >>>>>
> >>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd
> HH:mm:ss"
> >>>>>
> >>>>>
> >>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
> >>>>>
> >>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
> >>>>>
> >>>>>    >>> api.listEvents(startdate="2015-07-31 13:00:00")
> >>>>> Traceback (most recent call last):
> >>>>>  File "<stdin>", line 1, in <module>
> >>>>>  File "call.py", line 48, in handlerFunction
> >>>>>    return self._make_request(name, kwargs)
> >>>>>  File "call.py", line 60, in _make_request
> >>>>>    data = self._http_get(self.value)
> >>>>>  File "call.py", line 53, in _http_get
> >>>>>    response = urllib.urlopen(url)
> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
> >>>>>    return opener.open(url)
> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 208, in open
> >>>>>    return getattr(self, name)(url)
> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
> >>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
> >>>>>    result = method(url, fp, errcode, errmsg, headers)
> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
> >>>>>    errcode, errmsg, headers)
> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 381, in
> http_error_default
> >>>>>    raise IOError, ('http error', errcode, errmsg, headers)
> >>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
> instance at 0x16dca70>)
> >>>>> >>>
> >>>>>
> >>>>>
> >>>>> my ACS version:
> >>>>>
> >>>>> [root@cs ~]# rpm -qa |grep cloud
> >>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
> >>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
> >>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
> >>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>
> >>>
> >>
> >>
> >
> >
>
> Find out more about ShapeBlue and our range of CloudStack related services
>
> IaaS Cloud Design & Build<
> http://shapeblue.com/iaas-cloud-design-and-build//>
> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
> CloudStack Software Engineering<
> http://shapeblue.com/cloudstack-software-engineering/>
> CloudStack Infrastructure Support<
> http://shapeblue.com/cloudstack-infrastructure-support/>
> CloudStack Bootcamp Training Courses<
> http://shapeblue.com/cloudstack-training/>
>
> This email and any attachments to it may be confidential and are intended
> solely for the use of the individual to whom it is addressed. Any views or
> opinions expressed are solely those of the author and do not necessarily
> represent those of Shape Blue Ltd or related companies. If you are not the
> intended recipient of this email, you must neither take any action based
> upon its contents, nor copy or show it to anyone. Please contact the sender
> if you believe you have received this email in error. Shape Blue Ltd is a
> company incorporated in England & Wales. ShapeBlue Services India LLP is a
> company incorporated in India and is operated under license from Shape Blue
> Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil
> and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is
> a company registered by The Republic of South Africa and is traded under
> license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>



-- 
Daan

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Daan Hoogland <da...@gmail.com>.
Tony/Cao Tong,


just as a guess and as I see you are chinese; the chacter between the date
and the time is a 32 (uri encoded %20)? Not sure if that is your problem
but it might be.

Looking at the stack trace you might as well want to look at the version of
your client library as it seems to refuse the format client side.


regards,
Daan

On Tue, Aug 25, 2015 at 12:16 PM, Abhinandan Prateek <
abhinandan.prateek@shapeblue.com> wrote:

> Yes, as per
> https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>
>
> > On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
> >
> > Hello Every.
> >
> > I know this is a very simple question to most of you. but it is really
> hard for me to continue my work.
> >
> > So could Anyone spend your three minutes to give me some advice, it will
> be very usefull to me.
> >
> > my question is:
> >
> >    How does the parameter startdate/enddate of api listEvents() use new
> time format  like 'yyyy-MM-dd HH:mm:ss' ?
> >
> >
> > >>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
> >
> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
> > Traceback (most recent call last):
> >  File "<stdin>", line 1, in <module>
> >  File "SignedAPICall.py", line 67, in Event
> >    a = api.listEvents(request)
> >  File "SignedAPICall.py", line 49, in handlerFunction
> >    return self._make_request(name, args[0])
> >  File "SignedAPICall.py", line 61, in _make_request
> >    data = self._http_get(self.value)
> >  File "SignedAPICall.py", line 54, in _http_get
> >    response = urllib.urlopen(url)
> >  File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
> >    return opener.open(url)
> >  File "/usr/lib64/python2.7/urllib.py", line 208, in open
> >    return getattr(self, name)(url)
> >  File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
> >    return self.http_error(url, fp, errcode, errmsg, headers)
> >  File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
> >    result = method(url, fp, errcode, errmsg, headers)
> >  File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
> >    errcode, errmsg, headers)
> >  File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
> >    raise IOError, ('http error', errcode, errmsg, headers)
> > IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
> instance at 0x7f083da78998>)
> >
> > -----------
> > Cao Tong
> >
> > On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
> >>
> >> Hi All:
> >>
> >>    Does any one have any idea ? Thanks.
> >>
> >> -----------
> >> Cao Tong
> >>
> >> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
> >>>
> >>> In ParamProcessWorker::setFieldValue() I found this lins:
> >>>
> >>>           case DATE:
> >>>                // This piece of code is for maintaining backward
> compatibility
> >>>                // and support both the date formats(Bug 9724)
> >>>
> >>> Is it related to my problem?  Where can I found the descriptions about
> BUG9724 ?
> >>>
> >>> -----------
> >>> Cao Tong
> >>>
> >>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
> >>>>
> >>>> Hello,
> >>>>
> >>>> When I use timestamp format startdate="2015-07-31", it works find.
> >>>> When I use it like this startdate="2015-07-31 13:00:00".
> >>>> It return a error
> >>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
> instance at 0x16dca70>)
> >>>>
> >>>> Could anyone tell me why ?
> >>>>
> >>>> I have read the code
> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not
> understand what was happening,
> >>>> it seems authenticate failed, but why??
> >>>>
> >>>> -----------
> >>>> Cao Tong
> >>>>
> >>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
> >>>>>
> >>>>> Hi,
> >>>>>
> >>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd
> HH:mm:ss"
> >>>>>
> >>>>>
> >>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
> >>>>>
> >>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
> >>>>>
> >>>>>    >>> api.listEvents(startdate="2015-07-31 13:00:00")
> >>>>> Traceback (most recent call last):
> >>>>>  File "<stdin>", line 1, in <module>
> >>>>>  File "call.py", line 48, in handlerFunction
> >>>>>    return self._make_request(name, kwargs)
> >>>>>  File "call.py", line 60, in _make_request
> >>>>>    data = self._http_get(self.value)
> >>>>>  File "call.py", line 53, in _http_get
> >>>>>    response = urllib.urlopen(url)
> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
> >>>>>    return opener.open(url)
> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 208, in open
> >>>>>    return getattr(self, name)(url)
> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
> >>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
> >>>>>    result = method(url, fp, errcode, errmsg, headers)
> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
> >>>>>    errcode, errmsg, headers)
> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 381, in
> http_error_default
> >>>>>    raise IOError, ('http error', errcode, errmsg, headers)
> >>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
> instance at 0x16dca70>)
> >>>>> >>>
> >>>>>
> >>>>>
> >>>>> my ACS version:
> >>>>>
> >>>>> [root@cs ~]# rpm -qa |grep cloud
> >>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
> >>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
> >>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
> >>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>
> >>>
> >>
> >>
> >
> >
>
> Find out more about ShapeBlue and our range of CloudStack related services
>
> IaaS Cloud Design & Build<
> http://shapeblue.com/iaas-cloud-design-and-build//>
> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
> CloudStack Software Engineering<
> http://shapeblue.com/cloudstack-software-engineering/>
> CloudStack Infrastructure Support<
> http://shapeblue.com/cloudstack-infrastructure-support/>
> CloudStack Bootcamp Training Courses<
> http://shapeblue.com/cloudstack-training/>
>
> This email and any attachments to it may be confidential and are intended
> solely for the use of the individual to whom it is addressed. Any views or
> opinions expressed are solely those of the author and do not necessarily
> represent those of Shape Blue Ltd or related companies. If you are not the
> intended recipient of this email, you must neither take any action based
> upon its contents, nor copy or show it to anyone. Please contact the sender
> if you believe you have received this email in error. Shape Blue Ltd is a
> company incorporated in England & Wales. ShapeBlue Services India LLP is a
> company incorporated in India and is operated under license from Shape Blue
> Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil
> and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is
> a company registered by The Republic of South Africa and is traded under
> license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>



-- 
Daan

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Abhinandan Prateek <ab...@shapeblue.com>.
Try using the “8096” port for testing/checking APIs.

shapeblue.com> wrote:
>
> Yes, as per  https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>
>
>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>
>> Hello Every.
>>
>> I know this is a very simple question to most of you. but it is really hard for me to continue my work.
>>
>> So could Anyone spend your three minutes to give me some advice, it will be very usefull to me.
>>
>> my question is:
>>
>>   How does the parameter startdate/enddate of api listEvents() use new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>
>>
>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> File "SignedAPICall.py", line 67, in Event
>>   a = api.listEvents(request)
>> File "SignedAPICall.py", line 49, in handlerFunction
>>   return self._make_request(name, args[0])
>> File "SignedAPICall.py", line 61, in _make_request
>>   data = self._http_get(self.value)
>> File "SignedAPICall.py", line 54, in _http_get
>>   response = urllib.urlopen(url)
>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>   return opener.open(url)
>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>   return getattr(self, name)(url)
>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>   return self.http_error(url, fp, errcode, errmsg, headers)
>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>   result = method(url, fp, errcode, errmsg, headers)
>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>   errcode, errmsg, headers)
>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>   raise IOError, ('http error', errcode, errmsg, headers)
>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x7f083da78998>)
>>
>> -----------
>> Cao Tong
>>
>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>
>>> Hi All:
>>>
>>>   Does any one have any idea ? Thanks.
>>>
>>> -----------
>>> Cao Tong
>>>
>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>
>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>
>>>>          case DATE:
>>>>               // This piece of code is for maintaining backward compatibility
>>>>               // and support both the date formats(Bug 9724)
>>>>
>>>> Is it related to my problem?  Where can I found the descriptions about BUG9724 ?
>>>>
>>>> -----------
>>>> Cao Tong
>>>>
>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>> It return a error
>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>
>>>>> Could anyone tell me why ?
>>>>>
>>>>> I have read the code "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not understand what was happening,
>>>>> it seems authenticate failed, but why??
>>>>>
>>>>> -----------
>>>>> Cao Tong
>>>>>
>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>>   was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>>>>>>
>>>>>>
>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>
>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>
>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>> Traceback (most recent call last):
>>>>>> File "<stdin>", line 1, in <module>
>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>   return self._make_request(name, kwargs)
>>>>>> File "call.py", line 60, in _make_request
>>>>>>   data = self._http_get(self.value)
>>>>>> File "call.py", line 53, in _http_get
>>>>>>   response = urllib.urlopen(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>   return opener.open(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>   return getattr(self, name)(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>   return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>   result = method(url, fp, errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>   errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>   raise IOError, ('http error', errcode, errmsg, headers)
>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>>>>
>>>>>>
>>>>>>
>>>>>> my ACS version:
>>>>>>
>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
> Find out more about ShapeBlue and our range of CloudStack related services
>
> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>
> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Abhinandan Prateek <ab...@shapeblue.com>.
Try using the “8096” port for testing/checking APIs.

shapeblue.com> wrote:
>
> Yes, as per  https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>
>
>> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>>
>> Hello Every.
>>
>> I know this is a very simple question to most of you. but it is really hard for me to continue my work.
>>
>> So could Anyone spend your three minutes to give me some advice, it will be very usefull to me.
>>
>> my question is:
>>
>>   How does the parameter startdate/enddate of api listEvents() use new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>>
>>
>>>>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
>> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> File "SignedAPICall.py", line 67, in Event
>>   a = api.listEvents(request)
>> File "SignedAPICall.py", line 49, in handlerFunction
>>   return self._make_request(name, args[0])
>> File "SignedAPICall.py", line 61, in _make_request
>>   data = self._http_get(self.value)
>> File "SignedAPICall.py", line 54, in _http_get
>>   response = urllib.urlopen(url)
>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>   return opener.open(url)
>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>   return getattr(self, name)(url)
>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>   return self.http_error(url, fp, errcode, errmsg, headers)
>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>   result = method(url, fp, errcode, errmsg, headers)
>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>   errcode, errmsg, headers)
>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>   raise IOError, ('http error', errcode, errmsg, headers)
>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x7f083da78998>)
>>
>> -----------
>> Cao Tong
>>
>> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>>
>>> Hi All:
>>>
>>>   Does any one have any idea ? Thanks.
>>>
>>> -----------
>>> Cao Tong
>>>
>>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>>
>>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>>
>>>>          case DATE:
>>>>               // This piece of code is for maintaining backward compatibility
>>>>               // and support both the date formats(Bug 9724)
>>>>
>>>> Is it related to my problem?  Where can I found the descriptions about BUG9724 ?
>>>>
>>>> -----------
>>>> Cao Tong
>>>>
>>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>>> It return a error
>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>
>>>>> Could anyone tell me why ?
>>>>>
>>>>> I have read the code "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not understand what was happening,
>>>>> it seems authenticate failed, but why??
>>>>>
>>>>> -----------
>>>>> Cao Tong
>>>>>
>>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>>   was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>>>>>>
>>>>>>
>>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>>
>>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>>
>>>>>>>>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>>> Traceback (most recent call last):
>>>>>> File "<stdin>", line 1, in <module>
>>>>>> File "call.py", line 48, in handlerFunction
>>>>>>   return self._make_request(name, kwargs)
>>>>>> File "call.py", line 60, in _make_request
>>>>>>   data = self._http_get(self.value)
>>>>>> File "call.py", line 53, in _http_get
>>>>>>   response = urllib.urlopen(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>>   return opener.open(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>>   return getattr(self, name)(url)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>>   return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>>   result = method(url, fp, errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>>   errcode, errmsg, headers)
>>>>>> File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>>   raise IOError, ('http error', errcode, errmsg, headers)
>>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>>>>>>
>>>>>>
>>>>>>
>>>>>> my ACS version:
>>>>>>
>>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
> Find out more about ShapeBlue and our range of CloudStack related services
>
> IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>
>
> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Daan Hoogland <da...@gmail.com>.
Tony/Cao Tong,


just as a guess and as I see you are chinese; the chacter between the date
and the time is a 32 (uri encoded %20)? Not sure if that is your problem
but it might be.

Looking at the stack trace you might as well want to look at the version of
your client library as it seems to refuse the format client side.


regards,
Daan

On Tue, Aug 25, 2015 at 12:16 PM, Abhinandan Prateek <
abhinandan.prateek@shapeblue.com> wrote:

> Yes, as per
> https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html
>
>
> > On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
> >
> > Hello Every.
> >
> > I know this is a very simple question to most of you. but it is really
> hard for me to continue my work.
> >
> > So could Anyone spend your three minutes to give me some advice, it will
> be very usefull to me.
> >
> > my question is:
> >
> >    How does the parameter startdate/enddate of api listEvents() use new
> time format  like 'yyyy-MM-dd HH:mm:ss' ?
> >
> >
> > >>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
> >
> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
> > Traceback (most recent call last):
> >  File "<stdin>", line 1, in <module>
> >  File "SignedAPICall.py", line 67, in Event
> >    a = api.listEvents(request)
> >  File "SignedAPICall.py", line 49, in handlerFunction
> >    return self._make_request(name, args[0])
> >  File "SignedAPICall.py", line 61, in _make_request
> >    data = self._http_get(self.value)
> >  File "SignedAPICall.py", line 54, in _http_get
> >    response = urllib.urlopen(url)
> >  File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
> >    return opener.open(url)
> >  File "/usr/lib64/python2.7/urllib.py", line 208, in open
> >    return getattr(self, name)(url)
> >  File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
> >    return self.http_error(url, fp, errcode, errmsg, headers)
> >  File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
> >    result = method(url, fp, errcode, errmsg, headers)
> >  File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
> >    errcode, errmsg, headers)
> >  File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
> >    raise IOError, ('http error', errcode, errmsg, headers)
> > IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
> instance at 0x7f083da78998>)
> >
> > -----------
> > Cao Tong
> >
> > On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
> >>
> >> Hi All:
> >>
> >>    Does any one have any idea ? Thanks.
> >>
> >> -----------
> >> Cao Tong
> >>
> >> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
> >>>
> >>> In ParamProcessWorker::setFieldValue() I found this lins:
> >>>
> >>>           case DATE:
> >>>                // This piece of code is for maintaining backward
> compatibility
> >>>                // and support both the date formats(Bug 9724)
> >>>
> >>> Is it related to my problem?  Where can I found the descriptions about
> BUG9724 ?
> >>>
> >>> -----------
> >>> Cao Tong
> >>>
> >>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
> >>>>
> >>>> Hello,
> >>>>
> >>>> When I use timestamp format startdate="2015-07-31", it works find.
> >>>> When I use it like this startdate="2015-07-31 13:00:00".
> >>>> It return a error
> >>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
> instance at 0x16dca70>)
> >>>>
> >>>> Could anyone tell me why ?
> >>>>
> >>>> I have read the code
> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not
> understand what was happening,
> >>>> it seems authenticate failed, but why??
> >>>>
> >>>> -----------
> >>>> Cao Tong
> >>>>
> >>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
> >>>>>
> >>>>> Hi,
> >>>>>
> >>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd
> HH:mm:ss"
> >>>>>
> >>>>>
> >>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
> >>>>>
> >>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
> >>>>>
> >>>>>    >>> api.listEvents(startdate="2015-07-31 13:00:00")
> >>>>> Traceback (most recent call last):
> >>>>>  File "<stdin>", line 1, in <module>
> >>>>>  File "call.py", line 48, in handlerFunction
> >>>>>    return self._make_request(name, kwargs)
> >>>>>  File "call.py", line 60, in _make_request
> >>>>>    data = self._http_get(self.value)
> >>>>>  File "call.py", line 53, in _http_get
> >>>>>    response = urllib.urlopen(url)
> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
> >>>>>    return opener.open(url)
> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 208, in open
> >>>>>    return getattr(self, name)(url)
> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
> >>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
> >>>>>    result = method(url, fp, errcode, errmsg, headers)
> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
> >>>>>    errcode, errmsg, headers)
> >>>>>  File "/usr/lib64/python2.7/urllib.py", line 381, in
> http_error_default
> >>>>>    raise IOError, ('http error', errcode, errmsg, headers)
> >>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage
> instance at 0x16dca70>)
> >>>>> >>>
> >>>>>
> >>>>>
> >>>>> my ACS version:
> >>>>>
> >>>>> [root@cs ~]# rpm -qa |grep cloud
> >>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
> >>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
> >>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
> >>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>
> >>>
> >>
> >>
> >
> >
>
> Find out more about ShapeBlue and our range of CloudStack related services
>
> IaaS Cloud Design & Build<
> http://shapeblue.com/iaas-cloud-design-and-build//>
> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
> CloudStack Software Engineering<
> http://shapeblue.com/cloudstack-software-engineering/>
> CloudStack Infrastructure Support<
> http://shapeblue.com/cloudstack-infrastructure-support/>
> CloudStack Bootcamp Training Courses<
> http://shapeblue.com/cloudstack-training/>
>
> This email and any attachments to it may be confidential and are intended
> solely for the use of the individual to whom it is addressed. Any views or
> opinions expressed are solely those of the author and do not necessarily
> represent those of Shape Blue Ltd or related companies. If you are not the
> intended recipient of this email, you must neither take any action based
> upon its contents, nor copy or show it to anyone. Please contact the sender
> if you believe you have received this email in error. Shape Blue Ltd is a
> company incorporated in England & Wales. ShapeBlue Services India LLP is a
> company incorporated in India and is operated under license from Shape Blue
> Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil
> and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is
> a company registered by The Republic of South Africa and is traded under
> license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>



-- 
Daan

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Abhinandan Prateek <ab...@shapeblue.com>.
Yes, as per  https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html


> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>
> Hello Every.
>
> I know this is a very simple question to most of you. but it is really hard for me to continue my work.
>
> So could Anyone spend your three minutes to give me some advice, it will be very usefull to me.
>
> my question is:
>
>    How does the parameter startdate/enddate of api listEvents() use new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>
>
> >>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "SignedAPICall.py", line 67, in Event
>    a = api.listEvents(request)
>  File "SignedAPICall.py", line 49, in handlerFunction
>    return self._make_request(name, args[0])
>  File "SignedAPICall.py", line 61, in _make_request
>    data = self._http_get(self.value)
>  File "SignedAPICall.py", line 54, in _http_get
>    response = urllib.urlopen(url)
>  File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>    return opener.open(url)
>  File "/usr/lib64/python2.7/urllib.py", line 208, in open
>    return getattr(self, name)(url)
>  File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>    return self.http_error(url, fp, errcode, errmsg, headers)
>  File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>    result = method(url, fp, errcode, errmsg, headers)
>  File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>    errcode, errmsg, headers)
>  File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>    raise IOError, ('http error', errcode, errmsg, headers)
> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x7f083da78998>)
>
> -----------
> Cao Tong
>
> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>
>> Hi All:
>>
>>    Does any one have any idea ? Thanks.
>>
>> -----------
>> Cao Tong
>>
>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>
>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>
>>>           case DATE:
>>>                // This piece of code is for maintaining backward compatibility
>>>                // and support both the date formats(Bug 9724)
>>>
>>> Is it related to my problem?  Where can I found the descriptions about BUG9724 ?
>>>
>>> -----------
>>> Cao Tong
>>>
>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>
>>>> Hello,
>>>>
>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>> It return a error
>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>
>>>> Could anyone tell me why ?
>>>>
>>>> I have read the code "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not understand what was happening,
>>>> it seems authenticate failed, but why??
>>>>
>>>> -----------
>>>> Cao Tong
>>>>
>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>>>>>
>>>>>
>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>
>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>
>>>>>    >>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>> Traceback (most recent call last):
>>>>>  File "<stdin>", line 1, in <module>
>>>>>  File "call.py", line 48, in handlerFunction
>>>>>    return self._make_request(name, kwargs)
>>>>>  File "call.py", line 60, in _make_request
>>>>>    data = self._http_get(self.value)
>>>>>  File "call.py", line 53, in _http_get
>>>>>    response = urllib.urlopen(url)
>>>>>  File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>    return opener.open(url)
>>>>>  File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>    return getattr(self, name)(url)
>>>>>  File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>  File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>  File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>    errcode, errmsg, headers)
>>>>>  File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>> >>>
>>>>>
>>>>>
>>>>> my ACS version:
>>>>>
>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>

Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Abhinandan Prateek <ab...@shapeblue.com>.
Yes, as per  https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html


> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>
> Hello Every.
>
> I know this is a very simple question to most of you. but it is really hard for me to continue my work.
>
> So could Anyone spend your three minutes to give me some advice, it will be very usefull to me.
>
> my question is:
>
>    How does the parameter startdate/enddate of api listEvents() use new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>
>
> >>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "SignedAPICall.py", line 67, in Event
>    a = api.listEvents(request)
>  File "SignedAPICall.py", line 49, in handlerFunction
>    return self._make_request(name, args[0])
>  File "SignedAPICall.py", line 61, in _make_request
>    data = self._http_get(self.value)
>  File "SignedAPICall.py", line 54, in _http_get
>    response = urllib.urlopen(url)
>  File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>    return opener.open(url)
>  File "/usr/lib64/python2.7/urllib.py", line 208, in open
>    return getattr(self, name)(url)
>  File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>    return self.http_error(url, fp, errcode, errmsg, headers)
>  File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>    result = method(url, fp, errcode, errmsg, headers)
>  File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>    errcode, errmsg, headers)
>  File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>    raise IOError, ('http error', errcode, errmsg, headers)
> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x7f083da78998>)
>
> -----------
> Cao Tong
>
> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>
>> Hi All:
>>
>>    Does any one have any idea ? Thanks.
>>
>> -----------
>> Cao Tong
>>
>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>
>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>
>>>           case DATE:
>>>                // This piece of code is for maintaining backward compatibility
>>>                // and support both the date formats(Bug 9724)
>>>
>>> Is it related to my problem?  Where can I found the descriptions about BUG9724 ?
>>>
>>> -----------
>>> Cao Tong
>>>
>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>
>>>> Hello,
>>>>
>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>> It return a error
>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>
>>>> Could anyone tell me why ?
>>>>
>>>> I have read the code "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not understand what was happening,
>>>> it seems authenticate failed, but why??
>>>>
>>>> -----------
>>>> Cao Tong
>>>>
>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>>>>>
>>>>>
>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>
>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>
>>>>>    >>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>> Traceback (most recent call last):
>>>>>  File "<stdin>", line 1, in <module>
>>>>>  File "call.py", line 48, in handlerFunction
>>>>>    return self._make_request(name, kwargs)
>>>>>  File "call.py", line 60, in _make_request
>>>>>    data = self._http_get(self.value)
>>>>>  File "call.py", line 53, in _http_get
>>>>>    response = urllib.urlopen(url)
>>>>>  File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>    return opener.open(url)
>>>>>  File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>    return getattr(self, name)(url)
>>>>>  File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>  File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>  File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>    errcode, errmsg, headers)
>>>>>  File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>> >>>
>>>>>
>>>>>
>>>>> my ACS version:
>>>>>
>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>

Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

Re: How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Abhinandan Prateek <ab...@shapeblue.com>.
Yes, as per  https://cloudstack.apache.org/api/apidocs-4.2/root_admin/listEvents.html


> On 24-Aug-2015, at 2:08 pm, tony_caotong@163.com wrote:
>
> Hello Every.
>
> I know this is a very simple question to most of you. but it is really hard for me to continue my work.
>
> So could Anyone spend your three minutes to give me some advice, it will be very usefull to me.
>
> my question is:
>
>    How does the parameter startdate/enddate of api listEvents() use new time format  like 'yyyy-MM-dd HH:mm:ss' ?
>
>
> >>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
> http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "SignedAPICall.py", line 67, in Event
>    a = api.listEvents(request)
>  File "SignedAPICall.py", line 49, in handlerFunction
>    return self._make_request(name, args[0])
>  File "SignedAPICall.py", line 61, in _make_request
>    data = self._http_get(self.value)
>  File "SignedAPICall.py", line 54, in _http_get
>    response = urllib.urlopen(url)
>  File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>    return opener.open(url)
>  File "/usr/lib64/python2.7/urllib.py", line 208, in open
>    return getattr(self, name)(url)
>  File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>    return self.http_error(url, fp, errcode, errmsg, headers)
>  File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>    result = method(url, fp, errcode, errmsg, headers)
>  File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>    errcode, errmsg, headers)
>  File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>    raise IOError, ('http error', errcode, errmsg, headers)
> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x7f083da78998>)
>
> -----------
> Cao Tong
>
> On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>>
>> Hi All:
>>
>>    Does any one have any idea ? Thanks.
>>
>> -----------
>> Cao Tong
>>
>> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>>
>>> In ParamProcessWorker::setFieldValue() I found this lins:
>>>
>>>           case DATE:
>>>                // This piece of code is for maintaining backward compatibility
>>>                // and support both the date formats(Bug 9724)
>>>
>>> Is it related to my problem?  Where can I found the descriptions about BUG9724 ?
>>>
>>> -----------
>>> Cao Tong
>>>
>>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>>
>>>> Hello,
>>>>
>>>> When I use timestamp format startdate="2015-07-31", it works find.
>>>> When I use it like this startdate="2015-07-31 13:00:00".
>>>> It return a error
>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>
>>>> Could anyone tell me why ?
>>>>
>>>> I have read the code "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still not understand what was happening,
>>>> it seems authenticate failed, but why??
>>>>
>>>> -----------
>>>> Cao Tong
>>>>
>>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>>    was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>>>>>
>>>>>
>>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>>
>>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>>
>>>>>    >>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>>> Traceback (most recent call last):
>>>>>  File "<stdin>", line 1, in <module>
>>>>>  File "call.py", line 48, in handlerFunction
>>>>>    return self._make_request(name, kwargs)
>>>>>  File "call.py", line 60, in _make_request
>>>>>    data = self._http_get(self.value)
>>>>>  File "call.py", line 53, in _http_get
>>>>>    response = urllib.urlopen(url)
>>>>>  File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>>    return opener.open(url)
>>>>>  File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>>    return getattr(self, name)(url)
>>>>>  File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>>    return self.http_error(url, fp, errcode, errmsg, headers)
>>>>>  File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>>    result = method(url, fp, errcode, errmsg, headers)
>>>>>  File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>>    errcode, errmsg, headers)
>>>>>  File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>>>>    raise IOError, ('http error', errcode, errmsg, headers)
>>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x16dca70>)
>>>>> >>>
>>>>>
>>>>>
>>>>> my ACS version:
>>>>>
>>>>> [root@cs ~]# rpm -qa |grep cloud
>>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>

Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/>
CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by to...@163.com.
Hello Every.

I know this is a very simple question to most of you. but it is really 
hard for me to continue my work.

So could Anyone spend your three minutes to give me some advice, it will 
be very usefull to me.

my question is:

     How does the parameter startdate/enddate of api listEvents() use 
new time format  like 'yyyy-MM-dd HH:mm:ss' ?


 >>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D 

Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "SignedAPICall.py", line 67, in Event
     a = api.listEvents(request)
   File "SignedAPICall.py", line 49, in handlerFunction
     return self._make_request(name, args[0])
   File "SignedAPICall.py", line 61, in _make_request
     data = self._http_get(self.value)
   File "SignedAPICall.py", line 54, in _http_get
     response = urllib.urlopen(url)
   File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
     return opener.open(url)
   File "/usr/lib64/python2.7/urllib.py", line 208, in open
     return getattr(self, name)(url)
   File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
     return self.http_error(url, fp, errcode, errmsg, headers)
   File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
     result = method(url, fp, errcode, errmsg, headers)
   File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
     errcode, errmsg, headers)
   File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
     raise IOError, ('http error', errcode, errmsg, headers)
IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
instance at 0x7f083da78998>)

-----------
Cao Tong

On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>
> Hi All:
>
>     Does any one have any idea ? Thanks.
>
> -----------
> Cao Tong
>
> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>
>> In ParamProcessWorker::setFieldValue() I found this lins:
>>
>>            case DATE:
>>                 // This piece of code is for maintaining backward 
>> compatibility
>>                 // and support both the date formats(Bug 9724)
>>
>> Is it related to my problem?  Where can I found the descriptions 
>> about BUG9724 ?
>>
>> -----------
>> Cao Tong
>>
>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>
>>> Hello,
>>>
>>> When I use timestamp format startdate="2015-07-31", it works find.
>>> When I use it like this startdate="2015-07-31 13:00:00".
>>> It return a error
>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
>>> instance at 0x16dca70>)
>>>
>>> Could anyone tell me why ?
>>>
>>> I have read the code 
>>> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still 
>>> not understand what was happening,
>>> it seems authenticate failed, but why??
>>>
>>> -----------
>>> Cao Tong
>>>
>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>
>>>> Hi,
>>>>
>>>>     was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd 
>>>> HH:mm:ss"
>>>>
>>>>
>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>
>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>
>>>>     >>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>> Traceback (most recent call last):
>>>>   File "<stdin>", line 1, in <module>
>>>>   File "call.py", line 48, in handlerFunction
>>>>     return self._make_request(name, kwargs)
>>>>   File "call.py", line 60, in _make_request
>>>>     data = self._http_get(self.value)
>>>>   File "call.py", line 53, in _http_get
>>>>     response = urllib.urlopen(url)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>     return opener.open(url)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>     return getattr(self, name)(url)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>     return self.http_error(url, fp, errcode, errmsg, headers)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>     result = method(url, fp, errcode, errmsg, headers)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>     errcode, errmsg, headers)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 381, in 
>>>> http_error_default
>>>>     raise IOError, ('http error', errcode, errmsg, headers)
>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
>>>> instance at 0x16dca70>)
>>>> >>>
>>>>
>>>>
>>>> my ACS version:
>>>>
>>>> [root@cs ~]# rpm -qa |grep cloud
>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>
>>>>
>>>
>>>
>>
>>
>
>



How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by to...@163.com.
Hello Every.

I know this is a very simple question to most of you. but it is really 
hard for me to continue my work.

So could Anyone spend your three minutes to give me some advice, it will 
be very usefull to me.

my question is:

     How does the parameter startdate/enddate of api listEvents() use 
new time format  like 'yyyy-MM-dd HH:mm:ss' ?


 >>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D 

Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "SignedAPICall.py", line 67, in Event
     a = api.listEvents(request)
   File "SignedAPICall.py", line 49, in handlerFunction
     return self._make_request(name, args[0])
   File "SignedAPICall.py", line 61, in _make_request
     data = self._http_get(self.value)
   File "SignedAPICall.py", line 54, in _http_get
     response = urllib.urlopen(url)
   File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
     return opener.open(url)
   File "/usr/lib64/python2.7/urllib.py", line 208, in open
     return getattr(self, name)(url)
   File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
     return self.http_error(url, fp, errcode, errmsg, headers)
   File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
     result = method(url, fp, errcode, errmsg, headers)
   File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
     errcode, errmsg, headers)
   File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
     raise IOError, ('http error', errcode, errmsg, headers)
IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
instance at 0x7f083da78998>)

-----------
Cao Tong

On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>
> Hi All:
>
>     Does any one have any idea ? Thanks.
>
> -----------
> Cao Tong
>
> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>
>> In ParamProcessWorker::setFieldValue() I found this lins:
>>
>>            case DATE:
>>                 // This piece of code is for maintaining backward 
>> compatibility
>>                 // and support both the date formats(Bug 9724)
>>
>> Is it related to my problem?  Where can I found the descriptions 
>> about BUG9724 ?
>>
>> -----------
>> Cao Tong
>>
>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>
>>> Hello,
>>>
>>> When I use timestamp format startdate="2015-07-31", it works find.
>>> When I use it like this startdate="2015-07-31 13:00:00".
>>> It return a error
>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
>>> instance at 0x16dca70>)
>>>
>>> Could anyone tell me why ?
>>>
>>> I have read the code 
>>> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still 
>>> not understand what was happening,
>>> it seems authenticate failed, but why??
>>>
>>> -----------
>>> Cao Tong
>>>
>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>
>>>> Hi,
>>>>
>>>>     was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd 
>>>> HH:mm:ss"
>>>>
>>>>
>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>
>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>
>>>>     >>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>> Traceback (most recent call last):
>>>>   File "<stdin>", line 1, in <module>
>>>>   File "call.py", line 48, in handlerFunction
>>>>     return self._make_request(name, kwargs)
>>>>   File "call.py", line 60, in _make_request
>>>>     data = self._http_get(self.value)
>>>>   File "call.py", line 53, in _http_get
>>>>     response = urllib.urlopen(url)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>     return opener.open(url)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>     return getattr(self, name)(url)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>     return self.http_error(url, fp, errcode, errmsg, headers)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>     result = method(url, fp, errcode, errmsg, headers)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>     errcode, errmsg, headers)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 381, in 
>>>> http_error_default
>>>>     raise IOError, ('http error', errcode, errmsg, headers)
>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
>>>> instance at 0x16dca70>)
>>>> >>>
>>>>
>>>>
>>>> my ACS version:
>>>>
>>>> [root@cs ~]# rpm -qa |grep cloud
>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>
>>>>
>>>
>>>
>>
>>
>
>



How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by Cao Tong <to...@nnct-nsn.com>.
Hello Every.

I know this is a very simple question to most of you. but it is really 
hard for me to continue my work.

So could Anyone spend your three minutes to give me some advice, it will 
be very usefull to me.

my question is:

     How does the parameter startdate/enddate of api listEvents() use 
new time format  like 'yyyy-MM-dd HH:mm:ss' ?


 >>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "SignedAPICall.py", line 67, in Event
     a = api.listEvents(request)
   File "SignedAPICall.py", line 49, in handlerFunction
     return self._make_request(name, args[0])
   File "SignedAPICall.py", line 61, in _make_request
     data = self._http_get(self.value)
   File "SignedAPICall.py", line 54, in _http_get
     response = urllib.urlopen(url)
   File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
     return opener.open(url)
   File "/usr/lib64/python2.7/urllib.py", line 208, in open
     return getattr(self, name)(url)
   File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
     return self.http_error(url, fp, errcode, errmsg, headers)
   File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
     result = method(url, fp, errcode, errmsg, headers)
   File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
     errcode, errmsg, headers)
   File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
     raise IOError, ('http error', errcode, errmsg, headers)
IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
instance at 0x7f083da78998>)

-----------
Cao Tong


On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>
> Hi All:
>
>     Does any one have any idea ? Thanks.
>
> -----------
> Cao Tong
>
> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>
>> In ParamProcessWorker::setFieldValue() I found this lins:
>>
>>            case DATE:
>>                 // This piece of code is for maintaining backward 
>> compatibility
>>                 // and support both the date formats(Bug 9724)
>>
>> Is it related to my problem?  Where can I found the descriptions 
>> about BUG9724 ?
>>
>> -----------
>> Cao Tong
>>
>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>
>>> Hello,
>>>
>>> When I use timestamp format startdate="2015-07-31", it works find.
>>> When I use it like this startdate="2015-07-31 13:00:00".
>>> It return a error
>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
>>> instance at 0x16dca70>)
>>>
>>> Could anyone tell me why ?
>>>
>>> I have read the code 
>>> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still 
>>> not understand what was happening,
>>> it seems authenticate failed, but why??
>>>
>>> -----------
>>> Cao Tong
>>>
>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>
>>>> Hi,
>>>>
>>>>     was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd 
>>>> HH:mm:ss"
>>>>
>>>>
>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>
>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>
>>>>     >>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>> Traceback (most recent call last):
>>>>   File "<stdin>", line 1, in <module>
>>>>   File "call.py", line 48, in handlerFunction
>>>>     return self._make_request(name, kwargs)
>>>>   File "call.py", line 60, in _make_request
>>>>     data = self._http_get(self.value)
>>>>   File "call.py", line 53, in _http_get
>>>>     response = urllib.urlopen(url)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>     return opener.open(url)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>     return getattr(self, name)(url)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>     return self.http_error(url, fp, errcode, errmsg, headers)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>     result = method(url, fp, errcode, errmsg, headers)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>     errcode, errmsg, headers)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 381, in 
>>>> http_error_default
>>>>     raise IOError, ('http error', errcode, errmsg, headers)
>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
>>>> instance at 0x16dca70>)
>>>> >>>
>>>>
>>>>
>>>> my ACS version:
>>>>
>>>> [root@cs ~]# rpm -qa |grep cloud
>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>
>>>>
>>>
>>>
>>
>>
>
>



How does the parameter startdate/enddate of api listEvents() use new time format like 'yyyy-MM-dd HH:mm:ss' ?

Posted by to...@163.com.
Hello Every.

I know this is a very simple question to most of you. but it is really 
hard for me to continue my work.

So could Anyone spend your three minutes to give me some advice, it will 
be very usefull to me.

my question is:

     How does the parameter startdate/enddate of api listEvents() use 
new time format  like 'yyyy-MM-dd HH:mm:ss' ?


 >>> Event({'listall':'True', 'startdate':'2015-08-24 00:00:00'})
http://10.0.1.100:8080/client/api?apiKey=hjZ12EQ4JfFasIHO3RCXBLji-3RbBmdC973utGwCL5388WypVKwtaNsDso-JzVQIZXUVwfaT1vANdDUJs3Vkkg&command=listEvents&listall=True&response=json&startdate=2015-08-24+00%3A00%3A00&signature=z4LQCw7yzGmTK5B7TzAbzl1biXI%3D 

Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "SignedAPICall.py", line 67, in Event
     a = api.listEvents(request)
   File "SignedAPICall.py", line 49, in handlerFunction
     return self._make_request(name, args[0])
   File "SignedAPICall.py", line 61, in _make_request
     data = self._http_get(self.value)
   File "SignedAPICall.py", line 54, in _http_get
     response = urllib.urlopen(url)
   File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
     return opener.open(url)
   File "/usr/lib64/python2.7/urllib.py", line 208, in open
     return getattr(self, name)(url)
   File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
     return self.http_error(url, fp, errcode, errmsg, headers)
   File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
     result = method(url, fp, errcode, errmsg, headers)
   File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
     errcode, errmsg, headers)
   File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
     raise IOError, ('http error', errcode, errmsg, headers)
IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
instance at 0x7f083da78998>)

-----------
Cao Tong

On 08/19/2015 10:32 AM, tony_caotong@163.com wrote:
>
> Hi All:
>
>     Does any one have any idea ? Thanks.
>
> -----------
> Cao Tong
>
> On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>>
>> In ParamProcessWorker::setFieldValue() I found this lins:
>>
>>            case DATE:
>>                 // This piece of code is for maintaining backward 
>> compatibility
>>                 // and support both the date formats(Bug 9724)
>>
>> Is it related to my problem?  Where can I found the descriptions 
>> about BUG9724 ?
>>
>> -----------
>> Cao Tong
>>
>> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>>
>>> Hello,
>>>
>>> When I use timestamp format startdate="2015-07-31", it works find.
>>> When I use it like this startdate="2015-07-31 13:00:00".
>>> It return a error
>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
>>> instance at 0x16dca70>)
>>>
>>> Could anyone tell me why ?
>>>
>>> I have read the code 
>>> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still 
>>> not understand what was happening,
>>> it seems authenticate failed, but why??
>>>
>>> -----------
>>> Cao Tong
>>>
>>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>>
>>>> Hi,
>>>>
>>>>     was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd 
>>>> HH:mm:ss"
>>>>
>>>>
>>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>>
>>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>>
>>>>     >>> api.listEvents(startdate="2015-07-31 13:00:00")
>>>> Traceback (most recent call last):
>>>>   File "<stdin>", line 1, in <module>
>>>>   File "call.py", line 48, in handlerFunction
>>>>     return self._make_request(name, kwargs)
>>>>   File "call.py", line 60, in _make_request
>>>>     data = self._http_get(self.value)
>>>>   File "call.py", line 53, in _http_get
>>>>     response = urllib.urlopen(url)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>>     return opener.open(url)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>>     return getattr(self, name)(url)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>>     return self.http_error(url, fp, errcode, errmsg, headers)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>>     result = method(url, fp, errcode, errmsg, headers)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>>     errcode, errmsg, headers)
>>>>   File "/usr/lib64/python2.7/urllib.py", line 381, in 
>>>> http_error_default
>>>>     raise IOError, ('http error', errcode, errmsg, headers)
>>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
>>>> instance at 0x16dca70>)
>>>> >>>
>>>>
>>>>
>>>> my ACS version:
>>>>
>>>> [root@cs ~]# rpm -qa |grep cloud
>>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>>
>>>>
>>>
>>>
>>
>>
>
>



new timestamp format for API in ACS 4.5.1

Posted by to...@163.com.
Hi All:

     Does any one have any idea ? Thanks.

-----------
Cao Tong

On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>
> In ParamProcessWorker::setFieldValue() I found this lins:
>
>            case DATE:
>                 // This piece of code is for maintaining backward 
> compatibility
>                 // and support both the date formats(Bug 9724)
>
> Is it related to my problem?  Where can I found the descriptions about 
> BUG9724 ?
>
> -----------
> Cao Tong
>
> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>
>> Hello,
>>
>> When I use timestamp format startdate="2015-07-31", it works find.
>> When I use it like this startdate="2015-07-31 13:00:00".
>> It return a error
>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
>> instance at 0x16dca70>)
>>
>> Could anyone tell me why ?
>>
>> I have read the code 
>> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still 
>> not understand what was happening,
>> it seems authenticate failed, but why??
>>
>> -----------
>> Cao Tong
>>
>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>
>>> Hi,
>>>
>>>     was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>>>
>>>
>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>
>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>
>>>     >>> api.listEvents(startdate="2015-07-31 13:00:00")
>>> Traceback (most recent call last):
>>>   File "<stdin>", line 1, in <module>
>>>   File "call.py", line 48, in handlerFunction
>>>     return self._make_request(name, kwargs)
>>>   File "call.py", line 60, in _make_request
>>>     data = self._http_get(self.value)
>>>   File "call.py", line 53, in _http_get
>>>     response = urllib.urlopen(url)
>>>   File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>     return opener.open(url)
>>>   File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>     return getattr(self, name)(url)
>>>   File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>     return self.http_error(url, fp, errcode, errmsg, headers)
>>>   File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>     result = method(url, fp, errcode, errmsg, headers)
>>>   File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>     errcode, errmsg, headers)
>>>   File "/usr/lib64/python2.7/urllib.py", line 381, in 
>>> http_error_default
>>>     raise IOError, ('http error', errcode, errmsg, headers)
>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
>>> instance at 0x16dca70>)
>>> >>>
>>>
>>>
>>> my ACS version:
>>>
>>> [root@cs ~]# rpm -qa |grep cloud
>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>
>>>
>>
>>
>
>



new timestamp format for API in ACS 4.5.1

Posted by to...@163.com.
Hi All:

     Does any one have any idea ? Thanks.

-----------
Cao Tong

On 08/18/2015 06:04 PM, tony_caotong@163.com wrote:
>
> In ParamProcessWorker::setFieldValue() I found this lins:
>
>            case DATE:
>                 // This piece of code is for maintaining backward 
> compatibility
>                 // and support both the date formats(Bug 9724)
>
> Is it related to my problem?  Where can I found the descriptions about 
> BUG9724 ?
>
> -----------
> Cao Tong
>
> On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>>
>> Hello,
>>
>> When I use timestamp format startdate="2015-07-31", it works find.
>> When I use it like this startdate="2015-07-31 13:00:00".
>> It return a error
>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
>> instance at 0x16dca70>)
>>
>> Could anyone tell me why ?
>>
>> I have read the code 
>> "DefaultLoginAPIAuthenticatorCmd::authenticate()" , but I am still 
>> not understand what was happening,
>> it seems authenticate failed, but why??
>>
>> -----------
>> Cao Tong
>>
>> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>>
>>> Hi,
>>>
>>>     was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>>>
>>>
>>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>>
>>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>>
>>>     >>> api.listEvents(startdate="2015-07-31 13:00:00")
>>> Traceback (most recent call last):
>>>   File "<stdin>", line 1, in <module>
>>>   File "call.py", line 48, in handlerFunction
>>>     return self._make_request(name, kwargs)
>>>   File "call.py", line 60, in _make_request
>>>     data = self._http_get(self.value)
>>>   File "call.py", line 53, in _http_get
>>>     response = urllib.urlopen(url)
>>>   File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>>     return opener.open(url)
>>>   File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>>     return getattr(self, name)(url)
>>>   File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>>     return self.http_error(url, fp, errcode, errmsg, headers)
>>>   File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>>     result = method(url, fp, errcode, errmsg, headers)
>>>   File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>>     errcode, errmsg, headers)
>>>   File "/usr/lib64/python2.7/urllib.py", line 381, in 
>>> http_error_default
>>>     raise IOError, ('http error', errcode, errmsg, headers)
>>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
>>> instance at 0x16dca70>)
>>> >>>
>>>
>>>
>>> my ACS version:
>>>
>>> [root@cs ~]# rpm -qa |grep cloud
>>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>>
>>>
>>
>>
>
>



Re: new timestamp format for API in ACS 4.5.1

Posted by to...@163.com.
In ParamProcessWorker::setFieldValue() I found this lins:

            case DATE:
                 // This piece of code is for maintaining backward 
compatibility
                 // and support both the date formats(Bug 9724)

Is it related to my problem?  Where can I found the descriptions about 
BUG9724 ?

-----------
Cao Tong

On 08/18/2015 05:54 PM, tony_caotong@163.com wrote:
>
> Hello,
>
> When I use timestamp format startdate="2015-07-31", it works find.
> When I use it like this startdate="2015-07-31 13:00:00".
> It return a error
> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
> instance at 0x16dca70>)
>
> Could anyone tell me why ?
>
> I have read the code "DefaultLoginAPIAuthenticatorCmd::authenticate()" 
> , but I am still not understand what was happening,
> it seems authenticate failed, but why??
>
> -----------
> Cao Tong
>
> On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>>
>> Hi,
>>
>>     was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>>
>>
>> /    I found it in 4.5.0 API doc, but it seems not enabled.
>>
>> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>>
>>     >>> api.listEvents(startdate="2015-07-31 13:00:00")
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>>   File "call.py", line 48, in handlerFunction
>>     return self._make_request(name, kwargs)
>>   File "call.py", line 60, in _make_request
>>     data = self._http_get(self.value)
>>   File "call.py", line 53, in _http_get
>>     response = urllib.urlopen(url)
>>   File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>>     return opener.open(url)
>>   File "/usr/lib64/python2.7/urllib.py", line 208, in open
>>     return getattr(self, name)(url)
>>   File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>>     return self.http_error(url, fp, errcode, errmsg, headers)
>>   File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>>     result = method(url, fp, errcode, errmsg, headers)
>>   File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>>     errcode, errmsg, headers)
>>   File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>>     raise IOError, ('http error', errcode, errmsg, headers)
>> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
>> instance at 0x16dca70>)
>> >>>
>>
>>
>> my ACS version:
>>
>> [root@cs ~]# rpm -qa |grep cloud
>> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
>> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
>> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
>> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>>
>>
>
>



Re: new timestamp format for API in ACS 4.5.1

Posted by to...@163.com.
Hello,

When I use timestamp format startdate="2015-07-31", it works find.
When I use it like this startdate="2015-07-31 13:00:00".
It return a error
IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
instance at 0x16dca70>)

Could anyone tell me why ?

I have read the code "DefaultLoginAPIAuthenticatorCmd::authenticate()" , 
but I am still not understand what was happening,
it seems authenticate failed, but why??

-----------
Cao Tong

On 07/31/2015 07:07 PM, tony_caotong@163.com wrote:
>
> Hi,
>
>     was this format is enabled in ACS 4.5.1 like /"yyyy-MM-dd HH:mm:ss"
>
>
> /    I found it in 4.5.0 API doc, but it seems not enabled.
>
> http://cloudstack.apache.org/api/apidocs-4.5/user/listEvents.html
>
>     >>> api.listEvents(startdate="2015-07-31 13:00:00")
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "call.py", line 48, in handlerFunction
>     return self._make_request(name, kwargs)
>   File "call.py", line 60, in _make_request
>     data = self._http_get(self.value)
>   File "call.py", line 53, in _http_get
>     response = urllib.urlopen(url)
>   File "/usr/lib64/python2.7/urllib.py", line 87, in urlopen
>     return opener.open(url)
>   File "/usr/lib64/python2.7/urllib.py", line 208, in open
>     return getattr(self, name)(url)
>   File "/usr/lib64/python2.7/urllib.py", line 359, in open_http
>     return self.http_error(url, fp, errcode, errmsg, headers)
>   File "/usr/lib64/python2.7/urllib.py", line 372, in http_error
>     result = method(url, fp, errcode, errmsg, headers)
>   File "/usr/lib64/python2.7/urllib.py", line 683, in http_error_401
>     errcode, errmsg, headers)
>   File "/usr/lib64/python2.7/urllib.py", line 381, in http_error_default
>     raise IOError, ('http error', errcode, errmsg, headers)
> IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage 
> instance at 0x16dca70>)
> >>>
>
>
> my ACS version:
>
> [root@cs ~]# rpm -qa |grep cloud
> cloudstack-management-4.5.1-shapeblue0.el6.x86_64
> cloudstack-awsapi-4.5.1-shapeblue0.el6.x86_64
> cloudstack-agent-4.5.1-shapeblue0.el6.x86_64
> cloudstack-common-4.5.1-shapeblue0.el6.x86_64
>
>