{“code”:“bad_request”,“message”:“required field bucketId is missing”,“status”:400}
I receive this response from the Back Blaze API with the following code. The reason is that the URLConnection.SetRequestContent method is not setting the provided string in the body of the request. B2’s API for the b2_get_upload_url requires the bucketId field in the body, not a header. I. have tried both jBucket.ToString as well as assigning the .ToString to a string. I have also tried hard coding the bucketId rather than use a variable. All yield the same result. No bucketId in the body of the request.
Dim requestURL As String = "https://api.backblazeb2.com/b2api/v2/b2_get_upload_url"
Dim jBucket As new JSONItem
Dim j As new JSONItem
Dim jBucketString As String
jBucket.Value("bucketId") = "{bucketid}"
jBucketString = jBucket.ToString
urlConn1.ClearRequestHeaders()
urlConn1.RequestHeader("Authorization") = auth.authToken
urlConn1.SetRequestContent(jBucketString, "application/json")
j.Load urlConn1.SendSync("GET", requestURL, 5)