Search code examples
desire2learn

Uploading to locker in Desire2Learn


I'm encountering a problem uploading a file to a locker in D2L's API. Send data is below.

I'm getting a 404 error in response to this. I've tried using 'test2.jpg' and content-type of image/jpeg, I've also tried plaintext instaed of binary and using text/plain as a content-type.

Any advice would be helpful

Thanks.

POST /d2l/api/le/1.0/locker/myLocker/test?<auth Keys> HTTP/1.1  
User-Agent: PECL::HTTP/1.6.1-dev (PHP/5.2.6)  
Host: <server>
Accept: */*  
Content-Type: multipart/mixed; boundary=BOUND  
Content-Length: 252  

--BOUND  
Content-Type: application/json  

{"Description":"test2.tst", "IsPublic":false}  
--BOUND  
Content-Disposition: form-data; name=""; filename="test2.tst"  
Content-Type: application/x-octetstream  

<base64_encoded string>
--BOUND--

Solution

  • Solution was to ensure that the header is using \r\n instead of just \n to separate sections.