base64 is a way of coding that enlarges the data by up to 30%,
multipart/form-data is part of the standard
http and allows to send binary data, because of that
multipart is faster and consumes less bandwidth
base64 transforms binary data to a "printable" ASCII representation, the 8-bit space is reduced to 6 bits and represented with letters and numbers (plus a couple of symbols), hence the overall size increases. This is explained very well in https://es.wikipedia.org/wiki/Base64#Ejemplo
for this, it uses a 24-bit buffer: it puts in 3 bytes of 8 bits ( 8 x 3 = 24 ) and outputs 4 "letters" of 6 bits each ( 6 x 4 = 24 ).
as 4 is 133% of 3 is generally said to increase the input data by 30%.
base64 is mostly used in
SMTP (which has a space of 7bits) i.e. email servers and relays, or to pass it by url (minus the padding
= which is to be converted to
%3D and has to be decoded separately or calculated) a common example of a
base64 in url is to insert image files (binary) in HTML, XML or CSS (text only).
In simple API's it can make sense for example to pass by url a json encoded in
base64 and so the URL contains all the info to generate the response (there are still some practical limits to the total length of the URL).
multipart on the other hand, it allows data to be sent directly in binary (8-bit bytes) with the
Being an API on
http and you have to choose between the two,
multipart/form-data is the one that goes.
In the case of uploading large files with metadata for example in the youtube API what they provide is an additional method that will separate the process in two parts: you make a POST with the metadata and you receive (in case everything is ok) a
200 but the
location with the URI to where to PUT the file with the
content-length and the
content-type This URI includes the id assigned to the file so you can summarize the upload in case of unstable network, check if it is still in process or if it is already uploaded etc