After creating a quote, you need to upload the files that show in necessary files from "Create Quote Response".
Endpoint
POST /api/Payment/UploadFile
Request
URI Parameters
Name | Type | Additional information |
---|---|---|
quoteId | globally unique identifier | Quote Id from "Create Quote Response" |
fileType | int | file Type from "Create Quote Response" 1- stamp, 2- sign , 3-regular(all rest) |
Body Parameters
Name | Type | Additional information |
---|---|---|
file | file | Need to upload file in body |
Response
Name | Type | Additional information |
---|---|---|
fileId | globally unique identifier | The file id if success |
Example Request
public async Task<object> UploadFile(string access_token, Guid quoteId, int fileType)
{
using (var client = new HttpClient())
{
using (var content = new MultipartFormDataContent())
{
try
{
byte[] imgdata = System.IO.File.ReadAllBytes(HttpContext.Current.Server.MapPath("~/img/page2.jpg"));
var file = new StreamContent(new MemoryStream(imgdata));
file.Headers.ContentType = new MediaTypeHeaderValue("image/jpeg");
content.Add(file, "page2", "page2.jpg");
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", access_token);
var queryParameters = new Dictionary<string, string>
{
{ "quoteId", quoteId.ToString() },
{ "fileType", fileType.ToString()}
};
var dictFormUrlEncoded = new FormUrlEncodedContent(queryParameters);
var queryString = await dictFormUrlEncoded.ReadAsStringAsync();
var url = root + "/api/Payment/UploadFile";
var response = client.PostAsync(url + $"?{queryString}", content).Result;
if (response.IsSuccessStatusCode)
{
string result = await response.Content.ReadAsStringAsync();
return result;
}
else return response.StatusCode;
}
catch (Exception e)
{
return "Exception: " + e.Message;
}
}
}
}
Example Response
"202a641e-1111-404c-98e5-d7b59553cacc"