Upload attachments using API

Upload attachments using API

I am trying to attach a file to deals module using API and Power Automate. below method works perfectly with adding and changing data. But, when i am trying to upload a file even though files is being added. I can see in the CRM but they do not open. 

Any suggestions?

getting file name and content and appending it to the array variable
Initializing array variable
creating an http request and passing that array variable in body



I can see the names in the crm but when i click the attachments it says it can not open it.