Hi! I am adding multiple images (jpg format) to ArcGIS Portal using Python REST API.
So far the part of the code that works (except 'overwrite' parameter) looks like that:
addItem_files = {'file':open(addItem_file_path, 'rb')}
response = requests.post(refererUrl+'/rest/content/users/'
+username+'/'+addItem_portal_folder+'/addItem?'
+'token='+portalToken
+'&overwrite=True'
+'&type='+addItem_type
+'&title='+addItem_filename
+'&tags='+addItem_tags
+'&culture=pl'
+ '&f=json',
files=addItem_files)
I have hit a wall when trying to add thumbnails in the process.
Thumbnails are stored in the subfolder and their names correspond to the original file name ('thumb_*' prefix).
The code with thumbnails implemented look like that:
addItem_files = {'file':open(addItem_file_path, 'rb'),
'thumbnail':open(addItem_thumbnail_path, 'rb')}
response = requests.post(refererUrl+'/rest/content/users/'
+username+'/'+addItem_portal_folder+'/addItem?'
+'token='+portalToken
+'&overwrite=True'
+'&thumbnail='+thumbnail_name
+'&type='+addItem_type
+'&title='+addItem_filename
+'&tags='+addItem_tags
+'&culture=pl'
+ '&f=json',
files=addItem_files)
Unfortunately there's no result, no thumbnail or even original image.
I would appreciate any suggestions how to properly upload file with thumbnails as well with the overwrite parameter.
Both the thumbnail and overwrite parameters work when using ArcGIS Portal Directory:
/sharing/content/users/user/addItem
Also, I am working with both ArcGIS Portal and ArcGIS Server Linux versions 10.4.1.
Any help on this is highly appreciated.
Thanks!