Using bulk import

cancel
Showing results for 
Search instead for 
Did you mean: 
Taaviansper
Active Member II

Using bulk import

Jump to solution

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.

1 Solution

Accepted Solutions
Taaviansper
Active Member II

Re: Using bulk import

Jump 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! 

View solution in original post

4 Replies
Taaviansper
Active Member II

Re: Using bulk import

Jump to solution

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 !

Taaviansper
Active Member II

Re: Using bulk import

Jump to solution

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.2021-04-14_15-54.png

Taaviansper
Active Member II

Re: Using bulk import

Jump 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! 

EddieMay
Alfresco Employee

Re: Using bulk import

Jump to solution

Hi @Taaviansper 

Great that you got a solution & thanks for updating with the solution - really useful to other users.

Cheers,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!