Author |
|
bnoeafk Newbie
Joined: 23 February 2022 Location: United States
Online Status: Offline Posts: 9
|
Posted: 23 February 2022 at 8:46pm | IP Logged
|
|
|
I've been working with Aurora and trying to get a file uploaded using `curl` but the closest attempt to working is still returning an error code and no file being uploaded.
I appreciate that the majority of the documentation refers to PHP uploads etc, but I wonder if it's still possible to perform a file upload using curl?
This is what I've tried thus far:
- Ensure that I can upload through the web UI (which I can)
- Obtain my Bearer Auth Token using a curl call
This is my current bash script, utilizing `jq` for JSON processing:
#!/usr/bin/env bash
server=https://aurora-files.mydomain.com
api="files/?/Api/"
apiUpload="files/?/Upload/"
user=test
pass=test
LoginResponse=$(curl -s -d "Module=Core&Method=Login&Parameters={\"Login\":\"${user}\",\"Password\":\"${pass}\"}" -H "Accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -X POST "${server}/${api}")
AuthToken=$(echo ${LoginResponse} | jq -r '.Result.AuthToken')
FileUpload=$(curl -v -d "Module=Files&Method=UploadFile&Parameters={{\"Type\":\"personal\",\"Path\":\"\",\"FileData\":{\"Size\":\"62\",\"Name\":\"test.txt\",\"tmp_name\":\"test.txt\"}}}" -H "Accept: application/json" -H "Authorization: Bearer ${AuthToken}" -X POST "${server}/${apiUpload}" --data-binary "@/path/to/test.txt")
I'm pretty sure that it's the `FileData` JSON string, but I can't seem to figure out what I should be putting in there. The WebAPI documentation is excellent but this is the one area where I believe it could do with a little more explanation.
Can anyone assist? Just a little more explanation should suffice!!
Thanks
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 24 February 2022 at 11:27pm | IP Logged
|
|
|
Hello,
Have just answered this in the other thread. Thanks.
--
Regards,
Igor, Afterlogic Support
|
Back to Top |
|
|