import requests import json api_url = "https://canvas-api-test.anvil.app/_/api" def upload_assets(json_file_path, api_url): # Open and read the JSON file with open(json_file_path, "r") as file: assets_data = json.load(file) payload = {"assets": assets_data} print(payload) # Make the POST request to the API endpoint url = f"{api_url}/management/uploadAssets" response = requests.post(url, json=payload) # Check the response if response.status_code == 200: print("Assets uploaded successfully") else: print(f"Failed to upload assets: {response.status_code}") print(response.json()) if __name__ == "__main__": # Path to the JSON file containing the assets json_file_path = "D:/Git/ap-canvas-creation-module/01_backend/database/assets.json" # Application ID and sign (replace with actual values) app_id = "your_app_id" sign = "your_sign" # Call the upload function upload_assets(json_file_path, api_url)