I have some questions regarding bulk import
https://docs.alfresco.com/content-services/6.1/admin/import-transfer/#import-tool-fieldsvals
A former colleague used this to import data.
curl 'https://'${ALFRESCOHOST}'/alfresco/service/bulkfsimport/initiate' \ -H 'Authorization: Basic '${PWDHASH}'' \ -L POST --url "https://'${ALFRESCOHOST}'/alfresco/s/bulkfsimport/initiate" --data "targetNodeRef=workspace://SpacesStore/${USERDIRUUID}&sourceDirectory=${CONTAINERPATH}/${OLDDHSNAME}_k&existingFileMode.skip"
I've been trying to do a similar thing on python, but how do I exactly approach this? It seems to me that
I've made something like this.
def bulk_import(row, options, b64encoded, data): url = 'https://' + options['servername'] + '/alfresco/service/bulkfsimport/initiate' headers={"Authorization": f'Basic {b64encoded}'} response = requests.post(url=url, data=data) return response data = f'targetNodeRef=workspace://SpacesStore/{personDirectoryId}&sourceDirectory={row["system_location"]}&existingFileMode.skip'
But it gives me an error. 401.
Solved! Go to Solution.
data = {'targetNodeRef': f'workspace://SpacesStore/{create_folder_entry["id"]}', 'sourceDirectory' : f'{row["system_location"]}', 'existingFileMode.skip': ""} headers={"Authorization": f'Basic {b64encoded}', 'Content-Type': 'application/x-www-form-urlencoded'}
This worked!
First problem solved, I forgot to add headers to request.
Second problem still active: Request sent by the client was syntactically incorrect.
03140066 Error: neither parameter 'targetNodeRef' nor parameter 'targetPath' was provided, but at least one is required !
I got it to work using postman, well. The only thing missing is that bulkimport can't see my filesystem so i have to copy over all the files to the same docker container where the bulk import thingy sits and make the exact same system_location there.
Now i need to convert this postman thingy to python.
data = {'targetNodeRef': f'workspace://SpacesStore/{create_folder_entry["id"]}', 'sourceDirectory' : f'{row["system_location"]}', 'existingFileMode.skip': ""} headers={"Authorization": f'Basic {b64encoded}', 'Content-Type': 'application/x-www-form-urlencoded'}
This worked!
Hi @Taaviansper
Great that you got a solution & thanks for updating with the solution - really useful to other users.
Cheers,
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.