I’ve managed to use the open source code to properly build the api request, but it’s still causing trouble. I initially tested the api using Postman, and this works, bringing back the expected results. So I recorded the api request in Postman, and then wrote my Xojo code to reproduce this. The requests in Postman and Xojo, and the error response, are below.
So I’m confident right up to the point at which I do UrlConnection.SetRequestContent(requestdata, “multipart/form-data”). But it feels to me like somewhere downstream of SetRequestContent the request is being mangled.
The api developers (probably reasonably) say that if Postman works and Xojo doesn’t, the problem is in Xojo. So I need to probe further into this. I had a look at various “request bin” services but so far it’s not very illuminating.
Has anyone played with alternatives to urlConnection in Xojo? I suppose I could use curl, and maybe tcp socket, but ideally I’d like to stick with urlConnection because it’s easy and I’ve always previously had success with it.
Postman request (works)
=======
Authorization: Basic YXBpdXNlcjpwb29scGFydHk=
User-Agent: PostmanRuntime/7.41.2
Accept: */*
Cache-Control: no-cache
Postman-Token: 2be2418a-2b04-4804-9e73-49646b8f25ae
Host: tellura.poolparty.biz
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Type: multipart/form-data; boundary=--------------------------457734510648452481990704
Cookie: JSESSIONID=02000A25B063D2E213F5E94F60921587
Content-Length: 1602219
----------------------------457734510648452481990704
Content-Disposition: form-data; name="file"; filename="2007.13883.pdf"
<2007.13883.pdf>
----------------------------457734510648452481990704--
Xojo request (fails - see error below)
====
Authorization: Basic YXBpdXNlcjpwb29scGFydHk=
User-Agent: PostmanRuntime/7.41.2
Accept: /
Cache-Control: no-cache
Host: tellura.poolparty.biz
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Type: multipart/form-data; boundary=--------------------------20240904095213
Content-Length: 1602002
----------------------------20240904095213
Content-Disposition: form-data; name=“file”; filename=“/Users/ianpiper/Documents/2007.13883.pdf”
<2007.13883.pdf>
----------------------------20240904095213–
The Xojo request gets this error back from the server:
{"responseBase":{"success":false,"status":500,"message":"Failed to parse multipart servlet request; nested exception is org.apache.commons.fileupload.FileUploadException: the request was rejected because no multipart boundary was found","resultType":"text/plain","result":null}}