0

I have to send an images to third party system and content type provided is multipart/formdata and I have to add two parameters in it. and then want to send the request. How to send 2 parameters in it ?

0

1 Answer 1

0

If you have two parameters then it supposed to be separated by a boundary parameter. Syntax for adding 2 parametrs in a request : Sometimes unique boundary creates a problem, so I generate it dynamically in salesforce.

    integer randomNumber = Math.round(math.random()*999999999);
    String boundary = '__boundary__123'+String.valueOf(randomNumber);
    String footer = '\n--'+boundary+'--';
    String header = '--'+boundary+'\n';
    header += 'Content-Disposition: form-data; name="media"; 
    filename="'+file_name+'"';
    header += '\n--'+boundary +'\n';

Not the answer you're looking for? Browse other questions tagged .