Upload Attachment

Below API used to upload attachments in sainofirst platform. Purpose of API is whenever the user wants to send an attachment in the email. user need to upload attachment in sainofirst platform first. sainofirst will provide id represents to attachment. and the user can send this id in send email API's attachment field to send attachment along with the email.

Upload Attachment

POST https://api.saino.io/api/apis/email/upload-attachment

Headers

NameTypeDescription

content-type

string

multipart/form-data with document boundary

Authorization

string

It is a bearer Authorization token to validate request coming from a valid user or not. you can get this token from sainofirst account from API keys section. If you passing programatically then follow below approch: Authorization: "Bearer "+API_KEY

Request Body

NameTypeDescription

file

object

binary file data

{
    status: true, 
    data: { 
        attachment_id: 100,  //id used in send email
        file_size: 100,   //in bytes
        content_type: "<<file_content_type>>", 
        filename: "<<file_name>>" 
    } 
}

Examples

var axios = require('axios');
var FormData = require('form-data');
var fs = require('fs');
var data = new FormData();
data.append('file', fs.createReadStream('/path-to-file'));

var config = {
  method: 'post',
  url: 'https://api.saino.io/api/apis/email/upload-attachment',
  headers: { 
    'Authorization': 'Bearer 808ciij4p1g5h8gkybgzba8ykvkw9pitzkg67bizz0qce', 
    ...data.getHeaders()
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

Last updated