How to convert wps/wcm/connect/... (files: image, js, ...) to CDN on Websphere Portal 8.5.5

My website is using Websphere portal 8.5.5, and now I want to move all the files uploaded on the CMS to a CDN server.
For example: https://www.vib.com.vn/wps/wcm/connect/2007834b-2591-4e92-8a46-ef062141afab/4.jpg?MOD=AJPERES&CACHEID=2007834b-2591-4e92-8a46-ef062141afab

switch to https://cdn.vib.com.vn/wps/wcm/connect/2007834b-2591-4e92-8a46-ef062141afab/4.jpg?MOD=AJPERES&CACHEID=2007834b-2591-4e92-8a46-ef062141afab

or optimal file download speed from / wps / wcm / connect?

So what should I do? Anyone with experience please share with me.

Thank you!

You can use WCM REST API to retrieve all file resources component and file elements(attached to the content) in JSON format.

Here is the sample WCM REST url to retrieve all file resource components from wcm library ID 96366283-0ec6-4ee4-9776-8436f1b22b74

http://HOST:PORT/wps/mycontenthandler/wcmrest/definedquery/mycustomquery?libraryid=wcmrest:96366283-0ec6-4ee4-9776-8436f1b22b74&type=LibraryFileComponent&mime-type=application/json

For this you will need to create the custom query

See example here to create a custom query
https://help.hcltechsw.com/digital-experience/8.5/wcm/wcm_rest_defined.html

Here is what I used in my REST client
POST http://localhost:10039/wps/mycontenthandler/wcmrest/DefinedQueryComponent/
Headers: Content-Type: application/atom+xml

BODY
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:wcm="wcm/namespace">
<atom:title>mycustomquery</atom:title>
<wcm:name>mycustomquery</wcm:name>
<wcm:description>defined query description</wcm:description>
</atom:entry>

References

REST service for Web Content Manager:
https://help.hcltechsw.com/digital-experience/8.5/wcm/wcm_rest.html
Service Entry points:
https://help.hcltechsw.com/digital-experience/8.5/wcm/wcm_rest_starting.html
Query parameters:
https://help.hcltechsw.com/digital-experience/8.5/wcm/wcm_rest_adhoc.html
How to manage web content items by using REST:
https://help.hcltechsw.com/digital-experience/8.5/wcm/wcm_rest_crud.html
List of supported WCM media types: https://help.hcltechsw.com/digital-experience/8.5/wcm/wcm_rest_media_types.html