Author

Topic: Huobi API returns error: Invalid time format (Read 213 times)

full member
Activity: 384
Merit: 150
i have same trouble and i set (UTC -0) but it's doesn't not work
newbie
Activity: 5
Merit: 0
Which language are you making API requests? I'm digging deeper and looks like, Timestamp should be current request time, so you must generate timestamp on request. Have you looked at their REST API Demos? Here is url https://github.com/huobiapi/REST-API-demos

I found the problem - the time should be strictly Greenwich (UTC-0) time without any offsets.
Thank you for your help!

I sends API in PHP and C#. If you need something - I'm always ready to help.
member
Activity: 69
Merit: 20
Lama
Which language are you making API requests? I'm digging deeper and looks like, Timestamp should be current request time, so you must generate timestamp on request. Have you looked at their REST API Demos? Here is url https://github.com/huobiapi/REST-API-demos
newbie
Activity: 5
Merit: 0
I'm just making a blind guess, but I think you don't include Time zone in your Date format, you just passing current date without time zone, which they mentioned in documentation, that you need to include it.

There is js snippet to encode this string: encodeURIComponent("2018-05-04T12:10:36+UTC TIME ZONE"); or encodeURIComponent("2018-05-04T12:10:36+00:00"); which results in something like this 2018-05-04T12%3A10%3A36%2B00%3A00

Thank you. It's a good point. I tried to include my UTC zone (UTC-5) this ways:

2018-05-04T12%3A10%3A36%2B-5%3A00
and
2018-05-04T12%3A10%3A36%2B-5

and got another error - Incorrect Time Format.
But, maybe  2018-05-04T12%3A10%3A36%2B-05%3A00 will work. I'll try it.
Thanks.
I think Time zone format has a strict rules it should always be +00:00, or -03:00, you must include all four numbers.

I tried 2018-05-04T12%3A10%3A36%2B-05%3A00 but got  Incorrect Time Format. Maybe I get this error, because I have zero balances in Huobi. Sad
Wierd. Maybe you already find solution? because in google there is no answers at all.
I found a similar problem in chat here https://github.com/ccxt/ccxt/issues/1485. But it didn't help me. Do you use Houbi API sometimes?
member
Activity: 69
Merit: 20
Lama
I'm just making a blind guess, but I think you don't include Time zone in your Date format, you just passing current date without time zone, which they mentioned in documentation, that you need to include it.

There is js snippet to encode this string: encodeURIComponent("2018-05-04T12:10:36+UTC TIME ZONE"); or encodeURIComponent("2018-05-04T12:10:36+00:00"); which results in something like this 2018-05-04T12%3A10%3A36%2B00%3A00

Thank you. It's a good point. I tried to include my UTC zone (UTC-5) this ways:

2018-05-04T12%3A10%3A36%2B-5%3A00
and
2018-05-04T12%3A10%3A36%2B-5

and got another error - Incorrect Time Format.
But, maybe  2018-05-04T12%3A10%3A36%2B-05%3A00 will work. I'll try it.
Thanks.
I think Time zone format has a strict rules it should always be +00:00, or -03:00, you must include all four numbers.

I tried 2018-05-04T12%3A10%3A36%2B-05%3A00 but got  Incorrect Time Format. Maybe I get this error, because I have zero balances in Huobi. Sad
Wierd. Maybe you already find solution? because in google there is no answers at all.
newbie
Activity: 5
Merit: 0
I'm just making a blind guess, but I think you don't include Time zone in your Date format, you just passing current date without time zone, which they mentioned in documentation, that you need to include it.

There is js snippet to encode this string: encodeURIComponent("2018-05-04T12:10:36+UTC TIME ZONE"); or encodeURIComponent("2018-05-04T12:10:36+00:00"); which results in something like this 2018-05-04T12%3A10%3A36%2B00%3A00

Thank you. It's a good point. I tried to include my UTC zone (UTC-5) this ways:

2018-05-04T12%3A10%3A36%2B-5%3A00
and
2018-05-04T12%3A10%3A36%2B-5

and got another error - Incorrect Time Format.
But, maybe  2018-05-04T12%3A10%3A36%2B-05%3A00 will work. I'll try it.
Thanks.
I think Time zone format has a strict rules it should always be +00:00, or -03:00, you must include all four numbers.

I tried 2018-05-04T12%3A10%3A36%2B-05%3A00 but got  Incorrect Time Format. Maybe I get this error, because I have zero balances in Huobi. Sad
member
Activity: 69
Merit: 20
Lama
I'm just making a blind guess, but I think you don't include Time zone in your Date format, you just passing current date without time zone, which they mentioned in documentation, that you need to include it.

There is js snippet to encode this string: encodeURIComponent("2018-05-04T12:10:36+UTC TIME ZONE"); or encodeURIComponent("2018-05-04T12:10:36+00:00"); which results in something like this 2018-05-04T12%3A10%3A36%2B00%3A00

Thank you. It's a good point. I tried to include my UTC zone (UTC-5) this ways:

2018-05-04T12%3A10%3A36%2B-5%3A00
and
2018-05-04T12%3A10%3A36%2B-5

and got another error - Incorrect Time Format.
But, maybe  2018-05-04T12%3A10%3A36%2B-05%3A00 will work. I'll try it.
Thanks.
I think Time zone format has a strict rules it should always be +00:00, or -03:00, you must include all four numbers.
newbie
Activity: 5
Merit: 0
I'm just making a blind guess, but I think you don't include Time zone in your Date format, you just passing current date without time zone, which they mentioned in documentation, that you need to include it.

There is js snippet to encode this string: encodeURIComponent("2018-05-04T12:10:36+UTC TIME ZONE"); or encodeURIComponent("2018-05-04T12:10:36+00:00"); which results in something like this 2018-05-04T12%3A10%3A36%2B00%3A00

Thank you. It's a good point. I tried to include my UTC zone (UTC-5) this ways:

2018-05-04T12%3A10%3A36%2B-5%3A00
and
2018-05-04T12%3A10%3A36%2B-5

and got another error - Incorrect Time Format.
But, maybe  2018-05-04T12%3A10%3A36%2B-05%3A00 will work. I'll try it.
Thanks.
member
Activity: 69
Merit: 20
Lama
I'm just making a blind guess, but I think you don't include Time zone in your Date format, you just passing current date without time zone, which they mentioned in documentation, that you need to include it.

There is js snippet to encode this string: encodeURIComponent("2018-05-04T12:10:36+UTC TIME ZONE"); or encodeURIComponent("2018-05-04T12:10:36+00:00"); which results in something like this 2018-05-04T12%3A10%3A36%2B00%3A00
newbie
Activity: 5
Merit: 0
Please, someone, help me to resolve my problem.
I try to retrieve my Huobi balances with API and always get error: "Signature not valid: Invalid time format".
Everything is done according to their help documents.

1) I create a signature using SHA256 generator with my secret key and text like this:

GET\n
api.huobi.pro\n
/v1/account/accounts/xxxxx.com/balance\n
AccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xxxx&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2018-06-04T15%3A19%3A30

2) Enter this URL to my browser:

https://api.huobi.pro/v1/account/accounts/xxxxx.com/balance?AccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xxxx&order-id=1234567890&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2018-06-04T15%3A19%3A30&Signature=4F65x5jkbLyMWVQj3Aqp%2BB4w%2BivaAty5Oi2SuYtCJ9o%3D

The result is  {"status":"error","err-code":"api-signature-not-valid","err-msg":"Signature not valid: 无效的提交时间","data":null}

无效的提交时间 is  Invalid time format.

May be someone have experience with this stuff. Thank you in advance.
Jump to: