Bulk User Import - The format of value multipart/form-data is invalid

Getting the below error when following this guide: Bulk User Imports

System.FormatException: ‘The format of value ‘multipart/form-data; boundary=—011000010111000001101001’ is invalid.’

I have my code setup as shown in the C# example:

request.AddHeader("authorization", "Bearer " + apiToken);
request.AddHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddParameter("multipart/form-data; boundary=---011000010111000001101001", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"users\"; filename=\"output_0.json\"\r\nContent-Type: text/json\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"connection_id\"\r\n\r\nXXXXXXXXXXX\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"external_id\"\r\n\r\n123456\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);

RestResponse response = client.Execute(request);

Any ideas how to rectify this issue?

Hi @carl.t,

Can you try the web GUI instead?

Or use the extension?

Hi @dan.woda,

The C# code examples are not valid though.

Ended up with something like this:

var uploadRequest = new RestRequest("", Method.Post);
            uploadRequest.AddHeader("Content-Type", "multipart/form-data");
            uploadRequest.AddHeader("Accept", "application/json");
            uploadRequest.AddHeader("Authorization", "Bearer " + ApiToken);
            uploadRequest.AddFile("users", path);
            uploadRequest.AddParameter("connection_id", Auth0DbConnectionId);
            uploadRequest.AddParameter("upsert", "false");
            uploadRequest.AddParameter("send_completion_email", "false");

            var uploadResponse = client.Execute(uploadRequest);

Which follows the endpoint code more than the code from the docs.

To confirm, that is working correctly for you?

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.