Open FareedMN opened 5 years ago
After more testing i found out that neither POST or GET work on the endpoints /api/v1/order but they work on the other endpoints
Hello @FareedMN . Just tested on production. And everything is work properly. There is example of request:
Get orders list example:
curl -H "X-ETBS-APIKEY: <api_key>" https://private-api.ethbits.com/api/v1/orders?walletId=<wallet_id>
Create order example:
signature = echo -n "symbol=ETBS_BTC&side=SELL&type=LIMIT&amount=2&price=0.00031&walletId=<wallet_id>" | openssl dgst -sha256 -hmac "<secret_key>"
curl -H "X-ETBS-APIKEY: <api_key>" -X POST https://private-api.ethbits.com/api/v1/orders -d 'symbol=ETBS_BTC&side=SELL&type=LIMIT&amount=2&price=0.00031&walletId=<wallet_id>&signature=<signature>'
Cancel order example:
signature = echo -n "walletId=<wallet_id>&orderId=<order_id>" | openssl dgst -sha256 -hmac "<secret_key>"
curl -H "X-ETBS-APIKEY: <api_key>" -X DELETE https://private-api.ethbits.com/api/v1/orders -d 'walletId=<wallet_id>&orderId=<order_id>'
thanks for the response it seems there is a typo in the readme file , the endpoint is /api/v1/orders while in the readme it say /api/v1/order
i have tried the commands that you sent to me and i keep getting {"error":"Invalid signature"} more details :
(stdin)= 4a7a2dc4f2de810ff39448add3904f29d23e64b67b6aa65c4e89f59d6eb1a1d8 Note: Unnecessary use of -X or --request, POST is already inferred. == Info: Trying 104.20.85.69... == Info: Connected to private-api.ethbits.com (104.20.85.69) port 443 (#0) == Info: found 148 certificates in /etc/ssl/certs/ca-certificates.crt == Info: found 596 certificates in /etc/ssl/certs == Info: ALPN, offering http/1.1 == Info: SSL connection using TLS1.2 / ECDHE_ECDSA_AES_128_GCM_SHA256 == Info: server certificate verification OK == Info: server certificate status verification SKIPPED == Info: common name: ssl789018.cloudflaressl.com (matched) == Info: server certificate expiration date OK == Info: server certificate activation date OK == Info: certificate public key: EC == Info: certificate version: #3 == Info: subject: OU=Domain Control Validated,OU=PositiveSSL Multi-Domain,CN=ssl789018.cloudflaressl.com == Info: start date: Thu, 04 Oct 2018 00:00:00 GMT == Info: expire date: Fri, 12 Apr 2019 23:59:59 GMT == Info: issuer: C=GB,ST=Greater Manchester,L=Salford,O=COMODO CA Limited,CN=COMODO ECC Domain Validation Secure Server CA 2 == Info: compression: NULL == Info: ALPN, server accepted to use http/1.1 => Send header, 252 bytes (0xfc) 0000: POST /api/v1/orders HTTP/1.1 001e: Host: private-api.ethbits.com 003d: User-Agent: curl/7.47.0 0056: Accept: / 0063: X-ETBS-APIKEY: 94ceec51d46c7f2000a0db2fa8ffb46745d91c8e14b39cee3 00a3: f889322aa7f7286 00b4: Content-Length: 147 00c9: Content-Type: application/x-www-form-urlencoded 00fa: => Send data, 147 bytes (0x93) 0000: symbol=ETBS_BTC&side=SELL&type=LIMIT&amount=2&price=0.00031&wall 0040: etId=183&signature=4a7a2dc4f2de810ff39448add3904f29d23e64b67b6aa 0080: 65c4e89f59d6eb1a1d8 == Info: upload completely sent off: 147 out of 147 bytes <= Recv header, 35 bytes (0x23) 0000: HTTP/1.1 422 Unprocessable Entity <= Recv header, 37 bytes (0x25) 0000: Date: Sun, 17 Feb 2019 21:49:49 GMT <= Recv header, 47 bytes (0x2f) 0000: Content-Type: application/json; charset=utf-8 <= Recv header, 20 bytes (0x14) 0000: Content-Length: 29 <= Recv header, 24 bytes (0x18) 0000: Connection: keep-alive <= Recv header, 142 bytes (0x8e) 0000: Set-Cookie: __cfduid=d8128a2a51e94cf1df6e7d40ef65ae31a1550440189 0040: ; expires=Mon, 17-Feb-20 21:49:49 GMT; path=/; domain=.ethbits.c 0080: om; HttpOnly <= Recv header, 25 bytes (0x19) 0000: Cache-Control: no-cache <= Recv header, 26 bytes (0x1a) 0000: x-rate-limit-limit: 1000 <= Recv header, 29 bytes (0x1d) 0000: x-rate-limit-remaining: 990 <= Recv header, 42 bytes (0x2a) 0000: ETag: W/"1d-yZLFzBNCp4doOO1WhSH8Bl8A6FI" <= Recv header, 100 bytes (0x64) 0000: Expect-CT: max-age=604800, report-uri="https://report-uri.cloudf 0040: lare.com/cdn-cgi/beacon/expect-ct" <= Recv header, 20 bytes (0x14) 0000: Server: cloudflare <= Recv header, 30 bytes (0x1e) 0000: CF-RAY: 4aab774feeef9c0b-AMS <= Recv header, 2 bytes (0x2) 0000: <= Recv data, 29 bytes (0x1d) 0000: {"error":"Invalid signature"} == Info: Connection #0 to host private-api.ethbits.com left intact {"error":"Invalid signature"}
@FareedMN Thanks for correction. You should create signature in this way:
echo -n "symbol=ETBS_BTC&side=SELL&type=LIMIT&amount=2&price=0.00031&walletId=183" | openssl dgst -sha256 -hmac "<private_key>"
What OS do you use?
i tried on two machines one with windows 10 and a VPS with ubuntu 16.04 and i'm still getting the same error {"error":"Invalid signature"}
When i try to make a POST request with Curl and php i keep getting the error Method Not Allowed. Can you check that please ?