API media calls

Hello All,

I would appreciate any suggests on how to phrase an API call for a specific media while knowing its ID?

So i have a list of media ids that are part of a site, and I would like to go through them and get back the source file name.

I tried doing something like below (copying from my items calls) but it is not getting the response i need (in this case media id is 611)


base_request = "https://OMEKASNAME/api/media?property[0][property]=0&property[0][type]=res&property[0][text]=611"

Any help would be appreciated… thank you

Hi @sanjinmuftic ,

I’ve never structured an API call quite like that.

To get all of the information for a given media id you can use a URL structured like this:

base_request = "https://OMEKASNAME/api/media/611"

Which will return JSON like this where you can extract the source file name:

{
	...
	"o:source": "rigby-city-library-logo.png",
	"o:media_type": "image\/png",
	...
}

Dear @fackrellj

Thanks so much. You set me back on the right path with this. Works like a charm.
Really appreciate your time

Sanjin

1 Like