2017-12-13 6 views
1

PowerShell에서 Coinspot API에 액세스하는 데 어려움을 겪고 있습니다. 아무리 내가 뭘 나는 항상 다시 API에서 "아니오 넌스"오류를 얻을 : Coinspot API with PowerShell

$VerbosePreference = 'Continue' 
$key = '' 
$secret = '' 

$epoc_start_date = ("01/01/1970" -as [DateTime]) 
[int]$nonce = ((New-TimeSpan -Start $epoc_start_date -End ([DateTime]::UtcNow)).TotalSeconds -as [string]) 

$baseUrl = 'www.coinspot.com.au/api' 
$resourcePath = '/my/orders' 
$url = 'https://{0}{1}&nonce={2}' -f $baseUrl, $resourcePath, $nonce 

$encoded = New-Object System.Text.UTF8Encoding 
$url_bytes = $encoded.GetBytes($url) 
# create hash 
$hmac = New-Object System.Security.Cryptography.HMACSHA512 
$hmac.key = [Text.Encoding]::ASCII.GetBytes($secret) 
$sha_result = $hmac.ComputeHash($url_bytes) 
#remove dashes 
$hmac_signed = [System.BitConverter]::ToString($sha_result) -replace "-"; 

$headers = @{ 
    sign = $hmac_signed 
    key = $key 
    'content-type' = 'application/json' 
} 
$result = Invoke-RestMethod -Uri $url -Method Post -Headers $headers 
$result 

는 또한 이미 검사를하지 :

$VerbosePreference = 'Continue' 
$key = '' 
$secret = '' 

$epoc_start_date = ("01/01/1970" -as [DateTime]) 
[int]$nonce = ((New-TimeSpan -Start $epoc_start_date -End ([DateTime]::UtcNow)).TotalSeconds -as [string]) 

$baseUrl = 'www.coinspot.com.au/api' 
$resourcePath = '/my/orders' 
$url = 'https://{0}{1}' -f $baseUrl, $resourcePath 

$body = @{ 
    nonce = $nonce 
} 

$encoded = New-Object System.Text.UTF8Encoding 
$body_bytes = $encoded.GetBytes($body) 
# create hash 
$hmac = New-Object System.Security.Cryptography.HMACSHA512 
$hmac.key = [Text.Encoding]::ASCII.GetBytes($secret) 
$sha_result = $hmac.ComputeHash($body_bytes) 
#remove dashes 
$hmac_signed = [System.BitConverter]::ToString($sha_result) -replace "-"; 

Invoke-RestMethod -Uri $url -Method Post -Headers @{sign = $hmac_signed ; key = $key ; 'content-type' = 'application/json' } -Body $($body | ConvertTo-Json) 

두 번째는 나에게 invalid 상태 오류를 제공합니다. 내 머리글에 문제가 있다고 생각합니다.

+0

여기에 동일합니다. PHP 응용 프로그램에서 시도. 내가 아는 한, API는 잠시 동안 업데이트되지 않았습니다. – ericbae

답변

4

Coinspot 지원 응답 :

사과를이를 위해.

현재 API 시스템이 오래되어 업데이트해야합니다. 우리는 가능한 한 개발자를 지원해야한다는 것을 알고 있지만 현재 개발자 팀은 순간에 다른 작업에 매우 바쁩니다.
그들은 이것을 알고 있으며 가능한 한 빨리 업데이트 할 계획이지만, 지금은이를위한 ETA가 없습니다.

불편을 끼쳐 드려 죄송합니다.