Images are not passing in Knowledge article using rest API method.

amit71
Tera Contributor

Images are not passing in Knowledge article body using rest API method from one instance to another. In the target instance it is just showing image icon not image.

Please suggest method to pass the image in article body.

2 REPLIES 2

Community Alums
Not applicable

chetanb
Tera Guru

Hello @amit71 ,

 

It might be because of encoding issue.

In the source instance, retrieve the image data from KB using binary using getDisplayImage() or getBinaryStream() and then encode the retireve ninary data into Base64 format using -

GlideStringUtil.base64Encode(imageData)

In the target instance, within script that processes API response decode Base64 data back to binary using  

GlideStringUtil.base64Encode(encodedImage). create a new attachment record in the target instance with the decoded binary dta. Update article body to reference newly created attachment using appropriate format like !{sys_id of attachment}

 

if my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

Regards,

CB