I\'m new in using API. I would like to know if there is a proper way of sending a PDF file using an API key that is converted to Base64. End point information is on the screensh
public class PdfFile
{
[JsonProperty("file")]
public File File { get; set; }
}
public class File
{
[JsonProperty("mime")]
public string MimeType { get; set; }
[JsonProperty("data")]
public string Base64Data { get; set; }
}
Then an Interface looking something like:
[Post("/upload")]
Task UploadPdf([Body]PdfFile file, [Header("x-axa-api-key")] string apiKey);
then your upload code would look something like this
var pdfApi = RestService.For<IPdfApi>("https://goodmorning-axa-dev.azure-api.net");
var pdf = new PdfFile();
var file = new File();
file.MimeType = "application/pdf";
file.Base64Data= "base64-data="; // append base64 encoded data here
pdf.File = file;
await pdfApi.UploadPdf(pdf, "myapikey");