Hi, I need to use the endpoint Create import users job using the Auth0 Management API: Auth0 Management API v2
I did test the endpoint in the Auth0 Management API with my API TOKEN and works inside that.
But, I have problems when I have been to try using cURL, doesn’t work, the response is “Invalid multipart payload format”:
curl --location --request POST 'https://name.auth0.com/api/v2/jobs/users-imports' \
--header 'Authorization: Bearer API_TOKEN' \
--header 'Content-Type: multipart/form-data; boundary=---011000010111000001101001' \
--form 'users=@/home/sebaxtian/Downloads/tmpfile_bulk' \
--form 'connection_id=con_123likethis456'
I did the test, using Postman and in this case, it works:
I need to Create import users job from Python Code, like this:
import requests
url = "https://name.auth0.com/api/v2/jobs/users-imports"
payload = {'connection_id': 'con_HwCa2wIHpzgGff71'}
files = [
('users', open('/home/sebaxtian/Downloads/tmpfile_bulk','rb'))
]
headers = {
'Authorization': 'Bearer API_TOKEN',
'Content-Type': 'multipart/form-data; boundary=---011000010111000001101001'
}
response = requests.request("POST", url, headers=headers, data = payload, files = files)
print(response.text.encode('utf8'))
But, doesn’t work, the response is: “Invalid multipart payload format”
Please, anybody can give me a hand?, I need help with these issues, really I need to Create import users job from Python Code.