I have limited knowledge to use form-data for the request.
I created a body as
--usersjiaosd9821931-FGGHJ
Content-Disposition: form-data; name="users"; filename="users.json";
Content-Type: application/json
[{"email": "[email protected]","password": "alwaysPostFakePasswords"}, {"email": "[email protected]","password": "sdfnDAqpAdoQF&www344"}]
--usersjiaosd9821931-FGGHJ
Content-Disposition: form-data; name="connection_id"
con_test
--usersjiaosd9821931-FGGHJ--
From the screenshot, the user.json is [{"email": "[email protected]","password": "alwaysPostFakePasswords"}, {"email": "[email protected]","password": "alwaysPostFakePasswords"}]
I built something in Salesforce Apex like
HTTP http = new Http();
Httprequest request = new HttpRequest();
request.setEndpoint('The url to /api/v2/jobs/users-imports');
request.setMethod('POST');
request.setHeader('Accept', 'application/json');
request.setHeader('Content-Type','multipart/form-data; boundary=--usersjiaosd9821931-FGGHJ');
request.setBody(body);
response = http.send(request);
System.debug(response.getBody());
I keep getting {"statusCode":400,"error":"Bad Request","message":"Must provide 'users' file as multipart part.","errorCode":"invalid_body"}