Using the QFieldCloud SDK I can list my QFieldCloud projects and download files, but I get the following error when trying to upload and overwrite existing gpkg files. Is this possible?
‘status’: <FileTransferStatus.FAILED: ‘FAILED’>, ‘error’: Requested “https://app.qfield.cloud/api/v1/packages/jjj/ppp/files/OperationPOI.gpkg/” and got “403 Forbidden”:
{
“code”: “permission_denied”,
“message”: “Permission denied”
}
Here is the code I am using…
my_token = "ttt"
download_dpath = r"my_download_dpath"
project_dpath = r"my_project_dpath"
client = sdk.Client(
url="https://app.qfield.cloud/api/v1/",
token=my_token
)
try:
projects = client.list_projects()
for project in projects:
if project['name'] == 'OperationPOI':
project_id = project['id']
# download files to an import directory
client.package_download(project_id,download_dpath)
# make some changes to the gpkg files in the original project directory
...
# at this point I can manually use QGIS to synchronize the package, but I would like this stop to be
# automated using this script
upload_type = sdk.FileTransferType.PACKAGE
job_id = uuid.uuid4()
local_files = client.upload_files(project_id=project_id,project_path=project_dpath,upload_type=upload_type,filter_glob="*.gpkg",job_id=job_id)
print (local_files)
except requests.exceptions.RequestException:
print("Oops!")
Imported from GitHub discussion by @troussell on 2023-03-16T18:45:46Z