- You want to retrieve the URL of the inserted image in Google Document using Google Docs API.
If my understanding is correct, how about this answer?
I think that the property of inlineObjectElement that you are checking is in the paragraph. The information of the inserted images can be seen at the property of inlineObjects. And the URL can be seen at the property of ImageProperties.
The endpoint is as follows.
Endpoint:
GET https://docs.googleapis.com/v1/documents/{documentId}?fields=inlineObjects
- Here, as a sample,
inlineObjects is used as fields. You can also use * as fields.
Result:
The URL can be retrieved as follows. It supposes that response is the returned value from above endpoint.
url = response.inlineObjects["kix.###"].inlineObjectProperties.embeddedObject.imageProperties.sourceUri
kix.### is inlineObjectId in your question.
- If the image is inserted from the URL of outside, the URL is the same with the URL which was used when the image was inserted.
- If the image is inserted from Google Drive, the URL is like below.
https://lh3.google.com/u/0/d/{fileId}=w###-h###
- In this case,
{fileId} is the file ID of the image. You can retrieve the original file using this file ID.
References:
If I misunderstood your question and this was not the result you want, I apologize.