Hi Peter,
sorry for my late answer,
I use Version 1.8.7.
her is my skript sorry I´m newbie
the access works and it shows me the old ID
import requests, json
from pprint import pprint
token_url = “http://myxiboadress/api/authorize/access_token”
test_api_url = “http://ds.media-brueggemann.de/api/”
#client credentials
client_id = 'xxxxx’
client_secret = ‘xxxxx’
#step A, - single call with client credentials as the basic auth header - will return access_token
data = {‘grant_type’: ‘client_credentials’}
access_token_response = requests.post(token_url, data=data, verify=False, allow_redirects=False, auth=(client_id, client_secret))
tokens = json.loads(access_token_response.text)
##print(access_token_response.text)
print("Bearer " + tokens[‘access_token’])
#Abfrage Media ID
url1 = “http://myxiboadress/api/library”
querystring = {“media”:“CTV_Sendung”}
headers = {
‘Authorization’: "Bearer " + tokens[‘access_token’],
‘Cache-Control’: “no-cache”,
}
mediaId_response = requests.get(url1, headers=headers, params=querystring)
mediaId = json.loads(mediaId_response.text)
print(mediaId[0][‘mediaId’])
#Upload File
payload = “------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=“files”; filename=“C:\test.JPG”\r\nContent-Type: image/jpeg\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=“name”\r\n\r\nCTV_Sendung\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=“oldMediaId”\r\n\r\n156\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=“updateInLayouts”\r\n\r\n1\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=“deleteOldRevisions”\r\n\r\n1\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW–”
headers = {
‘content-type’: “multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW”,
‘Cache-Control’: “no-cache”,
‘Content-Type’: “application/json”,
‘Postman-Token’: “a7c524e4-dac6-442c-8387-f9c7605cd1a8”,
}
response = requests.request(“POST”, url1, data=payload, headers=headers)
print(response.text)