I'm encountering a problem (HTTP STATUS 400 Bad Request) using code to decode VINs if I send more than 12, but if I send a list of over 100 by pasting into website, I get results.
I'm using following code to send a list of VINs to get back information from NHTSA vin decoder (https://vpic.nhtsa.dot.gov/api/, Decode VIN (flat format) in a Batch)
request = "VIN1;VIN2;VIN3; ...?format=xml" <- just example to show format of data
Set http = New WinHTTP.WinHttpRequest
http.settimeouts 30000,30000,30000,30000
http.open "POST","https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVinValuesBatch", False
http.SetRequestHeader "Content-Type", "text/plain"
http.send request
response = http.ResponseText
I thought this might be some length limitation, so I've tried setting content length to the length of the string being sent, but that didn't seem to help. I've searched quite a bit, but couldn't find anything in particular that would explain. I thought maybe NHTSA has a limit on what can be sent back, but since I can paste the list into the website manually and get the results that didn't make a lot of sense. It provides the same XML formatted data back that way. I'm not sure what else to try, so hoping someone else will have other ideas. I'm new to using WinHTTPRequest, so it is very possible I'm making a really dumb mistake.