Hi Saif,
Your question has not enough information for someone to help you.
What do you mean with "exposed pdf"?
What rest API, one you want to create or an existing one you need to use?
What did you already try but did not get working?
Ideally you share what you coded by uploading an .OML
Regards,
Daniel