I'd like to get the URL for an image that is stored in our OpenAsset server. I can curl a request to get the file's information:
curl -u myUsername:myPassword -X GET http://our.IP.address//REST/1/Files/11 | json_pp
and I can reverse engineer the url that their front end uses to show me an image:
our.IP.address/Serve/DirectImage/imageId.7235-defaultImageSizeId.1
But trying to do some kind of string format to make the url feels hacky. E.g.:
"our.IP.address/Serve/DirectImage/imageId.{}-defaultImageSizeId.1".format(theImageID)
Is there a way get a url directly from the rest request? Is this the correct way to do it?
The OpenAsset REST API is in beta still, so its documentation is surprisingly good given that fact.
starting with :
curl -u username:password -X GET http://my.IP.add.ress//REST/1/Files/
Which is the information about the original file as it was uploaded. To get to a downloadable file you need to go to the
sizes
route.curl -u username:password -X GET http://my.IP.add.ress//REST/1/Files/11/Sizes | json_pp
Which gives a list of the possible sizes and formats.
To get to the file you want you'll need to search this list for the right size and format, and then concatinate the
unc_root
and therelative_path
.