Hello, Running into some issues with updating a user's profile image through the POST /d2l/api/l

Options
*Update* So far I have:// from multer — upload.single(‘file)const fileInfo = {        name: file.originalname,        contentType: file.mimetype,        buffer: file.buffer,        size: file.size,}; const form = new FormData();form.append('profileImage', fileInfo.buffer);const config = {       method: 'post',       url: 'https://some-edu.brightspace.com/api/lp/1.9/profile/myprofile/image?x_a={app_id}&x_b={user_id}&x_c={app_key}&x_d={user_key}&x_t={unix_timestamp_in_seconds}',       headers: {        ...form.getHeaders(),       },       data: form,}; await axios(config)      .then((response) => {       console.log(JSON.stringify(response.data));}).catch((error) => {       console.log(error);}); I pulled this axios code from Postman. When this request is translated to HTTP, it is: POST /api/lp/1.9/profile/myprofile/image?x_a={app_id}&x_b={user_id}&x_c={app_key}&x_d={user_key}&x_t={unix_timestamp_in_seconds}' HTTP/1.1Host: some-edu.brightspace.comContent-Length: 188Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW ----WebKitFormBoundary7MA4YWxkTrZu0gWContent-Disposition: form-data; name="profileImage"; filename="profile.png"Content-Type: image/png (data)----WebKitFormBoundary7MA4YWxkTrZu0gW It looks like the example provided on the File uploads page for updating a profile image (https://docs.valence.desire2learn.com/basic/fileupload.html#simple-uploads), besides the boundary created by Postman. The axios response shows a redirect to /d2l/error/404/. Not quite sure what to try next. Any help would be appreciated. Thanks,Dominic
Tagged:

Answers