Get text from component using REST API

Can I extract a text from a component using the REST API? I have a chat baloon component and I want to extract the text from it. As of now, the only solution I found was to create a Python script where I get a JSON of my file, get the component, get the {thumbnailurl}, save the png, use an OCR to extract a text from the png. But, the OCR is returning not so good results and I want to know if there is a simpler solution to it

Use the “GET file nodes” endpoint.

Thanks for the reply! But how could I then extract the text content from there?

Find the required node in the JSON response, look at its children, find an object with the TEXT type and the characters property.