How to base64 encrypt rest message payload

Swapnil Shirsik
Giga Guru

Hi, i have created a rest post method and invoking it through business rule . I need to encrypt the payload.. how to do it? Is it done in rest message or in business rule or somewhere else?

Please help.

9 REPLIES 9

Karan Chhabra6
Mega Sage

Hi @Swapnil Shirsik ,

 

You can encrypt the payload in your business rule, use this following line of code:

var encryptedPayload = GlideStringUtil.base64Encode(json_payload);

 

If my answer has helped with your question, please mark it as correct and helpful

 

Thanks!

Thanks for reply .

 The json_payload you are referring to- is like body?

Var body={

...

}

 

And i need to use this one line script at the bottom after the body is defined or after r.execute?

@Swapnil Shirsik  - you can use this line just after the body is defined.

 

If my answer has helped with your question, please mark it as correct and helpful

 

Thanks!

Thanks for reply.. i tried but no response.. I have entered your script after body and then set the body as 

r.setRequestBody('encryptedPayload');

 

Please could you confirm if I'm sending the encrypted payload in correct way?