次のコードを使用してSkyDriveのAPIをテストしています。
Dim webRequest As HttpWebRequest = DirectCast(HttpWebRequest.Create("https://apis.live.net/v5.0/me/skydrive/files?access_token=" & Me.ACCESS_TOKEN), HttpWebRequest)
webRequest.Method = "POST"
webRequest.ContentType = "multipart/form-data; boundary=A300x"
webRequest.KeepAlive = True
webRequest.Timeout = 80000
Using streamWriter As New System.IO.StreamWriter(webRequest.GetRequestStream())
streamWriter.Write("--A300x\r\n")
streamWriter.Write("Content-Disposition: form-data; name=""file""; filename=""HelloWorld.txt""\r\n")
streamWriter.Write("Content-Type: application/octet-stream\r\n")
streamWriter.Write("\r\n")
streamWriter.Write("vooo")
streamWriter.Write("\r\n")
streamWriter.Write("--A300x--\r\n")
streamWriter.Close()
End Using
' response
Using webResponse As HttpWebResponse = DirectCast(webRequest, HttpWebRequest).GetResponse()
If webResponse.StatusCode() = HttpStatusCode.OK Then
Using streamReader As New System.IO.StreamReader(webResponse.GetResponseStream())
Throw New Exception(streamReader.ReadToEnd())
streamReader.Close()
End Using
End If
webResponse.Close()
End Using
不正なリクエストを取得しています(400)。アクセストークンとURLが検証され、有効です。どんな手掛かり?