DotEfekts / TradeCommander

A CLI style interface for the SpaceTraders API, written in Blazor WebAssembly.
https://tradecommander.dotefekts.net
GNU General Public License v3.0
26 stars 2 forks source link

"maybe" a bug? #4

Closed Hedrauta closed 3 years ago

Hedrauta commented 3 years ago

Failed to load resource: the server responded with a status of 422 ()

Tried buying the max of 4834 research at XV-TLF .... got an error.... what does 422 mean? Had about 17million on bank... buying a smaller package ( 4x1k + 1x834) worked fine <.<

DotEfekts commented 3 years ago

This will be caused by the 1000 buy limit on the API. I'll get a fix in to clamp the max quantity soon.

Hedrauta commented 3 years ago
PS C:\Users\h3dra> 
$token = '********************************'
$username = 'H3draut3r'
$params = @{
    Uri         = "https://api.spacetraders.io/users/$username/sell-orders"
    Headers     = @{ 'Authorization' = "Bearer $token" }
    Method      = 'POST'
    Body        = @{ 'ShipId' = "**********************"; 'good' = "RESEARCH" ; 'quantity' = "5725" }
}
$info = Invoke-WebRequest -UseBasicParsing @params
$info

Invoke-WebRequest : {"error":{"message":"The payload was invalid. Please check the error details to correct your payload and try again.","code":42201,"data":{"shipId":["The shipId field is 
required."],"quantity":["The quantity may not be greater than 1000."]}}}

Ye... I found that one too... after testing it on a Powershell-script 😄

DotEfekts commented 3 years ago

Repeating requests when over the buy limit has been added in 0dd17f3.