I am getting email attachment(images) from Gmail API which returns base64url encoded string. But actual encoded is different from this gmail api("/" is replaced by "_" and "+" is replaced by "-" etc). I want to get original base64 encoded string instead of base64 url encoding format. Shall i replace that two symbols("/","+") from gmail api response or can anyone please help me to achieve this? i am trying this using WSO2 EI 6.3.0.
<call>
<endpoint>
<http method="get" uri-template="{+uri.var.gmail.apiUrl}/{+uri.var.gmail.apiVersion}/users/{+uri.var.gmail.userId}/messages/{+uri.var.id}/attachments/{+uri.var.attachmentId}"/>
</endpoint>
</call>
<property description="emailAttachment" expression="//data/text()" name="emailAttachment" scope="default" type="STRING"/>
for eg,
from Gmail API : after that call, it returns following value in "data" key.
_9j_4AAQSkZJRgABAQAASABIAAD_4QBMRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAAqACAAQAAAABAAAPwKADAAQAAAABAAAL0AAAAAD_....
original Base64 Encoded value:
/9j/4AAQSkZJRgABAQAASABIAAD/4QBMRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAAqACAAQAAAABAAAPwKADAAQAAAABAAAL0AAAAAD/....
newData=data.replace(/-/g, '+').replace(/_/g, '/')