Get Files
π Get All File Order IDs by User ID
To get your file order IDs with their file names and write them to a JSON file, use the following sample code:
import requests
import json
# API endpoint
api_url = "https://um2vro8lrb.execute-api.eu-central-1.amazonaws.com/prod/filedirectory/getallfiles"
# Parameters for the API call
# app is taken 'all' by default write the app name you want to get files from if you want files from a specific app
# for getting transcriptions give 'app' as 'transkriptor'
params = {
'cid': 'your_api_key',
'app': 'all'
}
# Make the API call
response = requests.get(api_url, params=params)
# Check the status code
if response.status_code == 200:
print("API call successful.")
data = response.json()
# Print the result
print(json.dumps(data, indent=4))
# Write the output to a JSON file
with open('output.json', 'w') as json_file:
json.dump(data, json_file, indent=4)
else:
print(f"API call failed with status code: {response.status_code}")
print("Response:", response.text)
Response
200 OK
{
"file name1": "order_id1",
"file name2": "order_id2"
}
400 Bad Request
{
"message": "API Key is required"
}
500 Internal Server Error
{
"message": "Internal Server Error"
}
Get All Folder IDs by User ID
To get your folder ids by user id.
import requests
import json
cid = 'your_api_key'
url = "https://i3w4h1tgb5.execute-api.eu-central-1.amazonaws.com/default/AA-API-GetFolders"
params = {
'cid': cid
}
response = requests.get(url, params=params)
if response.status_code == 200:
response_data = response.json()
print(f"hashedid: {cid}")
for item in response_data:
folder_name = item.get('Fname', {}).get('S', 'Unknown Folder')
folder_id = item.get('id', 'Unknown ID')
print(f"{folder_name}: {folder_id}")
else:
print(f"Failed to get folders. Status code: {response.status_code}")
print("Response text:")
print(response.text)
Response
200 OK
folder_name1 : folder_id1
folder_name2 : folder_id2
400 Bad Request
{
"message": "API Key is required"
}
500 Internal Server Error
{
"message": "Internal Server Error"
}
Get All Files Under a Folder By Folder ID
To get your file order ids with their file names by folder id
import requests
import json
import os
cid = 'your_folder_id'
app = 'all'
url = "https://0koqxthb4m.execute-api.eu-central-1.amazonaws.com/default/AA-API-GetFiles"
params = {
'cid': cid,
'app': app
}
def remove_extension(filename):
return os.path.splitext(filename)[0]
response = requests.get(url, params=params)
if response.status_code == 200:
response_data = response.json()
for item in response_data:
filename = item.get('FileName', {}).get('S', 'Unknown File')
order_id = item.get('OrderID', {}).get('S', 'Unknown ID')
print(f"{remove_extension(filename)}: {order_id}")
else:
print(f"Failed to get files. Status code: {response.status_code}")
print("Response text:")
print(response.text)
Response
200 OK
hashedid: your_user_id
file_name1: order_id1
file_name2: order_id2
400 Bad Request
{
"message": "API Key is required"
}
500 Internal Server Error
{
"message": "Internal Server Error"
}
Updated 3 months ago