How to add mail attachments in an-inhouse tool while raising tickets through API call using http request activity?

Hi Everyone,

I would like to ask a question, How to add an attachment in an inhouse tool while raising tickets through API call using http request activity ?

I have completed all the steps successfully. however attachment is now pending.

My project scenario-

  1. To read outlook mail as per the given subject lines and if it matches with the input sheet subject lines then it should raise a ticket for the same with mail attachment on an in-house tool.
  2. So, I have reached to the last steps, where I am only left with the mail attachment process.
  3. I have used http request with get method to complete the ticket raising activity.
  4. Tickets are now getting raised however I need your help to get a solution for mail attachment process.

I would be appreciated a prompt reply here !

Regards,
TIN RPA

@TIN_RPA

In http request you have a attachment property …in which you can send attachments attached

Cheers

Hi @Anil_G,

Could you please let me know about the steps as above suggestions didn’t work.

Regards,
TIN RPA

@TIN_RPA

May I know what did you try?

And ideally you need to do a post request and not a get…what request are you using?

Cheers

Hi @Anil_G

Yes, I am trying It with the post method however I am not getting the correct process to complete this as I have never done before this that’s why facing the issue.

would be thankful for the suggestions on It.

Regards,
TIn RPA

@TIN_RPA

this is where you can add the attachments

cheers

Hi @Anil_G,

It didn’t work. I want to try this by using API body. if I can get some suggestions on it then It would be helped.

Thank you !

Regards,
TIN RPA

@TIN_RPA

For that you need to first check how the api needs the attachment to be added

Cheers

@Anil_G

I have checked it with the team they have told me to do with API mail body.
however I have been trying it for a long, couldn’t get the correct solution.

Regards,
TIN RPA

@TIN_RPA

in api body what is the key you need to provide?

you cannot guess it …they need to provide the details

cheers

@Anil_G
Actually they have told me to convert the save mail attachments file to Convert.ToBase64String(MailFileByteArr) and pass it from API body like-
Var= fileName~attachementVarName

image

I have used http request with get method for ticketing and for attachments will have to use a separate http request with post and into that need to paste this converted value in body. but I cannot directly pass it, will have to assign body and convert it to html something like that…
if you are getting it then please give me some suggestions on this.

Regards,
TIN RPA

@TIN_RPA

What is the body format that is needed?

Did you happen to first try this in postman?

If yes then you can use the curl and import it here

Cheers

Hi @Anil_G,

I got the correct solution for this.

Thanks for your time !

Regards,
TIN RPA

@TIN_RPA

it would be great if you can explain what you did or something that suggested helped…so that others also can follow

cheers

1 Like

@Anil_G

Sure, Actually It was some internal terms which was defined by the team for the API post (for attachments)
however I would like to explain how I did it-

  1. I have used an expression to get the attachments. i.e. FileName(Variable, which has only file name with extension .eml)+“~”+BaseContentOfMail (Convert.ToBase64String(MailFileByteArr)) and put it in body under options in http request activity
  2. Method- Post
  3. Body format- multipart/form-data

Cheers !

1 Like

@TIN_RPA

Yea the body format would make the difference…glad you were able to resolve

Cheers

1 Like