Search The ForumSearch   RegisterRegister  LoginLogin

AfterLogic Aurora

 AfterLogic Forum : AfterLogic Aurora
Subject Topic: Uploading files using WebAPI and curl Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
bnoeafk
Newbie
Newbie
Avatar

Joined: 23 February 2022
Location: United States
Online Status: Offline
Posts: 9
Posted: 23 February 2022 at 8:46pm | IP Logged Quote bnoeafk

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:


  1. Ensure that I can upload through the web UI (which I can)

  2. 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 View bnoeafk's Profile Search for other posts by bnoeafk
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 24 February 2022 at 11:27pm | IP Logged Quote Igor

Hello,

Have just answered this in the other thread. Thanks.

--
Regards,
Igor, Afterlogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide